Skip to content

Instantly share code, notes, and snippets.

@galenseilis
Created October 18, 2022 20:05
Show Gist options
  • Save galenseilis/79299b2a0985cf9b492e0168c5358772 to your computer and use it in GitHub Desktop.
Save galenseilis/79299b2a0985cf9b492e0168c5358772 to your computer and use it in GitHub Desktop.
from pycallgraph2 import PyCallGraph
from pycallgraph2 import Config
from pycallgraph2 import GlobbingFilter
from pycallgraph2.output import GraphvizOutput
f=lambda p,r,c=0:(q:=[c:=b+c*r for b in p])!=c==0and-~f(q[:-1],r)
x = ([1, -12, 60, -160, 240, -192, 64, 0], 2)
config = Config()
config.trace_filter = GlobbingFilter(exclude=[
'pycallgraph2.*'
])
with PyCallGraph(output=GraphvizOutput(), config=config):
f(*x)
@galenseilis
Copy link
Author

Output:
pycallgraph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment