Module py2dot
[hide private]
[frames] | no frames]

Module py2dot

source code

Create a dot file from a Python file.

Read a Python files and create a dot file of the function used and called. Imported modules are scanned too, up to a user-defined level of recursion. The dot file can be viewed with Graphviz.

The basic usage is:

$> ./py2dot -f filename.py | dot -Tpng | display

For command line options, type:

$> ./py2dot -h

Inside a Python shell:
>>> import py2dot
>>> infile = open('test.py', 'r')
>>> reclevel = 1
>>> data = py2dot.FileInput(infile, maxreclevel=reclevel)
>>> print data



Author: Lorenzo Bolla

Classes [hide private]
  HashableName
Class to redefine the hash function.
  Element
A generic element of the parsing tree.
  DottedName
  DottedAsName
  DottedAsNames
  ImportFrom
  ImportName
  FuncDef
  Atom
  FuncCall
  ClassDef
  FileInput
Functions [hide private]
 
make_name(x, y, sep='_') source code
 
line(x) source code
 
isiterable(x) source code
 
recapply(ast, cls, data)
Iteratively apply a class constructor to the parser list.
source code