python-igraph manual

For using igraph from Python

   Home       Trees       Indices       Help   
Package igraph :: Package drawing :: Module metamagic :: Class AttributeCollectorMeta
[hide private]

Type AttributeCollectorMeta

source code

object --+    
      type --+

Metaclass for attribute collector classes

Classes that use this metaclass are intended to collect vertex/edge attributes from various sources (a Python dict, a vertex/edge sequence, default values from the igraph configuration and such) in a given order of precedence. See the module documentation for more details. This metaclass enables the user to use a simple declarative syntax to specify which attributes he is interested in. For each vertex/edge attribute, a corresponding class attribute must be defined with a value that describes the default value of that attribute if no other data source provides us with any suitable value. The default value can also be a tuple; in that case, the first element of the tuple is the actual default value, the second element is a converter function that will convert the attribute values to a format expected by the caller who uses the class being defined.

There is a special class attribute called _kwds_prefix; this is not used as an attribute declaration. It can contain a string which will be used to derive alternative names for the attributes when the attribute is accessed in a Python dict. This is useful in many situations; for instance, the default graph drawer would want to access the vertex colors using the color vertex attribute, but when it looks at the keyword arguments passed to the original call of igraph.Graph.__plot__, the vertex_color keyword argument should be looked up because we also have colors for the edges. _kwds_prefix will be prepended to the attribute names when they are looked up in a dict of keyword arguments.

If you require a more fine-tuned behaviour, you can assign an AttributeSpecification instance to a class attribute directly.

See Also: AttributeCollectorBase

Instance Methods [hide private]

Inherited from type: __call__, __delattr__, __eq__, __ge__, __getattribute__, __gt__, __hash__, __init__, __instancecheck__, __le__, __lt__, __ne__, __repr__, __setattr__, __subclasscheck__, __subclasses__, mro

Inherited from object: __format__, __reduce__, __reduce_ex__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
record_generator(mcs, name, slots)
Generates a simple class that has the given slots and nothing else
source code
Static Methods [hide private]
a new object with type S, a subtype of T
__new__(mcs, name, bases, attrs) source code
Properties [hide private]

Inherited from type: __abstractmethods__, __base__, __bases__, __basicsize__, __dictoffset__, __flags__, __itemsize__, __mro__, __name__, __weakrefoffset__

Inherited from object: __class__

Method Details [hide private]

__new__(mcs, name, bases, attrs)
Static Method

source code 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__
(inherited documentation)

   Home       Trees       Indices       Help