From 1f9d1b719e2a1bdcc5818e3781433e2f8fc1fb43 Mon Sep 17 00:00:00 2001 From: Davide Casale Date: Thu, 20 Apr 2023 01:41:08 +0200 Subject: [PATCH] Fix bug in bfxapi.websocket.subscriptions. --- bfxapi/websocket/client/bfx_websocket_client.py | 3 ++- bfxapi/websocket/subscriptions.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bfxapi/websocket/client/bfx_websocket_client.py b/bfxapi/websocket/client/bfx_websocket_client.py index 8971833..e0f90e2 100644 --- a/bfxapi/websocket/client/bfx_websocket_client.py +++ b/bfxapi/websocket/client/bfx_websocket_client.py @@ -107,7 +107,7 @@ class BfxWebSocketClient: await self.__connect() - #pylint: disable-next=too-many-statements + #pylint: disable-next=too-many-statements,too-many-branches async def __connect(self): Reconnection = namedtuple("Reconnection", ["status", "attempts", "timestamp"]) reconnection = Reconnection(status=False, attempts=0, timestamp=None) @@ -118,6 +118,7 @@ class BfxWebSocketClient: def _on_wss_timeout(): on_timeout_event.set() + #pylint: disable-next=too-many-branches async def _connection(): nonlocal reconnection, timer, tasks diff --git a/bfxapi/websocket/subscriptions.py b/bfxapi/websocket/subscriptions.py index 922a532..233becc 100644 --- a/bfxapi/websocket/subscriptions.py +++ b/bfxapi/websocket/subscriptions.py @@ -12,7 +12,7 @@ __all__ = [ _Header = TypedDict("_Header", { "event": Literal["subscribed"], "channel": str, "chanId": int }) -Subscription = Union["Ticker", "Trades", "Book", "Candles", "Status"] +Subscription = Union[_Header, "Ticker", "Trades", "Book", "Candles", "Status"] class Ticker(TypedDict): subId: str