fix mypy error

This commit is contained in:
Timothy Pogue 2022-09-08 10:34:37 -06:00
parent 9b752475db
commit df3c126146

View File

@ -9,7 +9,8 @@ from freqtrade.enums import RPCMessageType, RPCRequestType
from freqtrade.rpc.api_server.deps import get_channel_manager, get_rpc from freqtrade.rpc.api_server.deps import get_channel_manager, get_rpc
from freqtrade.rpc.api_server.ws.channel import WebSocketChannel from freqtrade.rpc.api_server.ws.channel import WebSocketChannel
from freqtrade.rpc.api_server.ws.schema import (ValidationError, WSAnalyzedDFMessage, from freqtrade.rpc.api_server.ws.schema import (ValidationError, WSAnalyzedDFMessage,
WSRequestSchema, WSWhitelistMessage) WSMessageSchema, WSRequestSchema,
WSWhitelistMessage)
from freqtrade.rpc.rpc import RPC from freqtrade.rpc.rpc import RPC
@ -47,6 +48,7 @@ async def _process_consumer_request(
return return
type, data = websocket_request.type, websocket_request.data type, data = websocket_request.type, websocket_request.data
response: WSMessageSchema
logger.debug(f"Request of type {type} from {channel}") logger.debug(f"Request of type {type} from {channel}")
@ -61,6 +63,7 @@ async def _process_consumer_request(
channel.set_subscriptions(data) channel.set_subscriptions(data)
# We don't send a response for subscriptions # We don't send a response for subscriptions
return
elif type == RPCRequestType.WHITELIST: elif type == RPCRequestType.WHITELIST:
# Get whitelist # Get whitelist
@ -70,6 +73,7 @@ async def _process_consumer_request(
response = WSWhitelistMessage(data=whitelist) response = WSWhitelistMessage(data=whitelist)
# Send it back # Send it back
await channel.send(response.dict(exclude_none=True)) await channel.send(response.dict(exclude_none=True))
return
elif type == RPCRequestType.ANALYZED_DF: elif type == RPCRequestType.ANALYZED_DF:
limit = None limit = None
@ -86,6 +90,8 @@ async def _process_consumer_request(
response = WSAnalyzedDFMessage(data=message) response = WSAnalyzedDFMessage(data=message)
await channel.send(response.dict(exclude_none=True)) await channel.send(response.dict(exclude_none=True))
return
@router.websocket("/message/ws") @router.websocket("/message/ws")
async def message_endpoint( async def message_endpoint(