From eaf94e84bc85c72eb28ed95a88e43cdd65879783 Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 6 Mar 2022 16:44:48 +1000 Subject: [PATCH] Fix unbound ParamSpec to use ... over Any --- discord/ext/commands/cog.py | 6 +++--- discord/ext/commands/core.py | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/discord/ext/commands/cog.py b/discord/ext/commands/cog.py index 5afbcf89e..fa8519d35 100644 --- a/discord/ext/commands/cog.py +++ b/discord/ext/commands/cog.py @@ -191,7 +191,7 @@ class Cog(metaclass=CogMeta): __cog_name__: ClassVar[str] __cog_settings__: ClassVar[Dict[str, Any]] - __cog_commands__: ClassVar[List[Command[Self, Any, Any]]] + __cog_commands__: ClassVar[List[Command[Self, ..., Any]]] __cog_listeners__: ClassVar[List[Tuple[str, str]]] def __new__(cls, *args: Any, **kwargs: Any) -> Self: @@ -221,7 +221,7 @@ class Cog(metaclass=CogMeta): return self - def get_commands(self) -> List[Command[Self, Any, Any]]: + def get_commands(self) -> List[Command[Self, ..., Any]]: r""" Returns -------- @@ -249,7 +249,7 @@ class Cog(metaclass=CogMeta): def description(self, description: str) -> None: self.__cog_description__ = description - def walk_commands(self) -> Generator[Command[Self, Any, Any], None, None]: + def walk_commands(self) -> Generator[Command[Self, ..., Any], None, None]: """An iterator that recursively walks through this cog's commands and subcommands. Yields diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index d098ea099..c04660016 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -1146,12 +1146,12 @@ class GroupMixin(Generic[CogT]): def __init__(self, *args: Any, **kwargs: Any) -> None: case_insensitive = kwargs.get('case_insensitive', False) - self.all_commands: Dict[str, Command[CogT, Any, Any]] = _CaseInsensitiveDict() if case_insensitive else {} + self.all_commands: Dict[str, Command[CogT, ..., Any]] = _CaseInsensitiveDict() if case_insensitive else {} self.case_insensitive: bool = case_insensitive super().__init__(*args, **kwargs) @property - def commands(self) -> Set[Command[CogT, Any, Any]]: + def commands(self) -> Set[Command[CogT, ..., Any]]: """Set[:class:`.Command`]: A unique set of commands without aliases that are registered.""" return set(self.all_commands.values()) @@ -1161,7 +1161,7 @@ class GroupMixin(Generic[CogT]): command.recursively_remove_all_commands() self.remove_command(command.name) - def add_command(self, command: Command[CogT, Any, Any], /) -> None: + def add_command(self, command: Command[CogT, ..., Any], /) -> None: """Adds a :class:`.Command` into the internal list of commands. This is usually not called, instead the :meth:`~.GroupMixin.command` or @@ -1203,7 +1203,7 @@ class GroupMixin(Generic[CogT]): raise CommandRegistrationError(alias, alias_conflict=True) self.all_commands[alias] = command - def remove_command(self, name: str, /) -> Optional[Command[CogT, Any, Any]]: + def remove_command(self, name: str, /) -> Optional[Command[CogT, ..., Any]]: """Remove a :class:`.Command` from the internal list of commands. @@ -1244,7 +1244,7 @@ class GroupMixin(Generic[CogT]): self.all_commands[alias] = cmd return command - def walk_commands(self) -> Generator[Command[CogT, Any, Any], None, None]: + def walk_commands(self) -> Generator[Command[CogT, ..., Any], None, None]: """An iterator that recursively walks through all commands and subcommands. .. versionchanged:: 1.4 @@ -1260,7 +1260,7 @@ class GroupMixin(Generic[CogT]): if isinstance(command, GroupMixin): yield from command.walk_commands() - def get_command(self, name: str, /) -> Optional[Command[CogT, Any, Any]]: + def get_command(self, name: str, /) -> Optional[Command[CogT, ..., Any]]: """Get a :class:`.Command` from the internal list of commands.