diff --git a/dev-requirements.txt b/dev-requirements.txt index 3c35c69ae2..f2ccc21db6 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -28,7 +28,7 @@ sphobjinv==2.2.2 # TYPE CHECKING # ################# -mypy==0.961 +mypy==0.971 pyright==1.1.264 ####################### diff --git a/hikari/api/cache.py b/hikari/api/cache.py index b544d3ed92..2ba83f8999 100644 --- a/hikari/api/cache.py +++ b/hikari/api/cache.py @@ -209,7 +209,7 @@ def get_stickers_view_for_guild( Returns ------- - CacheView[hikari.snowflakes.Snowflake, hikari.guilds.stickers.GuildSticker] + CacheView[hikari.snowflakes.Snowflake, hikari.stickers.GuildSticker] A view of sticker IDs to objects of stickers found in the cache for the specified guild. """ diff --git a/hikari/api/event_factory.py b/hikari/api/event_factory.py index 36fb5f7b37..ba2ebe144e 100644 --- a/hikari/api/event_factory.py +++ b/hikari/api/event_factory.py @@ -37,6 +37,7 @@ from hikari import messages as messages_models from hikari import presences as presences_models from hikari import snowflakes + from hikari import stickers as sticker_models from hikari import users as user_models from hikari import voices as voices_models from hikari.api import shard as gateway_shard @@ -452,7 +453,7 @@ def deserialize_guild_stickers_update_event( shard: gateway_shard.GatewayShard, payload: data_binding.JSONObject, *, - old_stickers: typing.Optional[typing.Sequence[guild_models.stickers.GuildSticker]] = None, + old_stickers: typing.Optional[typing.Sequence[sticker_models.GuildSticker]] = None, ) -> guild_events.StickersUpdateEvent: """Parse a raw payload from Discord into a guild stickers update event object. @@ -465,7 +466,7 @@ def deserialize_guild_stickers_update_event( Other Parameters ---------------- - typing.Optional[typing.Sequence[hikari.guilds.stickers.GuildSticker]] + old_stickers : typing.Optional[typing.Sequence[hikari.stickers.GuildSticker]] The sequence of stickers or `builtins.None`. Returns diff --git a/hikari/events/guild_events.py b/hikari/events/guild_events.py index 2a3285910e..5c71f4fbc8 100644 --- a/hikari/events/guild_events.py +++ b/hikari/events/guild_events.py @@ -549,21 +549,21 @@ class StickersUpdateEvent(GuildEvent): guild_id: snowflakes.Snowflake = attr.field() # <>. - old_stickers: typing.Optional[typing.Sequence[guilds.stickers.GuildSticker]] = attr.field() + old_stickers: typing.Optional[typing.Sequence[stickers_.GuildSticker]] = attr.field() """Sequence of all old stickers in this guild. This will be `builtins.None` if it's missing from the cache. """ - stickers: typing.Sequence[guilds.stickers.GuildSticker] = attr.field() + stickers: typing.Sequence[stickers_.GuildSticker] = attr.field() """Sequence of all stickers in this guild.""" - async def fetch_stickers(self) -> typing.Sequence[guilds.stickers.GuildSticker]: + async def fetch_stickers(self) -> typing.Sequence[stickers_.GuildSticker]: """Perform an API call to retrieve an up-to-date view of the emojis. Returns ------- - typing.Sequence[guilds.stickers.GuildSticker] + typing.Sequence[hikari.stickers.GuildSticker] All emojis in the guild. """ return await self.app.rest.fetch_guild_stickers(self.guild_id) diff --git a/hikari/impl/event_factory.py b/hikari/impl/event_factory.py index edfd93cace..d6583d1519 100644 --- a/hikari/impl/event_factory.py +++ b/hikari/impl/event_factory.py @@ -61,6 +61,7 @@ from hikari import invites as invite_models from hikari import messages as messages_models from hikari import presences as presences_models + from hikari import stickers as sticker_models from hikari import traits from hikari import voices as voices_models from hikari.api import shard as gateway_shard @@ -310,7 +311,7 @@ def deserialize_guild_stickers_update_event( shard: gateway_shard.GatewayShard, payload: data_binding.JSONObject, *, - old_stickers: typing.Optional[typing.Sequence[guild_models.stickers.GuildSticker]] = None, + old_stickers: typing.Optional[typing.Sequence[sticker_models.GuildSticker]] = None, ) -> guild_events.StickersUpdateEvent: guild_id = snowflakes.Snowflake(payload["guild_id"]) stickers = [self._app.entity_factory.deserialize_guild_sticker(sticker) for sticker in payload["stickers"]] diff --git a/hikari/internal/aio.py b/hikari/internal/aio.py index bcd0618c5a..c704260972 100644 --- a/hikari/internal/aio.py +++ b/hikari/internal/aio.py @@ -39,7 +39,7 @@ if typing.TYPE_CHECKING: # typing_extensions is a dependency of mypy, and pyright vendors it. - from typing_extensions import TypeGuard + import typing_extensions T_co = typing.TypeVar("T_co", covariant=True) T_inv = typing.TypeVar("T_inv") @@ -88,12 +88,12 @@ def completed_future(result: typing.Optional[T_inv] = None, /) -> asyncio.Future # ... so I guess I will have to determine this some other way. -def is_async_iterator(obj: typing.Any) -> TypeGuard[typing.AsyncIterator[object]]: +def is_async_iterator(obj: typing.Any) -> typing_extensions.TypeGuard[typing.AsyncIterator[object]]: """Determine if the object is an async iterator or not.""" return asyncio.iscoroutinefunction(getattr(obj, "__anext__", None)) -def is_async_iterable(obj: typing.Any) -> TypeGuard[typing.AsyncIterable[object]]: +def is_async_iterable(obj: typing.Any) -> typing_extensions.TypeGuard[typing.AsyncIterable[object]]: """Determine if the object is an async iterable or not.""" attr = getattr(obj, "__aiter__", None) return inspect.isfunction(attr) or inspect.ismethod(attr) diff --git a/hikari/internal/enums.pyi b/hikari/internal/enums.pyi index 010296cae9..0fddb542cf 100644 --- a/hikari/internal/enums.pyi +++ b/hikari/internal/enums.pyi @@ -56,25 +56,12 @@ class Flag(__enum.IntFlag): def split(self: __FlagT) -> __Sequence[__FlagT]: ... def symmetric_difference(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... def union(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... - def __bool__(self) -> bool: ... - def __index__(self) -> int: ... - def __int__(self) -> int: ... def __iter__(self: __FlagT) -> __Iterator[__FlagT]: ... def __len__(self) -> int: ... - @staticmethod - def __new__(cls: __Type[__FlagT], value: int = 0) -> __FlagT: ... # Aliases def isdisjoint(self: __FlagT, other: __Union[int, __FlagT]) -> bool: ... # is_disjoint def issuperset(self: __FlagT, other: __Union[int, __FlagT]) -> bool: ... # is_superset def symmetricdifference(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # symmetric_difference def issubset(self: __FlagT, other: __Union[int, __FlagT]) -> bool: ... # is_subset - def __contains__(self: __FlagT, other: __Union[int, __FlagT]) -> bool: ... # is_subset - def __rand__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # intersection - def __and__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # intersection - def __ror__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # union - def __or__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # union - def __rsub__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # difference - def __sub__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # difference - def __rxor__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # symmetric_difference - def __xor__(self: __FlagT, other: __Union[int, __FlagT]) -> __FlagT: ... # symmetric_difference + # '__invert__' is explicitly defined as a special case because it is typed as returning 'int' in typeshed def __invert__(self: __FlagT) -> __FlagT: ... # invert