From 741f8234edde84dccefcbf5dc0ba3b70c0e016e2 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Wed, 29 Dec 2021 19:21:45 +0100 Subject: Add docstrings to all modules Signed-off-by: Olivier Gayot --- swiftstory/interface/ws.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'swiftstory/interface/ws.py') diff --git a/swiftstory/interface/ws.py b/swiftstory/interface/ws.py index a86c730..082ed1a 100644 --- a/swiftstory/interface/ws.py +++ b/swiftstory/interface/ws.py @@ -1,3 +1,6 @@ +""" Module that defines the interface (using WebSockets) between the GUI and +the game itself. """ + import contextlib import json import logging @@ -18,6 +21,7 @@ class WebsocketsInterface: self.game_manager = game_manager async def connection_handler(self, websocket: WebSocketServerProtocol, path: str) -> None: + """ Coroutine that handles one websocket connection. """ client = Client(websocket, self.game_manager) with contextlib.suppress(websockets.exceptions.ConnectionClosed): @@ -27,6 +31,7 @@ class WebsocketsInterface: client.disconnect() def message_received_handler(self, client: Client, message: Union[bytes, str]) -> str: + """ Handle a message and return an answer. """ def join_game() -> str: try: game_name = json_msg['game_name'] -- cgit v1.2.3