Don't overwrite "type" with a variable

This commit is contained in:
Matthias
2023-06-24 20:18:24 +02:00
parent 6e143d4a5d
commit 69087c30e7
+5 -5
View File
@@ -62,13 +62,13 @@ async def _process_consumer_request(
logger.error(f"Invalid request from {channel}: {e}") logger.error(f"Invalid request from {channel}: {e}")
return return
type, data = websocket_request.type, websocket_request.data type_, data = websocket_request.type, websocket_request.data
response: WSMessageSchema response: WSMessageSchema
logger.debug(f"Request of type {type} from {channel}") logger.debug(f"Request of type {type_} from {channel}")
# If we have a request of type SUBSCRIBE, set the topics in this channel # If we have a request of type SUBSCRIBE, set the topics in this channel
if type == RPCRequestType.SUBSCRIBE: if type_ == RPCRequestType.SUBSCRIBE:
# If the request is empty, do nothing # If the request is empty, do nothing
if not data: if not data:
return return
@@ -80,7 +80,7 @@ async def _process_consumer_request(
# We don't send a response for subscriptions # We don't send a response for subscriptions
return return
elif type == RPCRequestType.WHITELIST: elif type_ == RPCRequestType.WHITELIST:
# Get whitelist # Get whitelist
whitelist = rpc._ws_request_whitelist() whitelist = rpc._ws_request_whitelist()
@@ -88,7 +88,7 @@ async def _process_consumer_request(
response = WSWhitelistMessage(data=whitelist) response = WSWhitelistMessage(data=whitelist)
await channel.send(response.dict(exclude_none=True)) await channel.send(response.dict(exclude_none=True))
elif type == RPCRequestType.ANALYZED_DF: elif type_ == RPCRequestType.ANALYZED_DF:
# Limit the amount of candles per dataframe to 'limit' or 1500 # Limit the amount of candles per dataframe to 'limit' or 1500
limit = int(min(data.get('limit', 1500), 1500)) if data else None limit = int(min(data.get('limit', 1500), 1500)) if data else None
pair = data.get('pair', None) if data else None pair = data.get('pair', None) if data else None