Table of Contents

Class: TypeClass ./src/peak/model/elements.py

Basis for all flavors

Base Classes   
Namespace.__class__
Methods   
__new__
findComponent
mdl_featureNames
mdl_features
mdl_featuresDefined
mdl_sortedFeatures
  __new__ 
__new__ (
        meta,
        name,
        bases,
        cdict,
        )

  findComponent 
findComponent (
        self,
        component,
        default=NOT_GIVEN,
        )

  mdl_featureNames 
mdl_featureNames ( self )

Names of all features, in monotonic order (see mdl_features)

  mdl_features 
mdl_features ( self )

All feature objects of this type, in monotonic order

The monotonic order of features is equivalent to the concatenation of mdl_featuresDefined for all classes in the type's MRO, in reverse MRO order, with duplicates (i.e. overridden features) eliminated. That is, if a feature named x exists in more than one class in the MRO, the most specific definition of x will be used (i.e. the first definition in MRO order), but it will be placed in the position reserved by the less specific definition. The idea is that, once a position has been defined for a feature name, it will continue to be used by all subclasses, if possible. For example:

            class A(model.Type):
                class foo(model.Attribute): pass

            class B(A):
                class foo(model.Attribute): pass
                class bar(model.Attribute): pass

would result in B having a mdl_features order of (foo,bar), even though its mdl_featuresDefined would be (bar,foo) (because features without a sort priority define are ordered by name).

The purpose of using a monotonic ordering like this is that it allows subtypes to use a serialized format that is a linear extension of their supertype, at least in the case of single inheritance. It may also be useful for GUI layouts, where it's also desirable to have a subtype's display look "the same" as a base type's display, except for those features that it adds to the supertype.

  mdl_featuresDefined 
mdl_featuresDefined (
        self,
        instDict,
        attrName,
        )

Sorted tuple of feature objects defined/overridden by this class

  mdl_sortedFeatures 
mdl_sortedFeatures ( self )

All feature objects of this type, in sorted order


Table of Contents

This document was automatically generated on Mon Nov 11 01:11:05 2024 by HappyDoc version 2.1