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 _Constants are instantiated.
Instance Variable _container The _ConstantsContainer subclass this constant belongs to; None until the constant is initialized by that subclass.
def __init__(self, value=_unspecified): (source)
def _realize(self, container, names, value): (source)

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.

ParameterscontainerThe Flags subclass this constant is part of.
namesWhen 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.
def __or__(self, other): (source)

Define | on two FlagConstant instances to create a new FlagConstant instance with all flags set in either instance set.

def __and__(self, other): (source)

Define & on two FlagConstant instances to create a new FlagConstant instance with only flags set in both instances set.

def __xor__(self, other): (source)

Define ^ on two FlagConstant instances to create a new FlagConstant instance with only flags set on exactly one instance set.

def __invert__(self): (source)

Define ~ on a FlagConstant instance to create a new FlagConstant instance with all flags not set on this instance set.

def __iter__(self): (source)
ReturnsAn iterator of flags set on this instance set.
def __contains__(self, flag): (source)
ParametersflagThe flag to test for membership in this instance set.
ReturnsTrue if flag is in this instance set, else False.
def __nonzero__(self): (source)
ReturnsFalse if this flag's value is 0, else True.
API Documentation for Twisted, generated by pydoctor at 2015-11-29 11:40:45.