Skip to content

Commit 7c53db9

Browse files
branchvincentneersighted
authored andcommitted
chore: ban relative imports
1 parent d7c3e21 commit 7c53db9

File tree

89 files changed

+186
-205
lines changed

Some content is hidden

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

89 files changed

+186
-205
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[flake8]
22
min_python_version = 3.6.0
33
max-line-length = 88
4+
ban-relative-imports = true
45
inline-quotes = double
56
extend-ignore =
67
# E501: Line too long (FIXME: long string constants)

src/poetry/__main__.py

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

33

44
if __name__ == "__main__":
5-
from .console.application import main
5+
from poetry.console.application import main
66

77
sys.exit(main())

src/poetry/config/config.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
from typing import Dict
99
from typing import Optional
1010

11+
from poetry.config.config_source import ConfigSource
12+
from poetry.config.dict_config_source import DictConfigSource
1113
from poetry.locations import CACHE_DIR
1214

13-
from .config_source import ConfigSource
14-
from .dict_config_source import DictConfigSource
15-
1615

1716
def boolean_validator(val: str) -> bool:
1817
return val in {"true", "false", "1", "0"}

src/poetry/config/dict_config_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import Any
22
from typing import Dict
33

4-
from .config_source import ConfigSource
4+
from poetry.config.config_source import ConfigSource
55

66

77
class DictConfigSource(ConfigSource):

src/poetry/config/file_config_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from tomlkit import document
77
from tomlkit import table
88

9-
from .config_source import ConfigSource
9+
from poetry.config.config_source import ConfigSource
1010

1111

1212
if TYPE_CHECKING:

src/poetry/console/application.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@
2121
from cleo.io.outputs.output import Output
2222

2323
from poetry.__version__ import __version__
24+
from poetry.console.command_loader import CommandLoader
25+
from poetry.console.commands.command import Command
2426
from poetry.core.utils._compat import PY37
2527

26-
from .command_loader import CommandLoader
27-
from .commands.command import Command
28-
2928

3029
if TYPE_CHECKING:
3130
from crashtest.solution_providers.solution_provider_repository import (
@@ -205,7 +204,7 @@ def _configure_io(self, io: IO) -> None:
205204

206205
name = io.input.first_argument
207206
if name == "run":
208-
from .io.inputs.run_argv_input import RunArgvInput
207+
from poetry.console.io.inputs.run_argv_input import RunArgvInput
209208

210209
input = cast(ArgvInput, io.input)
211210
run_input = RunArgvInput([self._name or ""] + input._tokens)
@@ -237,8 +236,8 @@ def _configure_io(self, io: IO) -> None:
237236
def register_command_loggers(
238237
self, event: ConsoleCommandEvent, event_name: str, _: Any
239238
) -> None:
240-
from .logging.io_formatter import IOFormatter
241-
from .logging.io_handler import IOHandler
239+
from poetry.console.logging.io_formatter import IOFormatter
240+
from poetry.console.logging.io_handler import IOHandler
242241

243242
command = event.command
244243
if not isinstance(command, Command):
@@ -278,7 +277,7 @@ def register_command_loggers(
278277
def configure_env(
279278
self, event: ConsoleCommandEvent, event_name: str, _: Any
280279
) -> None:
281-
from .commands.env_command import EnvCommand
280+
from poetry.console.commands.env_command import EnvCommand
282281

283282
command: EnvCommand = cast(EnvCommand, event.command)
284283
if not isinstance(command, EnvCommand):
@@ -303,7 +302,7 @@ def configure_env(
303302
def configure_installer(
304303
self, event: ConsoleCommandEvent, event_name: str, _: Any
305304
) -> None:
306-
from .commands.installer_command import InstallerCommand
305+
from poetry.console.commands.installer_command import InstallerCommand
307306

308307
command: InstallerCommand = cast(InstallerCommand, event.command)
309308
if not isinstance(command, InstallerCommand):

src/poetry/console/commands/about.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .command import Command
1+
from poetry.console.commands.command import Command
22

33

44
class AboutCommand(Command):

src/poetry/console/commands/add.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from cleo.helpers import argument
55
from cleo.helpers import option
66

7-
from .init import InitCommand
8-
from .installer_command import InstallerCommand
7+
from poetry.console.commands.init import InitCommand
8+
from poetry.console.commands.installer_command import InstallerCommand
99

1010

1111
class AddCommand(InstallerCommand, InitCommand):

src/poetry/console/commands/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from cleo.helpers import option
22

3-
from .env_command import EnvCommand
3+
from poetry.console.commands.env_command import EnvCommand
44

55

66
class BuildCommand(EnvCommand):

src/poetry/console/commands/cache/clear.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from cleo.helpers import argument
44
from cleo.helpers import option
55

6-
from ..command import Command
6+
from poetry.console.commands.command import Command
77

88

99
class CacheClearCommand(Command):

src/poetry/console/commands/cache/list.py

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

33
from typing import Optional
44

5-
from ..command import Command
5+
from poetry.console.commands.command import Command
66

77

88
class CacheListCommand(Command):

src/poetry/console/commands/check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pathlib import Path
22

3-
from .command import Command
3+
from poetry.console.commands.command import Command
44

55

66
class CheckCommand(Command):

src/poetry/console/commands/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from cleo.helpers import argument
1212
from cleo.helpers import option
1313

14-
from .command import Command
14+
from poetry.console.commands.command import Command
1515

1616

1717
if TYPE_CHECKING:

src/poetry/console/commands/debug/info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22

3-
from ..command import Command
3+
from poetry.console.commands.command import Command
44

55

66
class DebugInfoCommand(Command):

src/poetry/console/commands/debug/resolve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from cleo.helpers import option
66
from cleo.io.outputs.output import Verbosity
77

8-
from ..init import InitCommand
8+
from poetry.console.commands.init import InitCommand
99

1010

1111
if TYPE_CHECKING:

src/poetry/console/commands/env/info.py

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

44
from cleo.helpers import option
55

6-
from ..command import Command
6+
from poetry.console.commands.command import Command
77

88

99
if TYPE_CHECKING:

src/poetry/console/commands/env/list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from cleo.helpers import option
22

3-
from ..command import Command
3+
from poetry.console.commands.command import Command
44

55

66
class EnvListCommand(Command):

src/poetry/console/commands/env/remove.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from cleo.helpers import argument
22
from cleo.helpers import option
33

4-
from ..command import Command
4+
from poetry.console.commands.command import Command
55

66

77
class EnvRemoveCommand(Command):

src/poetry/console/commands/env/use.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from cleo.helpers import argument
22

3-
from ..command import Command
3+
from poetry.console.commands.command import Command
44

55

66
class EnvUseCommand(Command):

src/poetry/console/commands/env_command.py

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

3+
from poetry.console.commands.command import Command
34
from poetry.utils.env import Env
45

5-
from .command import Command
6-
76

87
class EnvCommand(Command):
98
def __init__(self) -> None:

src/poetry/console/commands/export.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from cleo.helpers import option
22

3+
from poetry.console.commands.command import Command
34
from poetry.utils.exporter import Exporter
45

5-
from .command import Command
6-
76

87
class ExportCommand(Command):
98

src/poetry/console/commands/init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
from cleo.helpers import option
1616
from tomlkit import inline_table
1717

18-
from .command import Command
19-
from .env_command import EnvCommand
18+
from poetry.console.commands.command import Command
19+
from poetry.console.commands.env_command import EnvCommand
2020

2121

2222
if TYPE_CHECKING:

src/poetry/console/commands/install.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from cleo.helpers import option
22

3-
from .installer_command import InstallerCommand
3+
from poetry.console.commands.installer_command import InstallerCommand
44

55

66
class InstallCommand(InstallerCommand):

src/poetry/console/commands/installer_command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import TYPE_CHECKING
22

3-
from .env_command import EnvCommand
3+
from poetry.console.commands.env_command import EnvCommand
44

55

66
if TYPE_CHECKING:

src/poetry/console/commands/lock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from cleo.helpers import option
22

3-
from .installer_command import InstallerCommand
3+
from poetry.console.commands.installer_command import InstallerCommand
44

55

66
class LockCommand(InstallerCommand):

src/poetry/console/commands/new.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from cleo.helpers import argument
44
from cleo.helpers import option
55

6-
from .command import Command
6+
from poetry.console.commands.command import Command
77

88

99
class NewCommand(Command):

src/poetry/console/commands/plugin/add.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from cleo.helpers import argument
99
from cleo.helpers import option
1010

11-
from ..init import InitCommand
11+
from poetry.console.commands.init import InitCommand
1212

1313

1414
if TYPE_CHECKING:

src/poetry/console/commands/publish.py

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

44
from cleo.helpers import option
55

6-
from .command import Command
6+
from poetry.console.commands.command import Command
77

88

99
class PublishCommand(Command):

src/poetry/console/commands/run.py

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

55
from cleo.helpers import argument
66

7-
from .env_command import EnvCommand
7+
from poetry.console.commands.env_command import EnvCommand
88

99

1010
if TYPE_CHECKING:

src/poetry/console/commands/search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from cleo.helpers import argument
22

3-
from .command import Command
3+
from poetry.console.commands.command import Command
44

55

66
class SearchCommand(Command):

src/poetry/console/commands/self/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from cleo.helpers import argument
1010
from cleo.helpers import option
1111

12-
from ..command import Command
12+
from poetry.console.commands.command import Command
1313

1414

1515
if TYPE_CHECKING:

src/poetry/console/commands/shell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from distutils.util import strtobool
44
from os import environ
55

6-
from .env_command import EnvCommand
6+
from poetry.console.commands.env_command import EnvCommand
77

88

99
class ShellCommand(EnvCommand):

src/poetry/console/commands/show.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from cleo.helpers import argument
77
from cleo.helpers import option
88

9-
from .env_command import EnvCommand
9+
from poetry.console.commands.env_command import EnvCommand
1010

1111

1212
if TYPE_CHECKING:

src/poetry/console/commands/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from cleo.helpers import argument
22
from cleo.helpers import option
33

4-
from .installer_command import InstallerCommand
4+
from poetry.console.commands.installer_command import InstallerCommand
55

66

77
class UpdateCommand(InstallerCommand):

src/poetry/console/commands/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from cleo.helpers import argument
44
from cleo.helpers import option
55

6-
from .command import Command
6+
from poetry.console.commands.command import Command
77

88

99
if TYPE_CHECKING:

src/poetry/console/logging/formatters/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .builder_formatter import BuilderLogFormatter
1+
from poetry.console.logging.formatters.builder_formatter import BuilderLogFormatter
22

33

44
FORMATTERS = {

src/poetry/console/logging/formatters/builder_formatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import re
22

3-
from .formatter import Formatter
3+
from poetry.console.logging.formatters.formatter import Formatter
44

55

66
class BuilderLogFormatter(Formatter):

src/poetry/console/logging/io_formatter.py

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

33
from typing import TYPE_CHECKING
44

5-
from .formatters import FORMATTERS
5+
from poetry.console.logging.formatters import FORMATTERS
66

77

88
if TYPE_CHECKING:

0 commit comments

Comments
 (0)