footprints.reporting

Hierarchical documents to store footprints information. StandardReport is derived from xml.dom.minidom.Document.

Functions

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

Return actual footprint log object matching description.

footprints.reporting.items()[source]

Return the items of the footprint logs table.

footprints.reporting.keys()[source]

Return the list of current entries names collected.

footprints.reporting.values()[source]

Return the list of current entries values collected.

Classes

class footprints.reporting.FactorizedReport(focus='class', indent='    ', ordering=((('name',), ('kind',)), (('why', 'only'), ('Missing value', 'Invalid value', 'Not in values', 'Outcast value', 'Could not reclass', 'Not a subclass', 'No value found', 'Do not match'))), renaming=(('name', 'attribute_name'),))[source]

Bases: object

Generates a report whose items are sorted using some parameters:

  • tag is the end-level entry that has to be sorted

  • ordering describes the sorting options.

Ordering must be a list of pair (key-name, selected-values) where:

  • the order of the list defines the priority order for sorting

  • the selected-values is a tuple of values to focus on if encountered.

class footprints.reporting.FlatReport(sortlist=None)[source]

Bases: object

Store entries as simple dictionaries that could be hierarchically reshuffled afterward.

By default the report is empty.

add(**kw)[source]

Push the current key-value description as a new report entry.

fulldump()[source]

Print out the internal tree.

reshuffle(sortlist=None, skip=True)[source]

Sort the entire set of items as a hierarchical tree driven by keys of the specified sortlist.

class footprints.reporting.FootprintLog(*args, **kw)[source]

Bases: GetByTag

Collect log informations to produce footprints reports.

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(**kw)[source]

Add an entry to the current log. One of these arguments should be provided:

  • collector

  • candidate

  • attribute

add_attribute(name, **kw)[source]

Insert an attribute resolution information entry into the log.

add_candidate(node, **kw)[source]

Insert a class entry into the log.

add_collector(node, **kw)[source]

Insert a collector entry into the log.

as_dict(force=False, stamp=True)[source]

Convenient method for retrieving some handy dictionary.

as_xml(force=False)[source]

Return a true class:xml.dom.minidom.Document.

clear()[source]

Start a fresh new log history.

current(node=None)[source]

Return current active entry (collector or class) of the log.

fulldump(stamp=False)[source]

Shortcut to :mod:dump facilities.

info()[source]

Return a simple description as a string.

items()[source]

Internal list of items recorded.

reduce_to_last()[source]

Remove from the current log history all but the last collector resolution attempt.

property weak

Boolean value, true if the log was built with weak references (default).

whynot(select)[source]

Diagnostic method for retrieving valuable information on the reason why some class candidates have failed. The select argument is used as a pattern matching on full class names (case insensitive).

class footprints.reporting.FootprintLogClass(node, parent, **kw)[source]

Bases: FootprintLogEntry

Dedicated entry to footprints.FootprintBase items.

Default name is the node fullname method output.

as_dict()[source]

Convenient method for retrieving a handy dictionary.

feed_xml(xmlnode)[source]

Insert in the specified xmlnode informations relative to attributes of the candidate class.

lightdump(indent='    ', attrjust=10)[source]

Pseudo structured dump of the current class item report.

class footprints.reporting.FootprintLogCollector(node, **kw)[source]

Bases: FootprintLogEntry

Dedicated entry to footprints.Collector items.

Default name is the node entry keypoint.

as_dict()[source]

Convenient method for retrieving some handy dictionary.

as_flat(**kw)[source]

Feed a FlatReport according to the order specified.

as_tree(**kw)[source]

Feed a FactorizedReport according to the order specified.

feed_xml(xmlnode)[source]

Insert in the specified xmlnode informations relative to candidate classes.

lightdump(**kw)[source]

Pseudo structured dump of the current collector item report.

class footprints.reporting.FootprintLogEntry(node, **kw)[source]

Bases: object

Generic entry item in the footprint log. Could be :

  • a collector item

  • a candidate item (i.e.: a class)

add(item)[source]

Push the specified item at the end of the internal log list.

class footprints.reporting.NullReport(*args, **kw)[source]

Bases: object

Fake reporting: accept any log report command but do nothing.

add(*args, **kw)[source]

Push any arg provided to the internal raw list of log commands.

clear()[source]

Rewind internal raw list of log commands.

items()[source]

Internal list of items recorded.

class footprints.reporting.StandardReport(doc=None, tag=None)[source]

Bases: object

XML structured report.

add(key, **kw)[source]

Add a information node to the base or to the current node.

current(node=None)[source]

Return the current active node of the document.

dump_all()[source]

Return a string with a complete formatted dump of the document.

dump_last()[source]

Return a string with a complete formatted dump of the last entry.

iter_last()[source]

Iterate on last node and return ( class, name, why ) information.

new_entry(key, **kw)[source]

Insert a top level entry (child of the root node).

Exceptions

exception footprints.reporting.FootprintBadLogEntry[source]

Bases: Exception

Exception raised when inappropriate log entries are met.