|
3 | 3 | import random
|
4 | 4 | import re
|
5 | 5 | from copy import deepcopy
|
6 |
| -from typing import Any, Dict, List, Tuple |
| 6 | +from typing import Any, Dict, Iterable, List, Sequence, Tuple |
7 | 7 |
|
8 | 8 | from typing_extensions import override
|
9 | 9 |
|
@@ -344,7 +344,7 @@ def command_accept(self, message: Dict[str, Any], sender: str, content: str) ->
|
344 | 344 | )
|
345 | 345 | self.start_game_if_ready(game_id)
|
346 | 346 |
|
347 |
| - def create_game_lobby(self, message: Dict[str, Any], users: List[str] = []) -> None: |
| 347 | + def create_game_lobby(self, message: Dict[str, Any], users: Sequence[str] = []) -> None: |
348 | 348 | if self.is_game_in_subject(message["subject"], message["display_recipient"]):
|
349 | 349 | self.send_reply(message, "There is already a game in this stream.")
|
350 | 350 | return
|
@@ -499,7 +499,7 @@ def get_sorted_player_statistics(self) -> List[Tuple[str, Dict[str, int]]]:
|
499 | 499 | reverse=True,
|
500 | 500 | )
|
501 | 501 |
|
502 |
| - def send_invite(self, game_id: str, user_email: str, message: Dict[str, Any] = {}) -> None: |
| 502 | + def send_invite(self, game_id: str, user_email: str, message: Dict[str, Any]) -> None: |
503 | 503 | self.invites[game_id].update({user_email.lower(): "p"})
|
504 | 504 | self.send_message(user_email, self.alert_new_invitation(game_id), True)
|
505 | 505 | if message != {}:
|
@@ -547,7 +547,7 @@ def get_formatted_game_object(self, game_id: str) -> str:
|
547 | 547 | )
|
548 | 548 | return object
|
549 | 549 |
|
550 |
| - def join_game(self, game_id: str, user_email: str, message: Dict[str, Any] = {}) -> None: |
| 550 | + def join_game(self, game_id: str, user_email: str, message: Dict[str, Any]) -> None: |
551 | 551 | if len(self.get_players(game_id)) >= self.max_players:
|
552 | 552 | if message != {}:
|
553 | 553 | self.send_reply(message, "This game is full.")
|
@@ -638,7 +638,7 @@ def parse_message(self, message: Dict[str, Any]) -> None:
|
638 | 638 | self.instances[game_id].handle_message(message["content"], message["sender_email"])
|
639 | 639 |
|
640 | 640 | def change_game_subject(
|
641 |
| - self, game_id: str, stream_name: str, subject_name: str, message: Dict[str, Any] = {} |
| 641 | + self, game_id: str, stream_name: str, subject_name: str, message: Dict[str, Any] |
642 | 642 | ) -> None:
|
643 | 643 | if self.get_game_instance_by_subject(stream_name, subject_name) is not None:
|
644 | 644 | if message != {}:
|
@@ -689,7 +689,7 @@ def get_user_cache(self) -> Dict[str, Any]:
|
689 | 689 | self.user_cache = json.loads(user_cache_str)
|
690 | 690 | return self.user_cache
|
691 | 691 |
|
692 |
| - def verify_users(self, users: List[str], message: Dict[str, Any] = {}) -> List[str]: |
| 692 | + def verify_users(self, users: Iterable[str], message: Dict[str, Any]) -> List[str]: |
693 | 693 | verified_users = []
|
694 | 694 | failed = False
|
695 | 695 | for u in users:
|
@@ -741,7 +741,7 @@ def is_game_in_subject(self, subject_name: str, stream_name: str) -> bool:
|
741 | 741 | or self.get_game_instance_by_subject(subject_name, stream_name) is not None
|
742 | 742 | )
|
743 | 743 |
|
744 |
| - def is_user_not_player(self, user_email: str, message: Dict[str, Any] = {}) -> bool: |
| 744 | + def is_user_not_player(self, user_email: str, message: Dict[str, Any]) -> bool: |
745 | 745 | user = self.get_user_by_email(user_email)
|
746 | 746 | if user == {}:
|
747 | 747 | if message != {}:
|
|
0 commit comments