Use a formatter of some kind
I suggest running the entire codebase through any formatter. I can recommend ruff(https://docs.astral.sh/ruff/), which can be used as an extension in vscode with these settings:
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
}
}
With these settings, ruff will automatically format your code following the PEPs and reorganize the imports inside your modules.
Edited by Evgeniy Martynenko