自动重构长 python 导入列表
Autorefactor long python import list
我有一些代码包含很长的特定导入,我想自动内联和重构。
例如,
from module.file import (
thisclass,
thatclass,
functionA,
...
functionAA,
functionAB,
...
)
将变为 import module.file as module_file
,所有用法将变为 module_file.functionA
,等等。我研究了 isort
、black
、pycharm、VSCode, 和 rope
但没有看到任何这样做的东西。有没有可以为我完成这项苦差事的软件包或工具?
看起来 libCST 是最佳答案。
我有一些代码包含很长的特定导入,我想自动内联和重构。
例如,
from module.file import (
thisclass,
thatclass,
functionA,
...
functionAA,
functionAB,
...
)
将变为 import module.file as module_file
,所有用法将变为 module_file.functionA
,等等。我研究了 isort
、black
、pycharm、VSCode, 和 rope
但没有看到任何这样做的东西。有没有可以为我完成这项苦差事的软件包或工具?
看起来 libCST 是最佳答案。