将大型 python 文件重构为较小文件的帮助工具
我有一个 3000 多行的 python 文件(称之为 orig
),其中包含 30 个实用函数。我想将其分成 5 个文件(例如 A.py
、B.py
等)。
拆分后,是否有一个辅助工具可以将整个存储库中的所有 orig.func1
和 orig.func2
更改为 A.func1
, B.func2
?
I have a 3000+ line python file (call it orig
) containing 30ish utility functions. I'd like to split it into 5 files (say A.py
, B.py
, etc).
After the split, is there a helper tool to change all the orig.func1
and orig.func2
in the entire repo to A.func1
, B.func2
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 @BrokenBenchmark 所建议的,我最终用 python 编写了自己的助手
As @BrokenBenchmark suggested, I ended up writing my own helper in python
这是 Rope 可以帮助你的事情。
您需要进行 MoveGlobal 重构。如果 你的IDE/编辑器有Rope支持并且它支持移动重构,它可能也支持MoveGlobal。
This is something that Rope can help you with.
You need to do a MoveGlobal Refactoring. If your IDE/editor has Rope support and it supports move refactoring, it would probably support MoveGlobal as well.