footprints¶
A generic multi-purpose fabric for objects with tunable footprints, i.e. some set of key/value pairs that attributes (possibly optional) could cover.
Functions¶
- footprints.collected_priorities(tag)[source]¶
Print a table of collected classes with a priority level higher or equal to
tag.
- footprints.default(**kw)[source]¶
Try to find in existing instances tracked by the
tagcollector a suitable candidate according to description.
- footprints.grep(**kw)[source]¶
Try to find any instance in all collectors that could match given attributes.
- footprints.load(**kw)[source]¶
Same as pickup but operates on an expanded dictionary. Return either
Noneor an object compatible with thetag.
Classes¶
- class footprints.DecorativeFootprint(*args, **kw)[source]¶
Bases:
FootprintThis class extends the
Footprintclass. In addition to the definition and processing of the footprint itself, a class decorator can be registered.The
FootprintBaseMetawill apply this decorator on the target class only when the footprint is used directly (i.e. not when inherited).Initialisation and checking of a given set of footprint.
- class footprints.Footprint(*args, **kw)[source]¶
Bases:
objectThis class defines the objects in charge of handling the footprint definition itself and the resolution mecanism through keys-values description matching.
Initialisation and checking of a given set of footprint.
- as_copy()[source]¶
Returns a deep copy of the internal footprint structure as a pure dictionary. Be aware that some objects such as compiled regular expressions remain identical through this indeep copy operation.
- property attr¶
Read-only property. Direct access to internal footprint set of attributes.
- property bind¶
Read-only property. Direct access to internal footprint binding between attributes.
- checkonly(rd, report=<footprints.reporting.NullReport object>, resolvecache=None)[source]¶
Ensure that the resolved description also matches at least one item per
onlyfeature.
- in_values(item, values)[source]¶
Check that item is inside
valuesor compares as equal to one of these values.
- property info¶
Read-only property. Direct access to internal footprint informative description.
- property level¶
Read-only property. Direct access to internal footprint priority level.
- property only¶
Read-only property. Direct access to internal footprint restriction rules.
- optional(a)[source]¶
Returns whether the given attribute
ais optional or not in the current footprint.
- property priority¶
Read-only property. Direct access to internal footprint priority rules.
- class footprints.FootprintBase(*args, **kw)[source]¶
Bases:
objectBase class for any other thematic class that would need to incorporate a
Footprint. Its metaclass isFootprintBaseMeta.- property footprint¶
Footprint associated to current object’s class.
- classmethod footprint_abstract()[source]¶
Returns whether the current class could be instanciated or not.
- footprint_as_dict()[source]¶
Returns a dictionary that contains a deepcopy of the current attributes.
- footprint_as_shallow_dict()[source]¶
Returns a dictionary that contains the current attributes (shallow copy).
- property footprint_attributes¶
Returns the list of current attributes.
- property footprint_attributes_values¶
Returns the list of current attributes values.
- footprint_cleanup(rd)[source]¶
Removes in the specified
rddescription the keys that are tracked as part of the footprint of the current object.
- footprint_clone(full=False, extra=None)[source]¶
Return a deep copy of the current object as a brand new one. Only footprint attributes are carried around. Attributes to be replaced or added can be specified in dict extra.
- classmethod footprint_clskind()[source]¶
Return a lower-case string of the name of the current footprint class.
- classmethod footprint_clsrealkind()[source]¶
Return the
realkindproperty value of the current class.
- footprint_compatible(rd)[source]¶
Resolve a subset of a description according to my footprint, and then compare to my actual values.
- classmethod footprint_couldbe(rd, report=None, mkreport=False, resolvecache=None)[source]¶
This is the heart of any selection purpose, particularly in relation with the
find_all()mechanism offootprints.Collectorclasses. It returns the resolved form in which the currentrddescription could be recognized as a footprint of the current class,Falseotherwise.
- footprint_getattr(attr, auth=None)[source]¶
Return actual attribute value in internal storage. Protected method.
- property footprint_info¶
Information from the current footprint.
- classmethod footprint_level()[source]¶
Return the tag name of the priority level of the current class footprint object.
- classmethod footprint_mandatory()[source]¶
Returns the attributes that should be present in a description in order to be able to match the current object.
- classmethod footprint_optional(a)[source]¶
Returns whether the specified attribute
ais optional or not.
- classmethod footprint_pl()[source]¶
Return the priority level of the current class footprint object.
- classmethod footprint_retrieve(**kw)[source]¶
Returns the internal checked
footprintof the current class object.
- classmethod footprint_reusable()[source]¶
Returns whether the current class could be used for default loading.
- footprint_setattr(attr, value, auth=None)[source]¶
Set actual attribute to the value specified. Protected method.
- classmethod footprint_values(attrname)[source]¶
Return the list of authorized values of a footprint attribute (if any).
- classmethod footprint_weight(realinputs)[source]¶
Tuple with ordered weights to make a choice possible between various electible footprints.
- property realkind¶
Actual footprint kind, by default the clskind.
- class footprints.FootprintBaseMeta(n, b, d)[source]¶
Bases:
typeMeta class constructor for
FootprintBase. The current_footprintdata which could be a simple dict or aFootprintobject is used to instantiate a newFootprint, built as a merge of the footprint of the base classes.This meta-constructor is in charge of the footprints merging, class registering in footprint collectors and documentation setting.
Exceptions¶
- exception footprints.FootprintFatalError[source]¶
Bases:
FootprintException
- exception footprints.FootprintInvalidDefinition[source]¶
Bases:
FootprintException
- exception footprints.FootprintMaxIter[source]¶
Bases:
FootprintException
- exception footprints.FootprintUnreachableAttr[source]¶
Bases:
FootprintException
Sub-Modules¶
Footprint descriptors for attributes access. |
|
Handling of footprints collectors. |
|
Footprint dynamic configuration. |
|
Footprint's docstring generator |
|
This module provides a few functions on top of the standard logging module in order to easily create new loggers (including root ones) and control their verbosity level. |
|
Footprint utilities to handle the |
|
Proxy objects to footprints catalogs. |
|
Hierarchical documents to store footprints information. |
|
Special derivated builtins to be used as attributes in footprints descriptions in order to avoid automatic value expansion (for example). |
|
Utility functions of the |