Skip to content

Commit

Permalink
🐛 fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
RF-Tar-Railt committed Nov 6, 2023
1 parent 3e9ff92 commit acd30eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/arclet/alconna/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from .config import config as config
from .config import namespace as namespace
from .core import Alconna as Alconna
from .duplication import Duplication as Duplication
from .exceptions import InvalidArgs as InvalidArgs
from .exceptions import InvalidParam as InvalidParam
from .exceptions import NullMessage as NullMessage
Expand Down
7 changes: 2 additions & 5 deletions src/arclet/alconna/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import re
import sys
from enum import Enum
from functools import partial
from typing import Any, Callable, Generic, Iterable, List, Sequence, Type, TypeVar, Union
from typing_extensions import Self, TypeAlias

Expand Down Expand Up @@ -152,7 +151,7 @@ def __add__(self, other) -> "Args":
class ArgsMeta(type):
"""`Args` 类的元类"""

def __getitem__(self, item: Union[Arg, tuple[Arg, ...], str, tuple[Any, ...]]):
def __getitem__(self, item: Union[Arg, tuple[Arg, ...], str, tuple[str, Any], tuple[str, Any, ...]]):
"""构造参数集合
Args:
Expand All @@ -162,9 +161,7 @@ def __getitem__(self, item: Union[Arg, tuple[Arg, ...], str, tuple[Any, ...]]):
Args: 参数集合
"""
data: tuple[Arg, ...] | tuple[Any, ...] = item if isinstance(item, tuple) else (item,)
if isinstance(data[0], Arg):
return self(*data)
return self(Arg(*data))
return self(*data) if isinstance(data[0], Arg) else self(Arg(*data))


class _argument(List[Arg[Any]]):
Expand Down

0 comments on commit acd30eb

Please sign in to comment.