Package gavo :: Package utils :: Module autonode :: Class AutoNodeType
[frames] | no frames]

Type AutoNodeType

source code

object --+    
         |    
      type --+
             |
            AutoNodeType
Known Subclasses:

A metaclass for AutoNodes..

The idea here is to define children in a class definition and make sure they are actually present.

AutoNodes are supposed to be immutable; the are defined during construction. Currently, nothing keeps you from changing them afterwards, but that may change.

The classes' constructor is defined to accept all attributes as arguments (you probably want to use keyword arguments here). It is the constructor that sets up the attributes, so AutoNodes must not have an __init__ method. However, they may define a method _setupNode that is called just before the artificial constructor returns.

To define the attributes of the class, add _a_<attname> attributes giving a default to the class. The default should normally be either None for 1:1 or 1:0 relations or an empty tuple for 1:n relations. The defaults must return a repr that constructs them, since we create a source fragment.

Instance Methods
the object's type
__init__(cls, name, bases, dict)
x.__init__(...) initializes x; see help(type(x)) for signature
source code

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

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

Properties

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

Inherited from object: __class__

Method Details

__init__(cls, name, bases, dict)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Returns: the object's type
Overrides: object.__init__
(inherited documentation)