Known subclasses: twisted.python.constants.Names, twisted.python.constants.Values

_ConstantsContainer is a class with attributes used as symbolic constants. It is up to subclasses to specify what kind of constants are allowed.

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.
Class Method _constantFactory Construct the value for a new constant to add to this container.
_constantType =
Specified by a _ConstantsContainer subclass to specify the type of constants allowed by that subclass.
_enumerants =
A dict mapping the names of constants (eg NamedConstant instances) found in the class definition to those instances.
def __new__(cls): (source)

Classes representing constants containers are not intended to be instantiated.

The class object itself is used directly.

@classmethod
def _constantFactory(cls, name, descriptor): (source)

Construct the value for a new constant to add to this container.

ParametersnameThe name of the constant to create.
descriptorAn instance of a _Constant subclass (eg NamedConstant) which is assigned to name.
ReturnsNamedConstant instances have no value apart from identity, so return a meaningless dummy value.
@classmethod
def lookupByName(cls, name): (source)

Retrieve a constant by its name or raise a ValueError if there is no constant associated with that name.

ParametersnameA str giving the name of one of the constants defined by cls.
ReturnsThe NamedConstant associated with name.
RaisesValueErrorIf name is not the name of one of the constants defined by cls.
@classmethod
def iterconstants(cls): (source)

Iteration over a Names subclass results in all of the constants it contains.

Returnsan iterator the elements of which are the NamedConstant instances defined in the body of this Names subclass.
API Documentation for Twisted, generated by pydoctor at 2016-04-04 15:02:49.