【发布时间】:2022-02-03 02:08:56
【问题描述】:
我正在使用 pycallgraph(来自 jupyter notebook)来了解我正在处理的代码库。出于某种原因,GlobbingFilter 似乎不起作用 - 我无法使用 GlobbingFilter 排除事物
from pycallgraph import PyCallGraph, Config, GlobbingFilter
from pycallgraph.output import GraphvizOutput
from PIL import Image
import numpy as np
gv = GraphvizOutput()
gv.output_file = 'basic2.png'
config = Config()
config.trace_filter = GlobbingFilter(
exclude=['pycallgraph.*', '*__init__*'], include=['__main__'])
class Apple:
def __init__(self):
pass
def eat(self):
pass
class Basket:
def __init__(self):
self.content = []
def add(self, other):
self.content.append(other)
with PyCallGraph(output=gv, config=config):
a = Apple()
b = Basket()
b.add(a)
b.content[0].eat()
Image.open(gv.output_file)
输出图像包含__init__ 方法。关于如何删除它们的任何想法?另外我也不能排除类和他们的孩子(例如Apple)
附言。我正在使用callgraph4py(如果pycallgraph,则为托管叉子)
【问题讨论】:
标签: python graphviz pycallgraph