Update pyright version

This commit is contained in:
Josh
2023-07-02 08:26:27 +10:00
committed by GitHub
parent 0871b34fc8
commit 630b2a1e55
17 changed files with 45 additions and 27 deletions

View File

@ -377,7 +377,7 @@ class Cog(metaclass=CogMeta):
if len(mapping) > 25:
raise TypeError('maximum number of application command children exceeded')
self.__cog_app_commands_group__._children = mapping # type: ignore # Variance issue
self.__cog_app_commands_group__._children = mapping
return self

View File

@ -251,7 +251,7 @@ class Context(discord.abc.Messageable, Generic[BotT]):
if command is None:
raise ValueError('interaction does not have command data')
bot: BotT = interaction.client # type: ignore
bot: BotT = interaction.client
data: ApplicationCommandInteractionData = interaction.data # type: ignore
if interaction.message is None:
synthetic_payload = {

View File

@ -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 # type: ignore
command = command.parent
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 # type: ignore
command = command.parent
entries.append(command)
return entries
@ -2004,7 +2004,7 @@ def check_any(*checks: Check[ContextT]) -> Check[ContextT]:
# if we're here, all checks failed
raise CheckAnyFailure(unwrapped, errors)
return check(predicate) # type: ignore
return check(predicate)
def has_role(item: Union[int, str], /) -> Check[Any]:

View File

@ -485,7 +485,7 @@ class FlagConverter(metaclass=FlagsMeta):
for flag in flags.values():
if callable(flag.default):
# Type checker does not understand that flag.default is a Callable
default = await maybe_coroutine(flag.default, ctx) # type: ignore
default = await maybe_coroutine(flag.default, ctx)
setattr(self, flag.attribute, default)
else:
setattr(self, flag.attribute, flag.default)
@ -600,7 +600,7 @@ class FlagConverter(metaclass=FlagsMeta):
else:
if callable(flag.default):
# Type checker does not understand flag.default is a Callable
default = await maybe_coroutine(flag.default, ctx) # type: ignore
default = await maybe_coroutine(flag.default, ctx)
setattr(self, flag.attribute, default)
else:
setattr(self, flag.attribute, flag.default)

View File

@ -398,7 +398,7 @@ class HybridAppCommand(discord.app_commands.Command[CogT, P, T]):
if self.binding is not None:
try:
# Type checker does not like runtime attribute retrieval
check: AppCommandCheck = self.binding.interaction_check # type: ignore
check: AppCommandCheck = self.binding.interaction_check
except AttributeError:
pass
else:
@ -920,9 +920,9 @@ def hybrid_group(
If the function is not a coroutine or is already a command.
"""
def decorator(func: CommandCallback[CogT, ContextT, P, T]):
def decorator(func: CommandCallback[CogT, ContextT, P, T]) -> HybridGroup[CogT, P, T]:
if isinstance(func, Command):
raise TypeError('Callback is already a command.')
return HybridGroup(func, name=name, with_app_command=with_app_command, **attrs)
return decorator # type: ignore
return decorator

View File

@ -197,7 +197,7 @@ class Parameter(inspect.Parameter):
"""
# pre-condition: required is False
if callable(self.default):
return await maybe_coroutine(self.default, ctx) # type: ignore
return await maybe_coroutine(self.default, ctx)
return self.default