summaryrefslogtreecommitdiff
path: root/swiftstory/game.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/game.py
parentc8d99bb33f21991a6c3e7539806f2bc73659b896 (diff)
Add required annotations to make sure mypy succeeds
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'swiftstory/game.py')
-rw-r--r--swiftstory/game.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/swiftstory/game.py b/swiftstory/game.py
index cda3ddd..20ac726 100644
--- a/swiftstory/game.py
+++ b/swiftstory/game.py
@@ -1,4 +1,5 @@
import random
+from typing import Optional
from swiftstory.exception import WrongAction, JoinError
from swiftstory.player import Player
@@ -19,7 +20,7 @@ class Game:
self.players = []
- self.judge = None
+ self.judge: Optional[Player] = None
self.board = Board()
self.board.white_pick = white_pick
@@ -101,6 +102,8 @@ class Game:
self.board.play_card(player, card)
+ if self.judge is None:
+ raise ValueError("There is no judge")
self.judge.register_notification({'op': 'card_played'})
return success({'card_id': card_id})