Skip to content

Commit ff2a2bb

Browse files
branchvneersighted
authored andcommitted
chore(pre-commit): add flake8-tidy-imports
1 parent 2c0b0b4 commit ff2a2bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+102
-125
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[flake8]
22
max-line-length = 88
33
extend-ignore = E501, E203
4+
ban-relative-imports = true
45
per-file-ignores =
56
__init__.py:F401
67
tests/ui/test_exception_trace.py:W291

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ repos:
2525
- flake8-bugbear
2626
- flake8-comprehensions
2727
- flake8-simplify
28+
- flake8-tidy-imports
2829

2930
- repo: https://github.com/asottile/pyupgrade
3031
rev: v2.29.1

cleo/application.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@
88
from typing import TYPE_CHECKING
99
from typing import cast
1010

11-
from .commands.command import Command
12-
from .commands.completions_command import CompletionsCommand
13-
from .commands.help_command import HelpCommand
14-
from .commands.list_command import ListCommand
15-
from .events.console_command_event import ConsoleCommandEvent
16-
from .events.console_error_event import ConsoleErrorEvent
17-
from .events.console_events import COMMAND
18-
from .events.console_events import ERROR
19-
from .events.console_events import TERMINATE
20-
from .events.console_terminate_event import ConsoleTerminateEvent
21-
from .events.event_dispatcher import EventDispatcher
22-
from .exceptions import CleoException
23-
from .exceptions import CleoSimpleException
24-
from .exceptions import CommandNotFoundException
25-
from .exceptions import LogicException
26-
from .exceptions import NamespaceNotFoundException
27-
from .io.inputs.argument import Argument
28-
from .io.inputs.argv_input import ArgvInput
29-
from .io.inputs.definition import Definition
30-
from .io.inputs.input import Input
31-
from .io.inputs.option import Option
32-
from .io.io import IO
33-
from .io.outputs.output import Output
34-
from .io.outputs.output import Verbosity
35-
from .io.outputs.stream_output import StreamOutput
36-
from .loaders.command_loader import CommandLoader
37-
from .terminal import Terminal
38-
from .ui.ui import UI
11+
from cleo.commands.command import Command
12+
from cleo.commands.completions_command import CompletionsCommand
13+
from cleo.commands.help_command import HelpCommand
14+
from cleo.commands.list_command import ListCommand
15+
from cleo.events.console_command_event import ConsoleCommandEvent
16+
from cleo.events.console_error_event import ConsoleErrorEvent
17+
from cleo.events.console_events import COMMAND
18+
from cleo.events.console_events import ERROR
19+
from cleo.events.console_events import TERMINATE
20+
from cleo.events.console_terminate_event import ConsoleTerminateEvent
21+
from cleo.events.event_dispatcher import EventDispatcher
22+
from cleo.exceptions import CleoException
23+
from cleo.exceptions import CleoSimpleException
24+
from cleo.exceptions import CommandNotFoundException
25+
from cleo.exceptions import LogicException
26+
from cleo.exceptions import NamespaceNotFoundException
27+
from cleo.io.inputs.argument import Argument
28+
from cleo.io.inputs.argv_input import ArgvInput
29+
from cleo.io.inputs.definition import Definition
30+
from cleo.io.inputs.input import Input
31+
from cleo.io.inputs.option import Option
32+
from cleo.io.io import IO
33+
from cleo.io.outputs.output import Output
34+
from cleo.io.outputs.output import Verbosity
35+
from cleo.io.outputs.stream_output import StreamOutput
36+
from cleo.loaders.command_loader import CommandLoader
37+
from cleo.terminal import Terminal
38+
from cleo.ui.ui import UI
3939

4040

4141
if TYPE_CHECKING:
@@ -603,7 +603,7 @@ def extract_namespace(self, name: str, limit: int | None = None) -> str:
603603
return " ".join(parts)
604604

605605
def _get_default_ui(self) -> UI:
606-
from .ui.progress_bar import ProgressBar
606+
from cleo.ui.progress_bar import ProgressBar
607607

608608
return UI([ProgressBar()])
609609

cleo/color.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import os
44

5-
from .exceptions import ValueException
5+
from cleo.exceptions import ValueException
66

77

88
class Color:

cleo/commands/command.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from typing import TYPE_CHECKING
77
from typing import Any
88

9+
from cleo.commands.base_command import BaseCommand
910
from cleo.formatters.style import Style
1011
from cleo.io.inputs.string_input import StringInput
1112
from cleo.io.io import IO
@@ -14,8 +15,6 @@
1415
from cleo.parser import Parser
1516
from cleo.ui.table_separator import TableSeparator
1617

17-
from .base_command import BaseCommand
18-
1918

2019
if TYPE_CHECKING:
2120
from cleo.ui.progress_bar import ProgressBar

cleo/commands/completions_command.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
import re
88
import subprocess
99

10-
from .. import helpers
11-
from .command import Command
12-
from .completions.templates import TEMPLATES
10+
from cleo import helpers
11+
from cleo.commands.command import Command
12+
from cleo.commands.completions.templates import TEMPLATES
1313

1414

1515
class CompletionsCommand(Command):

cleo/commands/help_command.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from __future__ import annotations
22

3+
from cleo.commands.command import Command
34
from cleo.io.inputs.argument import Argument
45

5-
from .command import Command
6-
76

87
class HelpCommand(Command):
98

cleo/commands/list_command.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from __future__ import annotations
22

3+
from cleo.commands.command import Command
34
from cleo.io.inputs.argument import Argument
45

5-
from .command import Command
6-
76

87
class ListCommand(Command):
98

cleo/descriptors/text_descriptor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88

99
from cleo.application import Application
1010
from cleo.commands.command import Command
11+
from cleo.descriptors.descriptor import Descriptor
1112
from cleo.formatters.formatter import Formatter
1213
from cleo.io.inputs.argument import Argument
1314
from cleo.io.inputs.definition import Definition
1415
from cleo.io.inputs.option import Option
1516

16-
from .descriptor import Descriptor
17-
1817

1918
class TextDescriptor(Descriptor):
2019
def _describe_argument(self, argument: Argument, **options: Any) -> None:
@@ -157,7 +156,7 @@ def _describe_command(self, command: Command, **options: Any) -> None:
157156
self._write("\n")
158157

159158
def _describe_application(self, application: Application, **options: Any) -> None:
160-
from .application_description import ApplicationDescription
159+
from cleo.descriptors.application_description import ApplicationDescription
161160

162161
described_namespace = options.get("namespace")
163162
description = ApplicationDescription(application, namespace=described_namespace)

cleo/events/console_command_event.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
from typing import TYPE_CHECKING
44

5+
from cleo.events.console_event import ConsoleEvent
56
from cleo.io.io import IO
67

7-
from .console_event import ConsoleEvent
8-
98

109
if TYPE_CHECKING:
1110
from cleo.commands.command import Command

0 commit comments

Comments
 (0)