constantly.FlagConstant(_Constant)
class documentationconstantly
(View In Hierarchy)
FlagConstant
defines an attribute to be a flag constant within a collection defined by a
Flags
subclass.
FlagConstant
is
only for use in the definition of Flags
subclasses. Do not
instantiate FlagConstant
elsewhere
and do not subclass it.
Method | __init__ | Undocumented |
Method | __or__ | Define | on two FlagConstant instances
to create a new FlagConstant instance
with all flags set in either instance set. |
Method | __and__ | Define & on two FlagConstant instances
to create a new FlagConstant instance
with only flags set in both instances set. |
Method | __xor__ | Define ^ on two FlagConstant instances
to create a new FlagConstant instance
with only flags set on exactly one instance set. |
Method | __invert__ | Define ~ on a FlagConstant instance
to create a new FlagConstant instance
with all flags not set on this instance set. |
Method | __iter__ | |
Method | __contains__ | |
Method | __nonzero__ | |
Method | _realize | Complete the initialization of this FlagConstant . |
Inherited from _Constant:
Instance Variable | name | A str giving the name of this constant; only set once the
constant is initialized by _ConstantsContainer . |
Method | __repr__ | Return text identifying both which constant this is and which collection it belongs to. |
Method | __lt__ | Implements < . Order is defined by instantiation
order. |
Method | __le__ | Implements <= . Order is defined by instantiation
order. |
Method | __gt__ | Implements > . Order is defined by instantiation
order. |
Method | __ge__ | Implements >= . Order is defined by instantiation
order. |
Instance Variable | _index | A int allocated from a shared counter in order to keep track
of the order in which _Constant s are
instantiated. |
Instance Variable | _container | The _ConstantsContainer
subclass this constant belongs to; None until the constant is
initialized by that subclass. |
Complete the initialization of this FlagConstant
.
This implementation differs from other _realize
implementations in that a FlagConstant
may have
several names which apply to it, due to flags being combined with various
operators.
Parameters | container | The Flags subclass this
constant is part of. |
names | When a single-flag value is being initialized, a str giving
the name of that flag. This is the case which happens when a Flags subclass is being
initialized and FlagConstant instances
from its body are being realized. Otherwise, a set of
str giving names of all the flags set on this FlagConstant instance.
This is the case when two flags are combined using | , for
example. |
Define |
on two FlagConstant
instances
to create a new FlagConstant
instance
with all flags set in either instance set.
Define &
on two FlagConstant
instances
to create a new FlagConstant
instance
with only flags set in both instances set.
Define ^
on two FlagConstant
instances
to create a new FlagConstant
instance
with only flags set on exactly one instance set.
Define ~
on a FlagConstant
instance
to create a new FlagConstant
instance
with all flags not set on this instance set.