diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2021-12-23 21:45:30 +0100 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2021-12-23 23:15:21 +0100 |
commit | e6b9b68a6539d74bec94c0a361187ed89ec5c124 (patch) | |
tree | 70a68986cdd85784fe6d9dfedf0e65c30919b731 | |
parent | 292120aeb5611d0b9c2b54f54c89cd9cb96f2a4b (diff) |
Move FS operation outside the initializer of GameManager
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
-rw-r--r-- | swiftstory/game_manager.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/swiftstory/game_manager.py b/swiftstory/game_manager.py index 7551ac4..da2e5c7 100644 --- a/swiftstory/game_manager.py +++ b/swiftstory/game_manager.py @@ -21,13 +21,17 @@ class GameManager: def __init__(self) -> None: self.lang_containers: Dict[str, LangContainer] = {} - for language in next(os.walk('usr/share/swiftstory/lang'))[1]: + for language in self.list_languages(): self.lang_containers[language] = LangContainer( black_cards=Cards.get_black_cards(language), white_cards=Cards.get_white_cards(language), games={} ) + def list_languages(self) -> List[str]: + """ List available languages based on FS. """ + return next(os.walk("usr/share/swiftstory/lang"))[1] + def join_game(self, game_name: str, lang: str) -> Game: container = self.lang_containers.get(lang) if container is None: |