class xr_query_flags

Flag class: additional properties for an xr_query .

xr_query_flags Details

class cs.xr_query_flags

Flag class: additional properties for an xr_query .

static from_integer(_inner)

Construct an instance from an integer representation.

Parameters:_inner (int) – The integer representation, as returned by xr_query_flags.as_integer().
Return type:xr_query_flags
Raises:result.ERROR_INVALID_ARGUMENT if _inner is not a valid integer representation for a xr_query_flags instance.

Invariant: For xr_query_flags x, xr_query_flags.from_integer(x.as_integer()) == x

>>> xqf = (xr_query_flags.UNIQUIFY | xr_query_flags.POPULATE_COUNTERS).as_integer()
>>> xqf
3
>>> xr_query_flags.from_integer(xqf)
<cs.xr_query_flags uniquify|populate_counters>
__and__(b)

AND operator for xr_query_flags .

Parameters:b (xr_query_flags) – AND operand.
Return type:xr_query_flags
Returns:A xr_query_flags object containing all flags that are in both self and b.
>>> xr_query_flags.NONE & xr_query_flags.UNIQUIFY
<cs.xr_query_flags none>
__cmp__(other)

Comparison function for xr_query_flags , with respect to a stable overall ordering.

Parameters:other (xr_query_flags) – The xr_query_flags object to compare against.
Return type:int
Returns:An integer N such that:
  • N==0 if the two objects compare equal
  • N<0 if self < other
  • N>0 if self > other
>>> xr_query_flags.UNIQUIFY.__cmp__(xr_query_flags.POPULATE_COUNTERS)
-1
__eq__(b)

Equality operator for xr_query_flags .

Parameters:b (xr_query_flags) – The xr_query_flags object to compare against.
Return type:bool
Returns:True if self and b compare equal, False otherwise.
>>> xr_query_flags.UNIQUIFY == xr_query_flags.NONE
False
__ge__(b)

Greater-than-or-equal operator for xr_query_flags .

Parameters:b (xr_query_flags) – The xr_query_flags object to compare against.
Return type:bool
Returns:True if self >= b , False otherwise.
>>> xr_query_flags.UNIQUIFY >= xr_query_flags.NONE
True
__gt__(b)

Greater-than operator for xr_query_flags .

Parameters:b (xr_query_flags) – The xr_query_flags object to compare against.
Return type:bool
Returns:True if self > b , False otherwise.
>>> xr_query_flags.POPULATE_COUNTERS > xr_query_flags.UNIQUIFY
True
__hash__()

Hash function for xr_query_flags .

Return type:int
>>> hash(xr_query_flags.NONE)
0
__invert__()

Complementation operator.

Return type:xr_query_flags
Returns:A xr_query_flags object containing the flags that are NOT contained in self.
>>> ~xr_query_flags.UNIQUIFY
<cs.xr_query_flags populate_counters>
__le__(b)

Less-than-or-equal operator for xr_query_flags .

Parameters:b (xr_query_flags) – The xr_query_flags object to compare against.
Return type:bool
Returns:True if self <= b , False otherwise.
>>> xr_query_flags.POPULATE_COUNTERS <= xr_query_flags.UNIQUIFY
False
__lt__(b)

Less-than operator for xr_query_flags .

Parameters:b (xr_query_flags) – The xr_query_flags object to compare against.
Return type:bool
Returns:True if self < b , False otherwise.
>>> xr_query_flags.POPULATE_COUNTERS < xr_query_flags.NONE
False
__ne__(b)

Inequality operator for xr_query_flags .

Parameters:b (xr_query_flags) – The xr_query_flags object to compare against.
Return type:bool
Returns:False if self and b compare equal, True otherwise.
>>> xr_query_flags.NONE != xr_query_flags.POPULATE_COUNTERS
True
__or__(b)

OR operator for xr_query_flags .

Parameters:b (xr_query_flags) – OR operand.
Return type:xr_query_flags
Returns:A xr_query_flags object containing all flags that are in at least one of self, b.
>>> xr_query_flags.NONE | xr_query_flags.POPULATE_COUNTERS
<cs.xr_query_flags populate_counters>
__repr__()

Get a representation of a xr_query_flags object that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> repr(xr_query_flags.UNIQUIFY)
'<cs.xr_query_flags uniquify>'
__str__()

Get a simple string representation of a xr_query_flags object.

Return type:str
Returns:The string representation.
>>> str(xr_query_flags.POPULATE_COUNTERS)
'populate_counters'
as_integer()

Get an integer representation of self.

Return type:int
Returns:An integer suitable for use with xr_query_flags.from_integer().

Invariant: For xr_query_flags x, xr_query_flags.from_integer(x.as_integer()) == x

>>> xqf = (xr_query_flags.UNIQUIFY | xr_query_flags.POPULATE_COUNTERS).as_integer()
>>> xqf
3
>>> xr_query_flags.from_integer(xqf)
<cs.xr_query_flags uniquify|populate_counters>
name()

Get the name of a xr_query_flags object.

Return type:str
>>> xr_query_flags.POPULATE_COUNTERS.name()
'populate_counters'
NONE

Empty set: contains no flags.

>>> xr_query_flags.NONE
<cs.xr_query_flags none>
POPULATE_COUNTERS

Singleton set containing the “populate counters” flag: compute and store tuple counts for later retrieval by xr_query_iterator get_*() functions.

The following are only available when this flag is specified.

>>> xr_query_flags.POPULATE_COUNTERS
<cs.xr_query_flags populate_counters>
UNIQUIFY

Singleton set containing the “uniquify” flag: specifies whether and how the query will perform ‘uniquification’ on its result set.

Behavior depends on whether or not a comparison function qcmp for the xr_query has been specified with xr_query.set_cmp().

  • If qcmp is not specified:
    • If xr_query_flags.UNIQUIFY is specified, the query will return only unique tuples. (That is, if the raw result set contains a subset of tuples that are identical across all values, all but one of those tuples will be removed before returning the set.)
    • If xr_query_flags.UNIQUIFY is not specified, no uniquification is performed.
  • If cmp is specified:
    • If xr_query_flags.UNIQUIFY is specified, the query will perform uniquification with respect to qcmp: if the raw result set contains a subset of tuples that all compare equal according to qcmp, all but one of those tuples will be removed before returning the set.)
    • If xr_query_flags.UNIQUIFY is not specified, the query will perform uniquification with respect to complete tuple uniqueness (that is, the same unquification strategy as used when qcmp is not specified and xr_query_flags.UNIQUIFY is specified).
>>> xr_query_flags.UNIQUIFY
<cs.xr_query_flags uniquify>