footprints.collectors

Handling of footprints collectors. Module’s usage is mostly dedicated to the main footprints package. The footprints proxy could make some part of the interface visible as well.

Functions

footprints.collectors.get(**kw)[source]

Return actual collector object matching description.

footprints.collectors.items()[source]

Return the items of the collectors table.

footprints.collectors.keys()[source]

Return the list of current entries names collected.

footprints.collectors.values()[source]

Return the list of current entries values collected.

Classes

class footprints.collectors.Collector(*args, **kw)[source]

Bases: GetByTag, Catalog, Observer

A class collector is devoted to the gathering of class references that inherit from a given class (here a class with a footprint), according to some other optional criteria.

Parameters:

non_ambiguous_loglevel (int) – The loglevel used in the find_best method when several choices are possible but the priority of the various candidates makes the choice easy (default: logging.INFO).

Some class variables may have an impact on GetByTag behaviour:

  • _tag_default: Sets the default tag (if the tag attribute is omitted when calling the constructor, the _tag_default string will be used.

  • _tag_implicit_new: If set to False, unless new=True is specified when calling the constructor, it won’t be allowed to create new objects (a RuntimeError exception will be thrown).

  • _tag_topcls: if set to False, the tags list will be shared with the parent class (and possibly other siblings). The tag_classes() class method allows to retrieve the list of Classes sharing the same list of tags

add(*items, **kwargs)[source]

Add the items entries in the current catalog.

almost_clone(original, **extra)[source]

Return an almost clone, with some extra or different attributes.

build_attrmap(attrmap=None, only=None)[source]

Build a reversed attr-class map.

default(**kw)[source]

Try to find in existing instances tracked by the tag collector a suitable candidate according to description.

delobsitem(item, info)[source]

Unregister an existing object in the current collector of instances.

discard(bye)[source]

Remove the bye entry from current catalog.

discard_higher_level(tag, verbose=True)[source]

Discard from current collector classes with priority level higher or equal to level.

discard_lower_level(tag, verbose=True)[source]

Discard from current collector classes with priority level lower than level.

discard_onflag(flagmethod, default=True, verbose=True)[source]

Discard from current collector classes with method flagmethod returning default.

discard_package(packname, verbose=True)[source]

Discard from current collector classes with name starting with packname.

filter_higher_level(tag)[source]

Find in current collector classes with priority level higher or equal to level.

filter_lower_level(tag)[source]

Find in current collector classes with priority level lower than level.

filter_onflag(flagmethod, default=True)[source]

Find in current collector classes with method flagmethod returning default.

filter_package(packname)[source]

Find in current collector classes with name starting with packname.

find_all(desc, resolvecache=None)[source]

Returns all the items of the collector that footprint_couldbe() as described by argument desc.

find_any(desc, resolvecache=None)[source]

Return the first item of the collector that footprint_couldbe() as described by argument desc.

find_best(desc, resolvecache=None)[source]

Returns the best of the items returned by the find_all() method according to potential priority rules.

get_values(attrname)[source]

Complete set of values which are explicitly authorized for a given attribute.

grep(**kw)[source]

Grep in the current instances of the collector items that match the set of attributes given as named arguments.

load(**desc)[source]

Return the value matching current collector’s tag after pickup of attributes.

newobsitem(item, info)[source]

Register a new instance of some of the classes in the current collector.

pickup(desc, resolvecache=None)[source]

Try to pickup inside the collector an item that could match the description.

pickup_and_cache(desc, resolvecache=None)[source]

Try to pickup inside the collector an item that could match the description.

report_dump(stamp=False)[source]

Print a nicelly formatted dump report as a dict.

report_dumplast()[source]

Print a nicely formatted dump report as a dict.

property report_last

Return the subpart of the report related to the last sequence of evaluation through the current collector.

report_sorted(**kw)[source]

Return the subpart of the report related to the last sequence of evaluation through the current collector ordered by args.

report_whynot(classname)[source]

Report why any class matching the classname pattern has not been selected through the last evaluation.

reset_package_level(packname, tag)[source]

Reset priority level current collector classes with name starting with packname.

show_attrkeys(only=None)[source]

Show the list of attribute names that could be found in classes collected by the current collector.

show_attrmap(only=None)[source]

Show the complete set of attributes that could be found in classes collected by the current collector, documented with values or outcast sets if present.

classmethod tag_clean(tag)[source]

Return a lower-case string without any “s” at the end.

class footprints.collectors.ResolveCache[source]

Bases: object