Skip to content

Commit

Permalink
* Removed unnecessary async annotation from the parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
DobromirM committed Aug 26, 2020
1 parent 89c039f commit f664c18
Show file tree
Hide file tree
Showing 16 changed files with 995 additions and 1,329 deletions.
2 changes: 1 addition & 1 deletion swimai/client/_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ async def _wait_for_messages(self) -> None:
try:
while self.status == _ConnectionStatus.RUNNING:
message = await self.websocket.recv()
response = await _Envelope._parse_recon(message)
response = _Envelope._parse_recon(message)
await self.__subscribers._receive_message(response)
finally:
await self._close()
Expand Down
14 changes: 7 additions & 7 deletions swimai/client/_downlinks/_downlinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ class _EventDownlinkModel(_DownlinkModel):

async def _establish_downlink(self) -> None:
link_request = _LinkRequest(self.node_uri, self.lane_uri)
await self.connection._send_message(await link_request._to_recon())
await self.connection._send_message(link_request._to_recon())

async def _receive_event(self, message: _Envelope) -> None:
converter = RecordConverter.get_converter()
Expand Down Expand Up @@ -359,7 +359,7 @@ def __init__(self, client: 'SwimClient') -> None:

async def _establish_downlink(self) -> None:
sync_request = _SyncRequest(self.node_uri, self.lane_uri)
await self.connection._send_message(await sync_request._to_recon())
await self.connection._send_message(sync_request._to_recon())

async def _receive_event(self, message: '_Envelope') -> None:
await self.__set_value(message)
Expand All @@ -374,7 +374,7 @@ async def _send_message(self, message: '_Envelope') -> None:
:param message: - Message to send to the remote agent.
"""
await self.linked.wait()
await self.connection._send_message(await message._to_recon())
await self.connection._send_message(message._to_recon())

async def _get_value(self) -> Any:
"""
Expand Down Expand Up @@ -501,7 +501,7 @@ def __init__(self, client: 'SwimClient') -> None:

async def _establish_downlink(self) -> None:
sync_request = _SyncRequest(self.node_uri, self.lane_uri)
await self.connection._send_message(await sync_request._to_recon())
await self.connection._send_message(sync_request._to_recon())

async def _receive_event(self, message: '_Envelope') -> None:
if message._body._tag == 'update':
Expand All @@ -519,7 +519,7 @@ async def _send_message(self, message: '_Envelope') -> None:
:param message: - Message to send to the remote agent.
"""
await self.linked.wait()
await self.connection._send_message(await message._to_recon())
await self.connection._send_message(message._to_recon())

async def _get_value(self, key) -> Any:
"""
Expand Down Expand Up @@ -547,7 +547,7 @@ async def __receive_update(self, message: '_Envelope') -> None:
self.downlink_manager.registered_classes,
self.downlink_manager.strict)

recon_key = await Recon.to_string(message._body._get_head().value._get_head().value)
recon_key = Recon.to_string(message._body._get_head().value._get_head().value)
old_value = await self._get_value(recon_key)

self._map[recon_key] = (key, value)
Expand All @@ -558,7 +558,7 @@ async def __receive_remove(self, message: '_Envelope') -> None:
self.downlink_manager.registered_classes,
self.downlink_manager.strict)

recon_key = await Recon.to_string(message._body._get_head().value._get_head().value)
recon_key = Recon.to_string(message._body._get_head().value._get_head().value)
old_value = self._map.pop(recon_key, (Value.absent(), Value.absent()))[1]

await self.downlink_manager._subscribers_did_remove(key, old_value)
Expand Down
2 changes: 1 addition & 1 deletion swimai/client/_swim_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ async def __send_command(self, host_uri: str, node_uri: str, lane_uri: str, body
host_uri = _URI._normalise_warp_scheme(host_uri)
message = _CommandMessage(node_uri, lane_uri, body=record)
connection = await self._get_connection(host_uri)
await connection._send_message(await message._to_recon())
await connection._send_message(message._to_recon())

def __start_event_loop(self) -> None:
asyncio.set_event_loop(self._loop)
Expand Down
Loading

0 comments on commit f664c18

Please sign in to comment.