Skip to content

Commit

Permalink
Bump mypy from 0.961 to 0.971 (#1223)
Browse files Browse the repository at this point in the history
* Bump mypy from 0.961 to 0.971

Bumps [mypy](https://github.com/python/mypy) from 0.961 to 0.971.
- [Release notes](https://github.com/python/mypy/releases)
- [Commits](python/mypy@v0.961...v0.971)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Fix mypy issues

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: davfsa <[email protected]>
  • Loading branch information
dependabot[bot] and davfsa authored Aug 3, 2022
1 parent 3a24b00 commit 6ddd49d
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 26 deletions.
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sphobjinv==2.2.2
# TYPE CHECKING #
#################

mypy==0.961
mypy==0.971
pyright==1.1.264

#######################
Expand Down
2 changes: 1 addition & 1 deletion hikari/api/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
5 changes: 3 additions & 2 deletions hikari/api/event_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions hikari/events/guild_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,21 +549,21 @@ class StickersUpdateEvent(GuildEvent):
guild_id: snowflakes.Snowflake = attr.field()
# <<inherited docstring from GuildEvent>>.

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)
Expand Down
3 changes: 2 additions & 1 deletion hikari/impl/event_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]]
Expand Down
6 changes: 3 additions & 3 deletions hikari/internal/aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down
15 changes: 1 addition & 14 deletions hikari/internal/enums.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6ddd49d

Please sign in to comment.