diff --git a/src/arclet/alconna/__init__.py b/src/arclet/alconna/__init__.py index a9560ec9..cc4d3600 100644 --- a/src/arclet/alconna/__init__.py +++ b/src/arclet/alconna/__init__.py @@ -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 diff --git a/src/arclet/alconna/args.py b/src/arclet/alconna/args.py index e5ee9c8f..e03cb0d8 100644 --- a/src/arclet/alconna/args.py +++ b/src/arclet/alconna/args.py @@ -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 @@ -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: @@ -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]]):