Remove type hinting for decorators _require_websocket_connection and _require_websocket_authentication.

This commit is contained in:
Davide Casale
2023-06-12 16:17:45 +02:00
parent d63c2c63c3
commit cc5f9f5b0e
2 changed files with 5 additions and 11 deletions

View File

@@ -1,5 +1,3 @@
from typing import Literal, TypeVar, Callable, cast
import asyncio, json, uuid, websockets
from ..handlers import PublicChannelsHandler
@@ -8,16 +6,14 @@ from ..exceptions import ConnectionNotOpen, TooManySubscriptions
_HEARTBEAT = "hb"
F = TypeVar("F", bound=Callable[..., Literal[None]])
def _require_websocket_connection(function: F) -> F:
def _require_websocket_connection(function):
async def wrapper(self, *args, **kwargs):
if self.websocket is None or not self.websocket.open:
raise ConnectionNotOpen("No open connection with the server.")
await function(self, *args, **kwargs)
return cast(F, wrapper)
return wrapper
class BfxWebSocketBucket:
VERSION = 2