From bf7d311a6051cb94e6d21dce305d8eb87a542ffb Mon Sep 17 00:00:00 2001 From: shiftinv Date: Wed, 15 Nov 2023 14:58:48 +0100 Subject: [PATCH] style: revert `Client.connect` typeddict changes now that pyright infers `TypedDict.update` properly --- disnake/client.py | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/disnake/client.py b/disnake/client.py index 33344a3990..b25b44cbd9 100644 --- a/disnake/client.py +++ b/disnake/client.py @@ -1123,14 +1123,12 @@ async def connect( _log.info("Got a request to %s the websocket.", e.op) self.dispatch("disconnect") ws_params.update( - { - "sequence": self.ws.sequence, - "resume": e.resume, - "session": self.ws.session_id, - # use current (possibly new) gateway if resuming, - # reset to default if not - "gateway": self.ws.resume_gateway if e.resume else initial_gateway, - } + sequence=self.ws.sequence, + resume=e.resume, + session=self.ws.session_id, + # use current (possibly new) gateway if resuming, + # reset to default if not + gateway=self.ws.resume_gateway if e.resume else initial_gateway, ) continue @@ -1156,13 +1154,11 @@ async def connect( # If we get connection reset by peer then try to RESUME if isinstance(exc, OSError) and exc.errno == ECONNRESET: ws_params.update( - { - "sequence": self.ws.sequence, - "initial": False, - "resume": True, - "session": self.ws.session_id, - "gateway": self.ws.resume_gateway, - } + sequence=self.ws.sequence, + initial=False, + resume=True, + session=self.ws.session_id, + gateway=self.ws.resume_gateway, ) continue @@ -1185,22 +1181,18 @@ async def connect( # Always identify back to the initial gateway if we failed while connecting. # This is in case we fail to connect to the resume_gateway instance. ws_params.update( - { - "resume": False, - "gateway": initial_gateway, - } + resume=False, + gateway=initial_gateway, ) else: # Just try to resume the session. # If it's not RESUME-able then the gateway will invalidate the session. # This is apparently what the official Discord client does. ws_params.update( - { - "sequence": self.ws.sequence, - "resume": True, - "session": self.ws.session_id, - "gateway": self.ws.resume_gateway, - } + sequence=self.ws.sequence, + resume=True, + session=self.ws.session_id, + gateway=self.ws.resume_gateway, ) async def close(self) -> None: