Package lepl :: Package support :: Module graph :: Class ConstructorStr
[hide private]
[frames] | no frames]

Class ConstructorStr

source code


Reconstruct the constructors used to generate the graph as a string (useful for repr).

Internally, data is stored as a list of (indent, line) pairs.

Instance Methods [hide private]
 
__init__(self, line_length=80)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
node(self, node)
Store the node's class name for later use.
source code
 
loop(self, value)
Replace loop nodes by a <loop> marker.
source code
 
constructor(self, *args, **kargs)
Build the constructor string, given the node and arguments.
source code
 
leaf(self, value)
Non-node nodes (attributes) are displayed using repr.
source code
 
postprocess(self, lines)
This is an ad-hoc algorithm to make the final string reasonably compact.
source code
 
__compress(self, lines, start, stop)
Try a compact version first.
source code
 
__bunch_up(self, lines, start, stop)
Scrunch adjacent lines together.
source code
 
__all_on_one_line(self, lines, start, stop)
Try all on one line.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
__fmt(lines)
Join lines together, given the indent.
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, line_length=80)
(Constructor)

source code 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

node(self, node)

source code 
Store the node's class name for later use.
Overrides: Visitor.node

loop(self, value)

source code 
Replace loop nodes by a <loop> marker.
Overrides: Visitor.loop

constructor(self, *args, **kargs)

source code 
Build the constructor string, given the node and arguments.
Overrides: Visitor.constructor

leaf(self, value)

source code 
Non-node nodes (attributes) are displayed using repr.
Overrides: Visitor.leaf

postprocess(self, lines)

source code 
This is an ad-hoc algorithm to make the final string reasonably compact. It's ugly, bug-prone and completely arbitrary, but it seems to work....
Overrides: Visitor.postprocess