py-check.mk: Run isort with "make format"
If /usr/bin/isort is found, run it during "make format" to get a defined way the imports are sorted. tool.isort in pyproject.toml is updated to match the other fixers. Commit the fallout of this change. Running the other fixers alone doesn't change the formatting, so this should be safe. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
a7dd607667
commit
5d77955ed9
56 changed files with 109 additions and 67 deletions
|
|
@ -17,6 +17,9 @@
|
||||||
|
|
||||||
[tool.isort]
|
[tool.isort]
|
||||||
|
|
||||||
|
multi_line_output = 3
|
||||||
|
line_length = 88
|
||||||
|
lines_after_imports = 1
|
||||||
lines_between_sections = 1
|
lines_between_sections = 1
|
||||||
lines_between_types = 1
|
lines_between_types = 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,10 @@ ifndef PY_CHECK_RUFF
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef PY_CHECK_ISORT
|
||||||
|
PY_CHECK_ISORT := $(firstword $(wildcard /usr/bin/isort))
|
||||||
|
endif
|
||||||
|
|
||||||
ifndef PY_CHECK_YAPF
|
ifndef PY_CHECK_YAPF
|
||||||
PY_CHECK_YAPF := $(firstword $(wildcard /usr/bin/yapf /usr/bin/yapf3))
|
PY_CHECK_YAPF := $(firstword $(wildcard /usr/bin/yapf /usr/bin/yapf3))
|
||||||
endif
|
endif
|
||||||
|
|
@ -67,6 +71,9 @@ endif
|
||||||
py-format:
|
py-format:
|
||||||
find . -type f -name '*.py' -print0 | \
|
find . -type f -name '*.py' -print0 | \
|
||||||
xargs -0 sed -i -E '1{/^# -\*- coding: utf-8 -\*-$$/{:a;N;/\n[[:space:]]*$$/ba;s/^# -\*- coding: utf-8 -\*-\n([[:space:]]*\n)*/ /;s/^ //}}'
|
xargs -0 sed -i -E '1{/^# -\*- coding: utf-8 -\*-$$/{:a;N;/\n[[:space:]]*$$/ba;s/^# -\*- coding: utf-8 -\*-\n([[:space:]]*\n)*/ /;s/^ //}}'
|
||||||
|
ifneq ($(PY_CHECK_ISORT),)
|
||||||
|
$(PY_CHECK_ISORT) $(PY_CHECK_ROOTS)
|
||||||
|
endif
|
||||||
ifneq ($(PY_CHECK_YAPF),)
|
ifneq ($(PY_CHECK_YAPF),)
|
||||||
$(PY_CHECK_YAPF) --in-place --recursive $(PY_CHECK_ROOTS)
|
$(PY_CHECK_YAPF) --in-place --recursive $(PY_CHECK_ROOTS)
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import sys
|
||||||
|
|
||||||
from enum import Enum, auto
|
from enum import Enum, auto
|
||||||
from functools import cache
|
from functools import cache
|
||||||
from typing import Any, cast, override, TYPE_CHECKING
|
from typing import TYPE_CHECKING, Any, cast, override
|
||||||
|
|
||||||
from .lib.App import App as Base
|
from .lib.App import App as Base
|
||||||
from .lib.Distro import Distro
|
from .lib.Distro import Distro
|
||||||
|
|
@ -19,8 +19,8 @@ from .lib.ProjectConf import ProjectConf
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import argparse
|
import argparse
|
||||||
from argparse import ArgumentParser
|
|
||||||
|
|
||||||
|
from argparse import ArgumentParser
|
||||||
from typing import TypeAlias
|
from typing import TypeAlias
|
||||||
|
|
||||||
from .lib.ExecContext import ExecContext
|
from .lib.ExecContext import ExecContext
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
from typing import override
|
from typing import override
|
||||||
|
|
||||||
from .App import App
|
from .App import App
|
||||||
from .lib.Cmd import Cmd as Base
|
from .lib.Cmd import Cmd as Base
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import override, TYPE_CHECKING
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
from ..App import App as Parent
|
from ..App import App as Parent
|
||||||
from ..CmdBase import CmdBase as Base
|
from ..CmdBase import CmdBase as Base
|
||||||
|
|
@ -8,6 +8,7 @@ from ..CmdBase import CmdBase as Base
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
|
|
||||||
from ..lib.Distro import Distro
|
from ..lib.Distro import Distro
|
||||||
|
|
||||||
class Cmd(Base): # export
|
class Cmd(Base): # export
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import override, TYPE_CHECKING
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
from .Cmd import Cmd, Parent
|
from .Cmd import Cmd, Parent
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import override, TYPE_CHECKING
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
from ...CmdBase import CmdBase as Base
|
from ...CmdBase import CmdBase as Base
|
||||||
from ..CmdPosix import CmdPosix as Parent
|
from ..CmdPosix import CmdPosix as Parent
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
from typing import Any, override, TYPE_CHECKING
|
from typing import TYPE_CHECKING, Any, override
|
||||||
|
|
||||||
from ....CmdBase import CmdBase as Base
|
from ....CmdBase import CmdBase as Base
|
||||||
from ....lib.FileContext import FileContext
|
from ....lib.FileContext import FileContext
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
from ....lib.log import DEBUG, log
|
from ....lib.log import DEBUG, log
|
||||||
from .Cmd import Cmd, Parent
|
from .Cmd import Cmd, Parent
|
||||||
from typing import TYPE_CHECKING, override
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import override, TYPE_CHECKING
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
from ...CmdBase import CmdBase as Base
|
from ...CmdBase import CmdBase as Base
|
||||||
from ..CmdProjects import CmdProjects as Parent
|
from ..CmdProjects import CmdProjects as Parent
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,9 @@ from __future__ import annotations
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, override
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
from ...lib.base import InputMode
|
from ...lib.base import InputMode, Result
|
||||||
from ...lib.log import NOTICE, log
|
from ...lib.log import NOTICE, log
|
||||||
from .Cmd import Cmd, Parent
|
from .Cmd import Cmd, Parent
|
||||||
from ...lib.base import Result
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
from ...App import Scope
|
from ...App import Scope
|
||||||
from .Cmd import Cmd, Parent
|
from .Cmd import Cmd, Parent
|
||||||
from typing import TYPE_CHECKING, override
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from .Cmd import Cmd, Parent
|
|
||||||
from typing import TYPE_CHECKING, override
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
|
from .Cmd import Cmd, Parent
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from .Cmd import Cmd, Parent
|
|
||||||
from typing import TYPE_CHECKING, override
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
|
from .Cmd import Cmd, Parent
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
from ...App import Scope
|
from ...App import Scope
|
||||||
from .Cmd import Cmd, Parent
|
from .Cmd import Cmd, Parent
|
||||||
from typing import TYPE_CHECKING, override
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
from ...lib.log import DEBUG, log
|
from ...lib.log import DEBUG, log
|
||||||
from ...lib.Uri import Uri
|
from ...lib.Uri import Uri
|
||||||
from .Cmd import Cmd, Parent
|
from .Cmd import Cmd, Parent
|
||||||
from typing import TYPE_CHECKING, override
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from .Cmd import Cmd, Parent
|
|
||||||
from typing import TYPE_CHECKING, override
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
|
from .Cmd import Cmd, Parent
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from .Cmd import Cmd, Parent
|
|
||||||
from typing import TYPE_CHECKING, override
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
|
from .Cmd import Cmd, Parent
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
from ...App import Scope
|
from ...App import Scope
|
||||||
from .Cmd import Cmd, Parent
|
from .Cmd import Cmd, Parent
|
||||||
from typing import TYPE_CHECKING, override
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import TYPE_CHECKING, override
|
||||||
|
|
||||||
from ...App import Scope
|
from ...App import Scope
|
||||||
from .Cmd import Cmd, Parent
|
from .Cmd import Cmd, Parent
|
||||||
from typing import TYPE_CHECKING, override
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue