constantly.Flags(Values) class documentationconstantly
(View In Hierarchy)
A Flags subclass
contains constants which can be combined using the common bitwise operators
(|, &, etc) similar to a bitvector
from a language like C.
| Class Method | _constantFactory | For FlagConstant
instances with no explicitly defined value, assign the next power of two as
its value. |
Inherited from _ConstantsContainer (via Values):
| Method | __new__ | Classes representing constants containers are not intended to be instantiated. |
| Class Method | lookupByName | Retrieve a constant by its name or raise a ValueError if
there is no constant associated with that name. |
| Class Method | iterconstants | Iteration over a Names
subclass results in all of the constants it contains. |
| Class Variable | _constantType | Specified by a _ConstantsContainer
subclass to specify the type of constants allowed by that subclass. |
| Class Variable | _enumerants | A dict mapping the names of constants (eg NamedConstant
instances) found in the class definition to those instances. |
Inherited from _ConstantsContainer (via Values):
| Method | __new__ | Classes representing constants containers are not intended to be instantiated. |
| Class Method | lookupByName | Retrieve a constant by its name or raise a ValueError if
there is no constant associated with that name. |
| Class Method | iterconstants | Iteration over a Names
subclass results in all of the constants it contains. |
| Class Variable | _constantType | Specified by a _ConstantsContainer
subclass to specify the type of constants allowed by that subclass. |
| Class Variable | _enumerants | A dict mapping the names of constants (eg NamedConstant
instances) found in the class definition to those instances. |
For FlagConstant
instances with no explicitly defined value, assign the next power of two as
its value.
| Parameters | name | The name of the constant to create. |
| descriptor | An instance of a FlagConstant which is
assigned to name. | |
| Returns | Either the value passed to the descriptor constructor, or the
next power of 2 value which will be assigned to descriptor,
relative to the value of the last defined FlagConstant. | |