cleanup old code

This commit is contained in:
Timothy Pogue 2022-09-08 10:44:03 -06:00
parent 379b1cbc90
commit b3b0c918d9
3 changed files with 0 additions and 34 deletions

View File

@ -64,15 +64,3 @@ class WSAnalyzedDFMessage(WSMessageSchema):
data: AnalyzedDFData
# --------------------------------------------------------------------------
if __name__ == "__main__":
message = WSAnalyzedDFMessage(
data={
"key": ("1", "5m", "spot"),
"df": DataFrame(),
"la": datetime.now()
}
)
print(message)

View File

@ -46,16 +46,6 @@ class JSONWebSocketSerializer(WebSocketSerializer):
return json.loads(data, object_hook=_json_object_hook)
# ORJSON does not support .loads(object_hook=x) parameter, so we must use RapidJSON
class RapidJSONWebSocketSerializer(WebSocketSerializer):
def _serialize(self, data):
return rapidjson.dumps(data, default=_json_default)
def _deserialize(self, data):
return rapidjson.loads(data, object_hook=_json_object_hook)
class HybridJSONWebSocketSerializer(WebSocketSerializer):
def _serialize(self, data) -> str:
return str(orjson.dumps(data, default=_json_default), "utf-8")

View File

@ -1,12 +0,0 @@
from fastapi import WebSocket
# fastapi does not make this available through it, so import directly from starlette
from starlette.websockets import WebSocketState
async def is_websocket_alive(ws: WebSocket) -> bool:
if (
ws.application_state == WebSocketState.CONNECTED and
ws.client_state == WebSocketState.CONNECTED
):
return True
return False