限制Python追溯输出仅在特定文件中的代码

发布于 2025-02-11 04:13:09 字数 227 浏览 1 评论 0原文

我正在尝试在其呼叫订单中自动生成函数呼叫列表以进行文档目的,

python - m trace --trackcalls main.py

但是,使用我的文件运行跟踪模块似乎显示了所有呼叫,包括内置模块,而我只需要跟踪我写的源文件,以便我可以在文档中显示程序的工作流程。是否有任何仅获取指定源文件的跟踪的方便方法,或者我别无选择,只能编写一个额外的脚本进行原始跟踪输出并过滤它?

I am trying to automatically generate a list of function call in their call order for documentation purposes with something like

python - m trace --trackcalls main.py

however, running the trace module with my files seems to show ALL calls, including built-in modules, while I only need the trace for the source files written by me so that I can show the workflow of the program in the documentation. Is there any existing convenient way to only get the trace for specified source files or would I have no other choice but writing an additional script taking the raw trace output and filtering it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文