コード例 #1
0
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())
コード例 #2
0
def main():
    graphviz = GraphvizOutput()
    graphviz.output_file = 'regexp.png'
    config = Config(include_stdlib=True)

    with PyCallGraph(output=graphviz, config=config):
        reo = compile()
        match(reo)
コード例 #3
0
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())
コード例 #4
0
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()
コード例 #5
0
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
コード例 #6
0
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)
コード例 #7
0
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()
コード例 #8
0
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)
コード例 #9
0
async def run():
    file_path = '/'.join([
            'data/output/images',
            '0201_0101_asyncio.png'
        ])
    graphviz = GraphvizOutput()
    graphviz.output_file = file_path
    with PyCallGraph(output=graphviz):
        it_1 = gen_1()
        it_2 = gen_2(it_1)
        it_3 = gen_3(it_2)
        
        async for val in it_3:
            print(val)
コード例 #10
0
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()
コード例 #11
0
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()
コード例 #12
0
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')
コード例 #13
0
ファイル: callgraph.py プロジェクト: mortvest/bfast-py
    "sum",
    "nanargmin",
    "column_stack",
    "result_type",
    "threading.RLock",
    "cumsum",
    "ndim",
    "nan_to_num",
    "outer",
    "typing.new_type",
    "apply_along_axis",
    "around",
])
graphviz = GraphvizOutput(output_file='filter_max_depth.png')

with PyCallGraph(output=graphviz, config=config):
    n = 50
    ones = np.ones(n).reshape((n, 1)).astype("float64")
    y = np.arange(1, n + 1).astype("float64")
    X = np.copy(y).reshape((n, 1))
    # X = np.column_stack((ones, X))
    # X = ones
    # X[5] = np.nan
    y[14:] = y[14:] * 0.03
    y[5] = np.nan
    y[34:] = y[34:] + 10

    bp = Breakpoints(X, y, use_mp=False, verbosity=0).breakpoints
    # print("Breakpoints:", bp)
    # print()
コード例 #14
0
import logging
import os

import cellmlmanip
import pytest
import sympy as sp
from cellmlmanip.rdf import create_rdf_node

import chaste_codegen as cg
import chaste_codegen.tests.chaste_test_utils as test_utils

from pycallgraph2 import PyCallGraph
from pycallgraph2.output import GraphvizOutput

graphviz = GraphvizOutput()
graphviz.output_file = 'C:/Users/uczmh2/Desktop/venv_weblab/chaste-codegen/codegen.png'

model_file = os.path.join(cg.DATA_DIR, 'tests', 'cellml', 'Shannon2004.cellml')
model = cellmlmanip.load_model(model_file)
with PyCallGraph(output=graphviz):
    cg.ChasteModel(model,
                   'Shannon2004',
                   class_name='CellShannon2004FromCellML')
コード例 #15
0
def pycg():
    return PyCallGraph()
コード例 #16
0
from pycallgraph2 import PyCallGraph
from pycallgraph2.output import GraphvizOutput
#from pycallgraph2 import Config

def vcd_add_object_debug():
    time_0 = time.time()
    vcd = core.VCD()
    for frame_num in range(0, 10000):
        if frame_num % 10 == 0:
            uid = vcd.add_object('CARLOTA' + str(frame_num), '#Car')
        vcd.add_object_data(uid, types.bbox("shape", (0, 0, 100, 200)), frame_value=frame_num)
        
    time_1 = time.time()
    elapsed_time_loop = time_1 - time_0
    print("Loop: %s seconds. " % elapsed_time_loop)

    # time_0 = time.time()
    # vcd.save('./json/vcd_add_object_debug.json', pretty=False)
    # time_1 = time.time()
    # elapsed_time_loop = time_1 - time_0
    # print("Save: %s seconds. " % elapsed_time_loop)

############################
## CREATE CONTENT
############################
with PyCallGraph(output=GraphvizOutput(output_file='./png/vcd_add_object_debug.png', font_size=8)):
   vcd_add_object_debug()

if __name__=="__main__":
    vcd_add_object_debug()