Skip to content

Commit

Permalink
format with isort
Browse files Browse the repository at this point in the history
  • Loading branch information
KotlinIsland committed Nov 4, 2022
1 parent 56bd8a1 commit 6491ade
Show file tree
Hide file tree
Showing 35 changed files with 94 additions and 110 deletions.
1 change: 1 addition & 0 deletions poethepoet/__init__.py
Expand Up @@ -26,6 +26,7 @@ def main():
return

from pathlib import Path

from .app import PoeThePoet

app = PoeThePoet(cwd=Path(".").resolve(), output=sys.stdout)
Expand Down
1 change: 0 additions & 1 deletion poethepoet/__main__.py
@@ -1,6 +1,5 @@
import sys


if __name__ == "__main__":
from poethepoet import main

Expand Down
5 changes: 3 additions & 2 deletions poethepoet/app.py
@@ -1,7 +1,8 @@
import os
from pathlib import Path
import sys
from typing import Any, Dict, IO, Mapping, Optional, Sequence, Tuple, Union
from pathlib import Path
from typing import IO, Any, Dict, Mapping, Optional, Sequence, Tuple, Union

from .config import PoeConfig
from .context import RunContext
from .exceptions import ExecutionError, PoeException
Expand Down
1 change: 1 addition & 0 deletions poethepoet/completion/zsh.py
Expand Up @@ -7,6 +7,7 @@ def get_zsh_completion_script() -> str:
script for poe generated from the argparses config
"""
from pathlib import Path

from ..app import PoeThePoet

# build and interogate the argument parser as the normal cli would
Expand Down
6 changes: 4 additions & 2 deletions poethepoet/config.py
@@ -1,7 +1,9 @@
import json
from pathlib import Path
import tomli
from typing import Any, Dict, Mapping, Optional, Sequence, Tuple, Union

import tomli

from .exceptions import PoeException


Expand Down Expand Up @@ -113,8 +115,8 @@ def load(self, target_dir: Optional[str] = None):
self._load_includes(self._project_dir)

def validate(self):
from .task import PoeTask
from .executor import PoeExecutor
from .task import PoeTask

# Validate keys
supported_keys = {"tasks", *self.__options__}
Expand Down
14 changes: 4 additions & 10 deletions poethepoet/context.py
@@ -1,15 +1,9 @@
from pathlib import Path
import re
from typing import (
Any,
Dict,
Mapping,
Optional,
Tuple,
TYPE_CHECKING,
)
from .executor import PoeExecutor
from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Tuple

from .env.manager import EnvVarsManager
from .executor import PoeExecutor

if TYPE_CHECKING:
from .config import PoeConfig
Expand Down
7 changes: 2 additions & 5 deletions poethepoet/env/cache.py
@@ -1,9 +1,6 @@
from pathlib import Path
from typing import (
Dict,
Optional,
TYPE_CHECKING,
)
from typing import TYPE_CHECKING, Dict, Optional

from ..exceptions import ExecutionError
from .parse import parse_env_file

Expand Down
9 changes: 2 additions & 7 deletions poethepoet/env/manager.py
@@ -1,11 +1,6 @@
from pathlib import Path
from typing import (
Dict,
Mapping,
Optional,
Union,
TYPE_CHECKING,
)
from typing import TYPE_CHECKING, Dict, Mapping, Optional, Union

from .cache import EnvFileCache
from .template import apply_envvars_to_template

Expand Down
2 changes: 1 addition & 1 deletion poethepoet/env/parse.py
@@ -1,5 +1,5 @@
from enum import Enum
import re
from enum import Enum
from typing import Iterable, Optional, Sequence


Expand Down
6 changes: 4 additions & 2 deletions poethepoet/executor/base.py
@@ -1,8 +1,9 @@
import os
import signal
from subprocess import Popen, PIPE
import sys
from subprocess import PIPE, Popen
from typing import (
TYPE_CHECKING,
Any,
Dict,
Mapping,
Expand All @@ -11,15 +12,16 @@
Sequence,
Tuple,
Type,
TYPE_CHECKING,
Union,
)

from ..env.manager import EnvVarsManager
from ..exceptions import ExecutionError, PoeException
from ..virtualenv import Virtualenv

if TYPE_CHECKING:
from pathlib import Path

from ..context import RunContext

# TODO: maybe invert the control so the executor is given a task to run?
Expand Down
5 changes: 3 additions & 2 deletions poethepoet/executor/poetry.py
@@ -1,9 +1,10 @@
from subprocess import Popen, PIPE
import os
from pathlib import Path
import shutil
import sys
from pathlib import Path
from subprocess import PIPE, Popen
from typing import Dict, Optional, Sequence, Type

from ..virtualenv import Virtualenv
from .base import PoeExecutor

Expand Down
1 change: 1 addition & 0 deletions poethepoet/executor/simple.py
@@ -1,4 +1,5 @@
from typing import Dict, Type

from .base import PoeExecutor


Expand Down
3 changes: 2 additions & 1 deletion poethepoet/executor/virtualenv.py
@@ -1,7 +1,8 @@
from typing import Any, Dict, Optional, Sequence, Type
from .base import PoeExecutor

from ..exceptions import PoeException
from ..virtualenv import Virtualenv
from .base import PoeExecutor


class VirtualenvExecutor(PoeExecutor):
Expand Down
4 changes: 2 additions & 2 deletions poethepoet/helpers/python.py
Expand Up @@ -3,12 +3,12 @@
"""

import ast
from itertools import chain
import re
import sys
from itertools import chain
from typing import Container, Iterator, List, Tuple
from ..exceptions import ScriptParseError

from ..exceptions import ScriptParseError

_BUILTINS_WHITELIST = {
"abs",
Expand Down
13 changes: 8 additions & 5 deletions poethepoet/plugin.py
@@ -1,14 +1,15 @@
# pylint: disable=import-error

from pathlib import Path
from typing import Any, Dict, List

from cleo.commands.command import Command
from cleo.events.console_command_event import ConsoleCommandEvent
from cleo.events.event_dispatcher import EventDispatcher
from cleo.events.console_events import COMMAND, TERMINATE
from cleo.events.event_dispatcher import EventDispatcher
from cleo.io.io import IO
from pathlib import Path
from poetry.console.application import Application, COMMANDS
from poetry.console.application import COMMANDS, Application
from poetry.plugins.application_plugin import ApplicationPlugin
from typing import Any, Dict, List

from .exceptions import PoePluginException

Expand Down Expand Up @@ -79,7 +80,8 @@ def activate(self, application: Application) -> None:

# pylint: disable=bare-except
except:
import os, sys
import os
import sys

debug = bool(int(os.environ.get("DEBUG_POE_PLUGIN", "0")))
print(
Expand Down Expand Up @@ -146,6 +148,7 @@ def _get_config(cls, application: Application) -> Dict[str, Any]:
# Fallback to loading the config again in case of future failure of the
# above undocumented API
import tomlkit

from .config import PoeConfig

pyproject = tomlkit.loads(
Expand Down
2 changes: 1 addition & 1 deletion poethepoet/task/args.py
@@ -1,5 +1,6 @@
import argparse
from typing import (
TYPE_CHECKING,
Any,
Dict,
List,
Expand All @@ -9,7 +10,6 @@
Tuple,
Type,
Union,
TYPE_CHECKING,
)

if TYPE_CHECKING:
Expand Down
10 changes: 5 additions & 5 deletions poethepoet/task/base.py
@@ -1,8 +1,9 @@
from pathlib import Path
import re
import shlex
import sys
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Dict,
Iterator,
Expand All @@ -12,18 +13,17 @@
Sequence,
Tuple,
Type,
TYPE_CHECKING,
Union,
)

from .args import PoeTaskArgs
from ..env.manager import EnvVarsManager
from ..exceptions import PoeException
from ..helpers import is_valid_env_var
from ..env.manager import EnvVarsManager
from .args import PoeTaskArgs

if TYPE_CHECKING:
from ..context import RunContext
from ..config import PoeConfig
from ..context import RunContext
from ..ui import PoeUi


Expand Down
14 changes: 4 additions & 10 deletions poethepoet/task/cmd.py
@@ -1,16 +1,10 @@
from glob import glob
import re
import shlex
from typing import (
Dict,
Sequence,
Type,
Tuple,
TYPE_CHECKING,
Union,
)
from .base import PoeTask
from glob import glob
from typing import TYPE_CHECKING, Dict, Sequence, Tuple, Type, Union

from ..env.manager import EnvVarsManager
from .base import PoeTask

if TYPE_CHECKING:
from ..config import PoeConfig
Expand Down
3 changes: 2 additions & 1 deletion poethepoet/task/graph.py
@@ -1,4 +1,5 @@
from typing import Dict, Set, List, Tuple
from typing import Dict, List, Set, Tuple

from ..context import RunContext
from ..exceptions import CyclicDependencyError
from .base import PoeTask
Expand Down
14 changes: 3 additions & 11 deletions poethepoet/task/ref.py
@@ -1,16 +1,8 @@
import shlex
from typing import (
Any,
Dict,
Optional,
Sequence,
Type,
Tuple,
TYPE_CHECKING,
Union,
)
from .base import PoeTask
from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence, Tuple, Type, Union

from ..env.manager import EnvVarsManager
from .base import PoeTask

if TYPE_CHECKING:
from ..config import PoeConfig
Expand Down
21 changes: 5 additions & 16 deletions poethepoet/task/script.py
@@ -1,22 +1,11 @@
import ast
import re
from typing import (
Any,
Dict,
Optional,
Sequence,
Tuple,
Type,
TYPE_CHECKING,
Union,
)
from .base import PoeTask
from ..exceptions import ScriptParseError
from typing import TYPE_CHECKING, Any, Dict, Optional, Sequence, Tuple, Type, Union

from ..env.manager import EnvVarsManager
from ..helpers.python import (
resolve_function_call,
parse_and_validate,
)
from ..exceptions import ScriptParseError
from ..helpers.python import parse_and_validate, resolve_function_call
from .base import PoeTask

if TYPE_CHECKING:
from ..config import PoeConfig
Expand Down
5 changes: 3 additions & 2 deletions poethepoet/task/sequence.py
@@ -1,17 +1,18 @@
from typing import (
TYPE_CHECKING,
Any,
Dict,
List,
Optional,
Sequence,
Tuple,
Type,
TYPE_CHECKING,
Union,
)
from .base import PoeTask, TaskContent

from ..env.manager import EnvVarsManager
from ..exceptions import ExecutionError, PoeException
from .base import PoeTask, TaskContent

if TYPE_CHECKING:
from ..config import PoeConfig
Expand Down
5 changes: 3 additions & 2 deletions poethepoet/task/shell.py
@@ -1,17 +1,18 @@
from os import environ
import re
from os import environ
from shutil import which
from typing import (
TYPE_CHECKING,
Any,
Dict,
List,
Optional,
Sequence,
Tuple,
Type,
TYPE_CHECKING,
Union,
)

from ..env.manager import EnvVarsManager
from ..exceptions import PoeException
from .base import PoeTask
Expand Down
6 changes: 4 additions & 2 deletions poethepoet/ui.py
@@ -1,10 +1,12 @@
import argparse
import os
from pastel import Pastel
import sys
from typing import IO, List, Mapping, Optional, Sequence, Tuple, Union
from .exceptions import PoeException

from pastel import Pastel

from .__version__ import __version__
from .exceptions import PoeException


def guess_ansi_support(file):
Expand Down

0 comments on commit 6491ade

Please sign in to comment.