Skip to content

Commit

Permalink
chore: ban relative imports
Browse files Browse the repository at this point in the history
  • Loading branch information
branchvincent authored and neersighted committed Nov 17, 2021
1 parent d7c3e21 commit 7c53db9
Show file tree
Hide file tree
Showing 89 changed files with 186 additions and 205 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[flake8]
min_python_version = 3.6.0
max-line-length = 88
ban-relative-imports = true
inline-quotes = double
extend-ignore =
# E501: Line too long (FIXME: long string constants)
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@


if __name__ == "__main__":
from .console.application import main
from poetry.console.application import main

sys.exit(main())
5 changes: 2 additions & 3 deletions src/poetry/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@
from typing import Dict
from typing import Optional

from poetry.config.config_source import ConfigSource
from poetry.config.dict_config_source import DictConfigSource
from poetry.locations import CACHE_DIR

from .config_source import ConfigSource
from .dict_config_source import DictConfigSource


def boolean_validator(val: str) -> bool:
return val in {"true", "false", "1", "0"}
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/config/dict_config_source.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any
from typing import Dict

from .config_source import ConfigSource
from poetry.config.config_source import ConfigSource


class DictConfigSource(ConfigSource):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/config/file_config_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from tomlkit import document
from tomlkit import table

from .config_source import ConfigSource
from poetry.config.config_source import ConfigSource


if TYPE_CHECKING:
Expand Down
15 changes: 7 additions & 8 deletions src/poetry/console/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
from cleo.io.outputs.output import Output

from poetry.__version__ import __version__
from poetry.console.command_loader import CommandLoader
from poetry.console.commands.command import Command
from poetry.core.utils._compat import PY37

from .command_loader import CommandLoader
from .commands.command import Command


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

name = io.input.first_argument
if name == "run":
from .io.inputs.run_argv_input import RunArgvInput
from poetry.console.io.inputs.run_argv_input import RunArgvInput

input = cast(ArgvInput, io.input)
run_input = RunArgvInput([self._name or ""] + input._tokens)
Expand Down Expand Up @@ -237,8 +236,8 @@ def _configure_io(self, io: IO) -> None:
def register_command_loggers(
self, event: ConsoleCommandEvent, event_name: str, _: Any
) -> None:
from .logging.io_formatter import IOFormatter
from .logging.io_handler import IOHandler
from poetry.console.logging.io_formatter import IOFormatter
from poetry.console.logging.io_handler import IOHandler

command = event.command
if not isinstance(command, Command):
Expand Down Expand Up @@ -278,7 +277,7 @@ def register_command_loggers(
def configure_env(
self, event: ConsoleCommandEvent, event_name: str, _: Any
) -> None:
from .commands.env_command import EnvCommand
from poetry.console.commands.env_command import EnvCommand

command: EnvCommand = cast(EnvCommand, event.command)
if not isinstance(command, EnvCommand):
Expand All @@ -303,7 +302,7 @@ def configure_env(
def configure_installer(
self, event: ConsoleCommandEvent, event_name: str, _: Any
) -> None:
from .commands.installer_command import InstallerCommand
from poetry.console.commands.installer_command import InstallerCommand

command: InstallerCommand = cast(InstallerCommand, event.command)
if not isinstance(command, InstallerCommand):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/about.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .command import Command
from poetry.console.commands.command import Command


class AboutCommand(Command):
Expand Down
4 changes: 2 additions & 2 deletions src/poetry/console/commands/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from cleo.helpers import argument
from cleo.helpers import option

from .init import InitCommand
from .installer_command import InstallerCommand
from poetry.console.commands.init import InitCommand
from poetry.console.commands.installer_command import InstallerCommand


class AddCommand(InstallerCommand, InitCommand):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from cleo.helpers import option

from .env_command import EnvCommand
from poetry.console.commands.env_command import EnvCommand


class BuildCommand(EnvCommand):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/cache/clear.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from cleo.helpers import argument
from cleo.helpers import option

from ..command import Command
from poetry.console.commands.command import Command


class CacheClearCommand(Command):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/cache/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Optional

from ..command import Command
from poetry.console.commands.command import Command


class CacheListCommand(Command):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/check.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

from .command import Command
from poetry.console.commands.command import Command


class CheckCommand(Command):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from cleo.helpers import argument
from cleo.helpers import option

from .command import Command
from poetry.console.commands.command import Command


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/debug/info.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys

from ..command import Command
from poetry.console.commands.command import Command


class DebugInfoCommand(Command):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/debug/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from cleo.helpers import option
from cleo.io.outputs.output import Verbosity

from ..init import InitCommand
from poetry.console.commands.init import InitCommand


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/env/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from cleo.helpers import option

from ..command import Command
from poetry.console.commands.command import Command


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/env/list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from cleo.helpers import option

from ..command import Command
from poetry.console.commands.command import Command


class EnvListCommand(Command):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/env/remove.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from cleo.helpers import argument
from cleo.helpers import option

from ..command import Command
from poetry.console.commands.command import Command


class EnvRemoveCommand(Command):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/env/use.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from cleo.helpers import argument

from ..command import Command
from poetry.console.commands.command import Command


class EnvUseCommand(Command):
Expand Down
3 changes: 1 addition & 2 deletions src/poetry/console/commands/env_command.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import Optional

from poetry.console.commands.command import Command
from poetry.utils.env import Env

from .command import Command


class EnvCommand(Command):
def __init__(self) -> None:
Expand Down
3 changes: 1 addition & 2 deletions src/poetry/console/commands/export.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from cleo.helpers import option

from poetry.console.commands.command import Command
from poetry.utils.exporter import Exporter

from .command import Command


class ExportCommand(Command):

Expand Down
4 changes: 2 additions & 2 deletions src/poetry/console/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from cleo.helpers import option
from tomlkit import inline_table

from .command import Command
from .env_command import EnvCommand
from poetry.console.commands.command import Command
from poetry.console.commands.env_command import EnvCommand


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/install.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from cleo.helpers import option

from .installer_command import InstallerCommand
from poetry.console.commands.installer_command import InstallerCommand


class InstallCommand(InstallerCommand):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/installer_command.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TYPE_CHECKING

from .env_command import EnvCommand
from poetry.console.commands.env_command import EnvCommand


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/lock.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from cleo.helpers import option

from .installer_command import InstallerCommand
from poetry.console.commands.installer_command import InstallerCommand


class LockCommand(InstallerCommand):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from cleo.helpers import argument
from cleo.helpers import option

from .command import Command
from poetry.console.commands.command import Command


class NewCommand(Command):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/plugin/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from cleo.helpers import argument
from cleo.helpers import option

from ..init import InitCommand
from poetry.console.commands.init import InitCommand


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from cleo.helpers import option

from .command import Command
from poetry.console.commands.command import Command


class PublishCommand(Command):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from cleo.helpers import argument

from .env_command import EnvCommand
from poetry.console.commands.env_command import EnvCommand


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/search.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from cleo.helpers import argument

from .command import Command
from poetry.console.commands.command import Command


class SearchCommand(Command):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/self/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from cleo.helpers import argument
from cleo.helpers import option

from ..command import Command
from poetry.console.commands.command import Command


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from distutils.util import strtobool
from os import environ

from .env_command import EnvCommand
from poetry.console.commands.env_command import EnvCommand


class ShellCommand(EnvCommand):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from cleo.helpers import argument
from cleo.helpers import option

from .env_command import EnvCommand
from poetry.console.commands.env_command import EnvCommand


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/update.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from cleo.helpers import argument
from cleo.helpers import option

from .installer_command import InstallerCommand
from poetry.console.commands.installer_command import InstallerCommand


class UpdateCommand(InstallerCommand):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/commands/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from cleo.helpers import argument
from cleo.helpers import option

from .command import Command
from poetry.console.commands.command import Command


if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/logging/formatters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .builder_formatter import BuilderLogFormatter
from poetry.console.logging.formatters.builder_formatter import BuilderLogFormatter


FORMATTERS = {
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/logging/formatters/builder_formatter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re

from .formatter import Formatter
from poetry.console.logging.formatters.formatter import Formatter


class BuilderLogFormatter(Formatter):
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/console/logging/io_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import TYPE_CHECKING

from .formatters import FORMATTERS
from poetry.console.logging.formatters import FORMATTERS


if TYPE_CHECKING:
Expand Down
Loading

0 comments on commit 7c53db9

Please sign in to comment.