Update pyright version

This commit is contained in:
Josh
2024-02-21 05:36:02 +11:00
committed by GitHub
parent 76666fbcf4
commit 4e03b170ef
17 changed files with 39 additions and 35 deletions

View File

@ -169,7 +169,7 @@ class CogMeta(type):
__cog_app_commands__: List[Union[app_commands.Group, app_commands.Command[Any, ..., Any]]]
__cog_listeners__: List[Tuple[str, str]]
def __new__(cls, *args: Any, **kwargs: Any) -> Self:
def __new__(cls, *args: Any, **kwargs: Any) -> CogMeta:
name, bases, attrs = args
if any(issubclass(base, app_commands.Group) for base in bases):
raise TypeError(
@ -366,7 +366,7 @@ class Cog(metaclass=CogMeta):
child.wrapped = lookup[child.qualified_name] # type: ignore
if self.__cog_app_commands_group__:
children.append(app_command) # type: ignore # Somehow it thinks it can be None here
children.append(app_command)
if Cog._get_overridden_method(self.cog_app_command_error) is not None:
error_handler = self.cog_app_command_error

View File

@ -1185,7 +1185,7 @@ def _convert_to_bool(argument: str) -> bool:
raise BadBoolArgument(lowered)
_GenericAlias = type(List[T])
_GenericAlias = type(List[T]) # type: ignore
def is_generic_type(tp: Any, *, _GenericAlias: type = _GenericAlias) -> bool:

View File

@ -461,7 +461,7 @@ class Command(_BaseCommand, Generic[CogT, P, T]):
# bandaid for the fact that sometimes parent can be the bot instance
parent: Optional[GroupMixin[Any]] = kwargs.get('parent')
self.parent: Optional[GroupMixin[Any]] = parent if isinstance(parent, _BaseCommand) else None # type: ignore # Does not recognise mixin usage
self.parent: Optional[GroupMixin[Any]] = parent if isinstance(parent, _BaseCommand) else None
self._before_invoke: Optional[Hook] = None
try:
@ -776,7 +776,7 @@ class Command(_BaseCommand, Generic[CogT, P, T]):
command = self
# command.parent is type-hinted as GroupMixin some attributes are resolved via MRO
while command.parent is not None: # type: ignore
command = command.parent
command = command.parent # type: ignore
entries.append(command.name) # type: ignore
return ' '.join(reversed(entries))
@ -794,7 +794,7 @@ class Command(_BaseCommand, Generic[CogT, P, T]):
entries = []
command = self
while command.parent is not None: # type: ignore
command = command.parent
command = command.parent # type: ignore
entries.append(command)
return entries

View File

@ -280,7 +280,7 @@ class FlagsMeta(type):
case_insensitive: bool = MISSING,
delimiter: str = MISSING,
prefix: str = MISSING,
) -> Self:
) -> FlagsMeta:
attrs['__commands_is_flag__'] = True
try:

View File

@ -902,7 +902,7 @@ def hybrid_command(
def decorator(func: CommandCallback[CogT, ContextT, P, T]) -> HybridCommand[CogT, P, T]:
if isinstance(func, Command):
raise TypeError('Callback is already a command.')
return HybridCommand(func, name=name, with_app_command=with_app_command, **attrs) # type: ignore # ???
return HybridCommand(func, name=name, with_app_command=with_app_command, **attrs)
return decorator