From 0ea098567c760e47623ec82622fda8acab429fc5 Mon Sep 17 00:00:00 2001 From: Bryan Forbes Date: Wed, 1 Mar 2023 21:47:17 -0600 Subject: [PATCH] [commands] Use `...` for `Command` and `Group` typing --- discord/client.py | 4 ++-- discord/ext/commands/hybrid.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/discord/client.py b/discord/client.py index 9da588f33d8f..a3b76b32a3e7 100644 --- a/discord/client.py +++ b/discord/client.py @@ -1161,9 +1161,9 @@ async def wait_for( event: Literal['app_command_completion'], /, *, - check: Optional[Callable[[Interaction[Self], Union[Command[Any, Any, Any], ContextMenu]], bool]], + check: Optional[Callable[[Interaction[Self], Union[Command[Any, ..., Any], ContextMenu]], bool]], timeout: Optional[float] = None, - ) -> Tuple[Interaction[Self], Union[Command[Any, Any, Any], ContextMenu]]: + ) -> Tuple[Interaction[Self], Union[Command[Any, ..., Any], ContextMenu]]: ... # AutoMod diff --git a/discord/ext/commands/hybrid.py b/discord/ext/commands/hybrid.py index 1e26f7830ddf..41d9ffd259d0 100644 --- a/discord/ext/commands/hybrid.py +++ b/discord/ext/commands/hybrid.py @@ -72,9 +72,9 @@ T = TypeVar('T') U = TypeVar('U') CogT = TypeVar('CogT', bound='Cog') -CommandT = TypeVar('CommandT', bound='Command[Any, Any, Any]') +CommandT = TypeVar('CommandT', bound='Command[Any, ..., Any]') # CHT = TypeVar('CHT', bound='Check') -GroupT = TypeVar('GroupT', bound='Group[Any, Any, Any]') +GroupT = TypeVar('GroupT', bound='Group[Any, ..., Any]') _NoneType = type(None) if TYPE_CHECKING: @@ -297,7 +297,7 @@ def replace_parameters( class HybridAppCommand(discord.app_commands.Command[CogT, P, T]): - def __init__(self, wrapped: Union[HybridCommand[CogT, Any, T], HybridGroup[CogT, Any, T]]) -> None: + def __init__(self, wrapped: Union[HybridCommand[CogT, ..., T], HybridGroup[CogT, ..., T]]) -> None: signature = inspect.signature(wrapped.callback) params = replace_parameters(wrapped.params, wrapped.callback, signature) wrapped.callback.__signature__ = signature.replace(parameters=params) @@ -312,7 +312,7 @@ def __init__(self, wrapped: Union[HybridCommand[CogT, Any, T], HybridGroup[CogT, finally: del wrapped.callback.__signature__ - self.wrapped: Union[HybridCommand[CogT, Any, T], HybridGroup[CogT, Any, T]] = wrapped + self.wrapped: Union[HybridCommand[CogT, ..., T], HybridGroup[CogT, ..., T]] = wrapped self.binding: Optional[CogT] = wrapped.cog # This technically means only one flag converter is supported self.flag_converter: Optional[Tuple[str, Type[FlagConverter]]] = getattr(