summaryrefslogtreecommitdiff
path: root/swiftstory/client.py
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2021-12-23 15:47:13 +0100
committerOlivier Gayot <olivier.gayot@sigexec.com>2021-12-23 23:15:21 +0100
commit96eaa6555ae44e30b3784576a6ecd0941523691f (patch)
tree4fa06a1a7c1b434085f2e015b5928bd91be01cd8 /swiftstory/client.py
parentc8d99bb33f21991a6c3e7539806f2bc73659b896 (diff)
Add required annotations to make sure mypy succeeds
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'swiftstory/client.py')
-rw-r--r--swiftstory/client.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/swiftstory/client.py b/swiftstory/client.py
index 3000b79..52957c2 100644
--- a/swiftstory/client.py
+++ b/swiftstory/client.py
@@ -1,14 +1,16 @@
import asyncio
import logging
+from typing import Optional
import websockets
+from swiftstory.game import Game
from swiftstory.exception import WrongAction, UnsupportedLanguage, JoinError
class Client:
def __init__(self, socket, game_manager):
- self.game = None
+ self.game: Optional[Game] = None
self.game_manager = game_manager
self.socket = socket
@@ -75,4 +77,6 @@ class Client:
def disconnect(self):
if self.player is not None:
+ if self.game is None:
+ raise ValueError("Disconnect from inexistent game.")
self.game.disconnect(self.player)