From 3ff88db768c5e4272350484ba1398ca77f04ab68 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Mon, 16 Jan 2023 21:54:57 -0500 Subject: [PATCH] Update pyright to 1.1.289 --- .github/workflows/lint.yml | 2 +- discord/app_commands/commands.py | 2 +- discord/app_commands/models.py | 2 +- discord/ext/commands/cog.py | 4 ++-- discord/ext/commands/core.py | 4 ++-- discord/ext/tasks/__init__.py | 2 +- discord/file.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a0fa17b93..c77d8315f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -38,7 +38,7 @@ jobs: - name: Run Pyright uses: jakebailey/pyright-action@v1 with: - version: '1.1.265' + version: '1.1.289' warnings: false no-comments: ${{ matrix.python-version != '3.x' }} diff --git a/discord/app_commands/commands.py b/discord/app_commands/commands.py index b49b66354..04a7ea942 100644 --- a/discord/app_commands/commands.py +++ b/discord/app_commands/commands.py @@ -1010,7 +1010,7 @@ class Command(Generic[GroupT, P, T]): if self.binding is not None: check: Optional[Check] = getattr(self.binding, 'interaction_check', None) if check: - ret = await maybe_coroutine(check, interaction) + ret = await maybe_coroutine(check, interaction) # type: ignore # Probable pyright bug if not ret: return False diff --git a/discord/app_commands/models.py b/discord/app_commands/models.py index 6ac56c81b..ef2e1849d 100644 --- a/discord/app_commands/models.py +++ b/discord/app_commands/models.py @@ -445,7 +445,7 @@ class Choice(Generic[ChoiceT]): def from_dict(cls, data: ApplicationCommandOptionChoice) -> Choice[ChoiceT]: self = cls.__new__(cls) self.name = data['name'] - self.value = data['value'] + self.value = data['value'] # type: ignore # This seems to break every other pyright release self.name_localizations = _to_locale_dict(data.get('name_localizations') or {}) return self diff --git a/discord/ext/commands/cog.py b/discord/ext/commands/cog.py index 6b2b4bc5f..ef527811b 100644 --- a/discord/ext/commands/cog.py +++ b/discord/ext/commands/cog.py @@ -338,14 +338,14 @@ class Cog(metaclass=CogMeta): app_command: Optional[Union[app_commands.Group, app_commands.Command[Self, ..., Any]]] = getattr( command, 'app_command', None ) - if app_command: + if app_command is not None: group_parent = self.__cog_app_commands_group__ app_command = app_command._copy_with(parent=group_parent, binding=self) # The type checker does not see the app_command attribute even though it exists command.app_command = app_command # type: ignore if self.__cog_app_commands_group__: - children.append(app_command) + children.append(app_command) # type: ignore # Somehow it thinks it can be None here if Cog._get_overridden_method(self.cog_app_command_error) is not None: error_handler = self.cog_app_command_error diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 0fbd5ed15..f3850a224 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -451,11 +451,11 @@ class Command(_BaseCommand, Generic[CogT, P, T]): self.require_var_positional: bool = kwargs.get('require_var_positional', False) self.ignore_extra: bool = kwargs.get('ignore_extra', True) self.cooldown_after_parsing: bool = kwargs.get('cooldown_after_parsing', False) - self._cog: CogT = None + self._cog: CogT = None # type: ignore # This breaks every other pyright release # 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 + self.parent: Optional[GroupMixin[Any]] = parent if isinstance(parent, _BaseCommand) else None # type: ignore # Does not recognise mixin usage self._before_invoke: Optional[Hook] = None try: diff --git a/discord/ext/tasks/__init__.py b/discord/ext/tasks/__init__.py index c6c5c7060..cf175b7a8 100644 --- a/discord/ext/tasks/__init__.py +++ b/discord/ext/tasks/__init__.py @@ -619,7 +619,7 @@ class Loop(Generic[LF]): if not inspect.iscoroutinefunction(coro): raise TypeError(f'Expected coroutine function, received {coro.__class__.__name__}.') - self._error = coro + self._error = coro # type: ignore return coro def _get_next_sleep_time(self, now: datetime.datetime = MISSING) -> datetime.datetime: diff --git a/discord/file.py b/discord/file.py index d1182417f..504d86b73 100644 --- a/discord/file.py +++ b/discord/file.py @@ -111,7 +111,7 @@ class File: else: filename = getattr(fp, 'name', 'untitled') - self._filename, filename_spoiler = _strip_spoiler(filename) # type: ignore # the above getattr doesn't narrow the type + self._filename, filename_spoiler = _strip_spoiler(filename) if spoiler is MISSING: spoiler = filename_spoiler