summaryrefslogtreecommitdiff
path: root/swiftstory/client.py
diff options
context:
space:
mode:
Diffstat (limited to 'swiftstory/client.py')
-rw-r--r--swiftstory/client.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/swiftstory/client.py b/swiftstory/client.py
index 98ba530..28fd6c0 100644
--- a/swiftstory/client.py
+++ b/swiftstory/client.py
@@ -3,6 +3,7 @@ import logging
from typing import Optional
import websockets.exceptions
+from websockets.server import WebSocketServerProtocol
from swiftstory.game import Game
from swiftstory.game_manager import GameManager
@@ -14,7 +15,7 @@ class Client:
""" Represent a client.
A client manages a (web)socket to communicate with the outside world.
It also manages the associated player when in a game. """
- def __init__(self, socket, game_manager: GameManager) -> None:
+ def __init__(self, socket: WebSocketServerProtocol, game_manager: GameManager) -> None:
self.game: Optional[Game] = None
self.game_manager: GameManager = game_manager
@@ -61,7 +62,7 @@ class Client:
raise ValueError("Player is None")
return self.game.try_collect_cards(self.player)
- def designate_card(self, card_id: int) -> str:
+ def designate_card(self, card_id: Optional[int]) -> str:
if self.game is None:
raise WrongAction('You have to join a game first')
if self.player is None:
@@ -91,7 +92,7 @@ class Client:
def monitor_player(self) -> None:
""" Start monitoring the player for notifications and send them. """
- async def f():
+ async def f() -> None:
assert self.player is not None
while True:
try: