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

Class GraphStr

source code


Generate an ASCII graph of the nodes.

This should be used with ConstructorWalker and works rather like cloning, except that instead of generating a new set of nodes we generate a nested set of functions. This set of functions has the same structure as the tree of nodes (we break cycles via loop). The leaf functions take prefixes and return an ASCII picture of what the leaf values should look like (including the prefixes). Functions higher up the tree are similar, except instead of returning a picture directly they extend the prefix and then call the functions that are their children.

Once we have an entire tree of functions, we can call the root with an empty prefix and the functions will "cascade" down, building the prefixes necessary and passing them to the root functions that generate the final ASCII data.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
loop(self, value)
Mark loops (what else could we do?)
source code
 
node(self, node)
Store the class name.
source code
 
constructor(self, *args, **kargs)
Generate a function that can construct the local section of the graph when given the appropriate prefixes.
source code
 
leaf(self, value)
Generate a function that can construct the local section of the graph when given the appropriate prefixes.
source code
 
postprocess(self, fun)
Invoke the functions generated above and join the resulting lines.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

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

loop(self, value)

source code 
Mark loops (what else could we do?)
Overrides: Visitor.loop

node(self, node)

source code 
Store the class name.
Overrides: Visitor.node

constructor(self, *args, **kargs)

source code 
Generate a function that can construct the local section of the graph when given the appropriate prefixes.
Overrides: Visitor.constructor

leaf(self, value)

source code 
Generate a function that can construct the local section of the graph when given the appropriate prefixes.
Overrides: Visitor.leaf

postprocess(self, fun)

source code 
Invoke the functions generated above and join the resulting lines.
Overrides: Visitor.postprocess