Package gavo :: Package base :: Module structure :: Class StructType
[frames] | no frames]

Type StructType

source code

object --+    
         |    
      type --+
             |
            StructType

is a metaclass for the representation of structured data.

StructType classes with this will be called structures within the DC software.

Structures do quite a bit of the managed attribute nonsense to meaningfully catch crazy user input.

Basically, you give a Structure class attributes (preferably with underscores in front) specifying the attributes the instances should have and how they should be handled.

Structures must be constructed with a parent (for the root element, this is None). All other arguments should be keyword arguments. If given, they have to refer to existing attributes, and their values will directly give the the values of the attribute (i.e., parsed values).

Structures should always inherit from StructBase below and arrange for its constructor to be called, since, e.g., default processing happens there.

Structures have a managedAttrs dictionary containing names and attrdef.AttributeDef objects for the defined attributes.

Instance Methods
the object's type
__init__(cls, name, bases, dict)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__providedBy__(...)
Object Specification Descriptor
source code
 
__provides__(...)
Special descriptor for class __provides__

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__

Class Variables
  __implemented__ = <implementedBy gavo.base.structure.StructType>
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)

__provides__(...)

 

Special descriptor for class __provides__

The descriptor caches the implementedBy info, so that we can get declarations for objects without instance-specific interfaces a bit quicker.