Skip to content

Commit

Permalink
Fix typing issues and usage of typing.EXCLUDED_ATTRIBUTES
Browse files Browse the repository at this point in the history
  • Loading branch information
davfsa committed Oct 29, 2023
1 parent b5fb662 commit 5da7555
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion hikari/impl/shard.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ def _handle_other_message(self, message: aiohttp.WSMessage, /) -> typing.NoRetur
close_code = int(message.data)

can_reconnect = close_code < 4000 or close_code in _RECONNECTABLE_CLOSE_CODES
raise errors.GatewayServerClosedConnectionError(message.extra, close_code, can_reconnect)
# str(message.extra) is used to cast the possible None to a string
raise errors.GatewayServerClosedConnectionError(str(message.extra), close_code, can_reconnect)

if message.type == aiohttp.WSMsgType.CLOSING or message.type == aiohttp.WSMsgType.CLOSED:
# May be caused by the server shutting us down.
Expand Down
2 changes: 1 addition & 1 deletion hikari/internal/fast_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from typing_extensions import Self

_Protocol: FastProtocolChecking = NotImplemented
_IGNORED_ATTRS = typing.EXCLUDED_ATTRIBUTES + ["__qualname__", "__slots__"]
_IGNORED_ATTRS = frozenset(tuple(typing.EXCLUDED_ATTRIBUTES) + ("__qualname__", "__slots__"))


def _check_if_ignored(name: str) -> bool:
Expand Down

0 comments on commit 5da7555

Please sign in to comment.