def main(): gephi = GephiOutput() gephi.output_file = 'large.gdf' with PyCallGraph(output=gephi): from urllib3 import urlopen from xml.dom.minidom import parseString parseString(urlopen('http://w3.org/').read())
def test_simple(graphviz): with PyCallGraph(output=graphviz): one_nop() dot = open(graphviz.output_file).read() os.unlink(graphviz.output_file) assert 'digraph G' in dot assert 'subgraph cluster_test' in dot
def main(): graphviz = GraphvizOutput() graphviz.output_file = 'large.png' config = Config(include_stdlib=True) with PyCallGraph(output=graphviz, config=config): from urllib3 import urlopen from xml.dom.minidom import parseString parseString(urlopen('http://w3.org/').read())
def main(): graphviz = GraphvizOutput() graphviz.output_file = 'basic.png' with PyCallGraph(output=graphviz): person = Person() for a in xrange(10): person.add_banana(Banana()) person.eat_bananas()
def test_simple(gephi): with PyCallGraph(output=gephi): one_nop() generated = open(gephi.output_file).read() os.unlink(gephi.output_file) assert 'nodedef> name VARCHAR' in generated assert 'edgedef> node1 VARCHAR, node2 VARCHAR' in generated assert 'test.calls.one_nop,1,true,true' in generated assert 'test.calls.one_nop,test.calls.nop,1,true,true' in generated
def main(): graphviz = GraphvizOutput() graphviz.output_file = 'recursive.png' with PyCallGraph(output=graphviz): try: for a in xrange(1, 10): factorial(a) except: for a in range(1, 10): factorial(a)
def main(): import_list = ( 'pickle', 'htmllib', 'urllib2', ) graphviz = GraphvizOutput() config = Config(include_stdlib=True) for module in import_list: graphviz.output_file = 'import-{}.png'.format(module) with PyCallGraph(output=graphviz, config=config): __import__(module)
def main(): gephi = GephiOutput() gephi.output_file = 'basic.gdf' with PyCallGraph(output=gephi): person = Person() try: for a in xrange(10): person.add_banana(Banana()) except: for a in range(10): person.add_banana(Banana()) person.eat_bananas()
def run(name, trace_filter=None, config=None, comment=None): if not config: config = Config() if trace_filter: config.trace_filter = trace_filter graphviz = GraphvizOutput() graphviz.output_file = 'filter-{}.png'.format(name) if comment: graphviz.graph_attributes['graph']['label'] = comment with PyCallGraph(config=config, output=graphviz): banana = Banana() banana.eat()
def run(name, trace_grouper=None, config=None, comment=None): if not config: config = Config() config.trace_filter = GlobbingFilter() if trace_grouper is not None: config.trace_grouper = trace_grouper graphviz = GraphvizOutput() graphviz.output_file = 'grouper-{}.png'.format(name) if comment: graphviz.graph_attributes['graph']['label'] = comment with PyCallGraph(config=config, output=graphviz): example_with_submodules.main()
def main(): graphviz = GraphvizOutput() pycallgraph = PyCallGraph(output=graphviz, config=Config(include_stdlib=True)) pycallgraph.start() pycallgraph.stop() # Set the edge colour to black for all examples graphviz.edge_color_func = lambda e: Color(0, 0, 0) # Default node colouring graphviz.output_file = 'colours-default.png' graphviz.done() def run(func, output_file): graphviz.node_color_func = func graphviz.output_file = output_file graphviz.done() run(rainbow, 'colors-rainbow.png') run(greyscale, 'colors-greyscale.png') run(orange_green, 'colors-orange-green.png') run(rand, 'colors-random.png')
def pycg(): return PyCallGraph()