BlockIt
|
Functions | |
def | indent |
def | indentNoStrip |
def | And |
def | Or |
def | Not |
def | startsWith |
def | endsWith |
def | genBlockGraph |
def | depGraph |
def | topoSort |
Variables | |
list | __all__ |
tuple | pack = lambdax:x.strip() |
tuple | tab = lambdax:len(x) |
tuple | isLeaf = lambda(x,v) |
def blockit::funcs::depGraph | ( | blocks, | |
table, | |||
silent = True |
|||
) |
Generate dependency graph which is simply a dictionary where each entry is the node name and contains a list of sets. The first set is the nodes connected to incoming edges, the second set is the nodes connected to outgoing edges. The graph is generated for the dependencies of the types in the block list. For example, if the list of blocks are of type AFile, then the dependencies found are between AFiles; if modules, then modules, etc... Use the output of this function with topoSort() to get an non-unique ordering of dependencies. Input ----- blocks : list of blocks to find the build order for table : global symbol table to use
def blockit::funcs::genBlockGraph | ( | blk | ) |
def blockit::funcs::indent | ( | nspaces, | |
s | |||
) |
def blockit::funcs::indentNoStrip | ( | nspaces, | |
s | |||
) |
def blockit::funcs::topoSort | ( | diGraph, | |
prune = True |
|||
) |
Topological sort of a given diGraph. The diGraph is represented as a dictionary whose keys are the node names and each key entry contains a 2-tuple of lists/sets. The first is the keys of nodes connected on incoming edges, the second is the keys of nodes connected on outgoing edges. Example: ------- {'node1':(['a','b','c'],['r','s','t']} means 'node1' has nodes ['a','b','c','d'] connected on 'incoming' edges, i.e. 'node1' depends on these nodes. Likewise, nodes ['r','s','t'] are dependent on 'node1' because they are connected on 'outgoing' edges. Input ----- diGraph : the diGraph prune : boolean flag to prune isolated nodes from the list
tuple blockit::funcs::isLeaf = lambda(x,v) |
tuple blockit::funcs::pack = lambdax:x.strip() |
tuple blockit::funcs::tab = lambdax:len(x) |