Skip to content

Commit

Permalink
🎨 format by isort
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed May 10, 2023
1 parent 92d741b commit d10d7d1
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 45 deletions.
29 changes: 16 additions & 13 deletions src/arclet/alconna/_internal/_analyser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,37 @@

import re
import traceback
from re import Match
from typing import TYPE_CHECKING, Any, Generic, Callable, Set
from dataclasses import dataclass, field
from typing_extensions import Self, TypeAlias
from re import Match
from typing import TYPE_CHECKING, Any, Callable, Generic, Set

from tarina import lang
from typing_extensions import Self, TypeAlias

from ..manager import command_manager, ShortcutArgs
from ..exceptions import ParamsUnmatched, ArgumentMissing, FuzzyMatchSuccess, PauseTriggered, SpecialOptionTriggered
from ..action import Action
from ..args import Args
from ..arparma import Arparma
from ..base import Option, Subcommand
from ..completion import comp_ctx
from ..model import Sentence, HeadResult, OptionResult, SubcommandResult
from ..arparma import Arparma
from ..typing import TDC
from ..config import Namespace, config
from ..exceptions import (
ArgumentMissing, FuzzyMatchSuccess, ParamsUnmatched, PauseTriggered, SpecialOptionTriggered
)
from ..manager import ShortcutArgs, command_manager
from ..model import HeadResult, OptionResult, Sentence, SubcommandResult
from ..output import output_manager
from ._util import levenshtein
from ..typing import TDC
from ._handlers import (
analyse_args, analyse_param, analyse_header, handle_opt_default,
handle_help, handle_shortcut, handle_completion, prompt
analyse_args, analyse_header, analyse_param,
handle_completion, handle_help, handle_opt_default,
handle_shortcut, prompt
)
from ._header import Header

from ._util import levenshtein

if TYPE_CHECKING:
from ._argv import Argv
from ..core import Alconna
from ._argv import Argv

_SPECIAL = {
"help": handle_help,
Expand Down
9 changes: 5 additions & 4 deletions src/arclet/alconna/_internal/_argv.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from __future__ import annotations

from dataclasses import dataclass, field, InitVar
from typing import Any, Callable, Generic, ClassVar, Iterable
from dataclasses import InitVar, dataclass, field
from typing import Any, Callable, ClassVar, Generic, Iterable

from tarina import lang, split, split_once
from typing_extensions import Self
from tarina import split, split_once, lang

from ..args import Arg
from ..config import Namespace, config
from ..base import Option, Subcommand
from ..config import Namespace, config
from ..exceptions import NullMessage
from ..typing import TDC

Expand Down
17 changes: 9 additions & 8 deletions src/arclet/alconna/_internal/_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@

import re
from typing import TYPE_CHECKING, Any, Iterable
from tarina import Empty, lang
from nepattern import AllParam, BasePattern, AnyOne, AnyString

from nepattern import AllParam, AnyOne, AnyString, BasePattern
from nepattern.util import TPattern
from tarina import Empty, lang

from ._header import Double, Header
from ..action import Action
from ..args import Arg, Args, STRING
from ..args import STRING, Arg, Args
from ..base import Option, Subcommand
from ..config import config
from ..completion import Prompt, comp_ctx
from ..config import config
from ..exceptions import (
ArgumentMissing, FuzzyMatchSuccess, ParamsUnmatched, SpecialOptionTriggered, PauseTriggered
ArgumentMissing, FuzzyMatchSuccess, ParamsUnmatched, PauseTriggered, SpecialOptionTriggered
)
from ..model import OptionResult, Sentence, HeadResult
from ..model import HeadResult, OptionResult, Sentence
from ..output import output_manager
from ..typing import KeyWordVar, MultiVar
from ._header import Double, Header
from ._util import levenshtein

if TYPE_CHECKING:
from ._analyser import Analyser, SubAnalyser
from ._argv import Argv
from ._analyser import SubAnalyser, Analyser


def _handle_keyword(
Expand Down
2 changes: 1 addition & 1 deletion src/arclet/alconna/action.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import IntEnum
from dataclasses import dataclass
from enum import IntEnum
from typing import Any


Expand Down
2 changes: 1 addition & 1 deletion src/arclet/alconna/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from functools import partial
from typing import Any, Callable, Generic, Iterable, Sequence, TypeVar, Union

from nepattern import AllParam, AnyOne, BasePattern, UnionPattern, all_patterns, type_parser, RawStr
from nepattern import AllParam, AnyOne, BasePattern, RawStr, UnionPattern, all_patterns, type_parser
from tarina import Empty, get_signature, lang
from typing_extensions import Self

Expand Down
2 changes: 1 addition & 1 deletion src/arclet/alconna/argv.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from contextvars import ContextVar
from typing import Any, Callable

from .typing import TDC
from ._internal._argv import Argv
from .typing import TDC

__argv_type__: ContextVar[type[Argv]] = ContextVar("argv_type", default=Argv)

Expand Down
3 changes: 2 additions & 1 deletion src/arclet/alconna/arparma.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from functools import lru_cache
from types import MappingProxyType
from typing import Any, Callable, Generic, Mapping, TypeVar, overload
from tarina import get_signature, generic_isinstance, Empty, lang

from tarina import Empty, generic_isinstance, get_signature, lang
from typing_extensions import Self

from .exceptions import BehaveCancelled, OutBoundsBehave
Expand Down
5 changes: 3 additions & 2 deletions src/arclet/alconna/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from __future__ import annotations

from functools import reduce
from typing import Iterable, Sequence, overload, Any
from typing_extensions import Self
from typing import Any, Iterable, Sequence, overload

from tarina import lang
from typing_extensions import Self

from .action import Action, store
from .args import Arg, Args
Expand Down
4 changes: 2 additions & 2 deletions src/arclet/alconna/completion.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from __future__ import annotations

from dataclasses import dataclass, field
from typing import Any, TYPE_CHECKING
from typing import TYPE_CHECKING

from tarina import ContextModel, lang

from .exceptions import PauseTriggered
from .manager import command_manager
from .output import output_manager


if TYPE_CHECKING:
from .core import Alconna

Expand Down
7 changes: 4 additions & 3 deletions src/arclet/alconna/config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from __future__ import annotations

from dataclasses import dataclass, field
from typing import ContextManager, TypedDict, Callable, Any, TYPE_CHECKING
from tarina import lang
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, ContextManager, TypedDict

from tarina import lang

from .typing import TPrefixes, DataCollection
from .typing import DataCollection, TPrefixes

if TYPE_CHECKING:
from .formatter import TextFormatter
Expand Down
2 changes: 1 addition & 1 deletion src/arclet/alconna/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from .exceptions import ExecuteFailed, NullMessage
from .formatter import TextFormatter
from .manager import ShortcutArgs, command_manager
from .typing import TDC, TPrefixes, DataCollection, CommandMeta
from .typing import TDC, CommandMeta, DataCollection, TPrefixes

T_Duplication = TypeVar('T_Duplication', bound=Duplication)
T = TypeVar("T")
Expand Down
1 change: 1 addition & 0 deletions src/arclet/alconna/duplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from inspect import isclass
from typing import cast

from tarina import Empty

from .arparma import Arparma
Expand Down
3 changes: 2 additions & 1 deletion src/arclet/alconna/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
from tarina import Empty, lang

from nepattern import AllParam, AnyOne, AnyString
from tarina import Empty, lang

from .args import Arg, Args
from .base import Option, Subcommand
Expand Down
10 changes: 5 additions & 5 deletions src/arclet/alconna/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
import weakref
from copy import copy
from datetime import datetime
from typing import TYPE_CHECKING, Any, Match, TypedDict, Union, overload, Generic
from typing_extensions import NotRequired
from tarina import LRU, lang
from typing import TYPE_CHECKING, Any, Generic, Match, TypedDict, Union, overload
from weakref import WeakKeyDictionary, WeakValueDictionary

from tarina import LRU, lang
from typing_extensions import NotRequired

from .argv import Argv, __argv_type__
from .arparma import Arparma
from .config import Namespace, config
from .exceptions import ExceedMaxCount
from .typing import DataCollection, TDC, CommandMeta

from .typing import TDC, CommandMeta, DataCollection

if TYPE_CHECKING:
from ._internal._analyser import Analyser
Expand Down
1 change: 1 addition & 0 deletions src/arclet/alconna/stub.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from dataclasses import dataclass, field
from inspect import isclass
from typing import Any, Generic, TypeVar

from nepattern import AllParam, AnyOne, BasePattern
from typing_extensions import Self

Expand Down
5 changes: 3 additions & 2 deletions src/arclet/alconna/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
from __future__ import annotations

from dataclasses import dataclass, field
from typing import TypeVar, Iterator, runtime_checkable, Protocol, Union, Any, Literal, Tuple, Dict, List
from nepattern import BasePattern, type_parser, MatchMode
from typing import Any, Dict, Iterator, List, Literal, Protocol, Tuple, TypeVar, Union, runtime_checkable

from nepattern import BasePattern, MatchMode, type_parser

TPrefixes = Union[List[Union[str, object]], List[Tuple[object, str]]]
DataUnit = TypeVar("DataUnit", covariant=True)
Expand Down

0 comments on commit d10d7d1

Please sign in to comment.