我目前在VSCode中使用默认的python linter。但是,短绒棉绒裤(格式文档)不断更改模块的导入顺序,如下所示。由于模块(project_settings.py
)在当前脚本(preprocess.py
)的父目录中,因此我相信我必须在导入之前添加系统路径(this_01之后)。
我是否没有遵循正确的PEP8规则? (紧随this_02之后)如何在linter不更改导入顺序的情况下将模块导入其他目录?我是否需要为短绒动物设置某种忽略规则?
内部preprocess.py
(格式化程序之前)
import sys
sys.path.insert(0, './scripts/')
from project_settings import *
(格式化后)
from project_settings import *
import sys
sys.path.insert(0, './scripts/')
项目结构
root
└── scripts
├── data-preparation
│ └── **preprocess.py**
├── ...
├── main.py
├── project_settings.py
└── utils.py
ps.s。我仍然想使用Python linter,但想正确使用它,以使linter不会更改导入顺序
"[python]": {
"editor.formatOnPaste": false
}