This formatter should usually be used as the base class of all formatters. It is a traited Configurable
class and includes an extensible API for users to determine how their objects are formatted. The following logic is used to find a function to format an given object.
The object is introspected to see if it has a method with the name print_method
. If is does, that object is passed to that method for formatting.
If no print method is found, three internal dictionaries are consulted to find print method: singleton_printers
, type_printers
and deferred_printers
.
Users should use these dictionaries to register functions that will be used to compute the format data for their objects (if those objects don't have the special print methods). The easiest way of using these dictionaries is through the for_type
and for_type_by_name
methods.
If no function/callable is found to compute the format data, None
is returned and this format type is not used.
A base formatter class that is configurable.
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them