summaryrefslogtreecommitdiff
path: root/swiftstory/cards.py
diff options
context:
space:
mode:
authorOlivier Gayot <olivier.gayot@sigexec.com>2021-12-29 19:36:59 +0100
committerOlivier Gayot <olivier.gayot@sigexec.com>2021-12-29 19:46:26 +0100
commitf5edd5035d06adc7b6bceb1f521b4911706cde0b (patch)
tree6d874e076ee8d7bc7fcfda050f4d95822319a3d0 /swiftstory/cards.py
parent545fb5d5143b11320b768094410b162815cc4f75 (diff)
Import resource_stream to reduce size of lines
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Diffstat (limited to 'swiftstory/cards.py')
-rw-r--r--swiftstory/cards.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/swiftstory/cards.py b/swiftstory/cards.py
index 96438cc..7f28919 100644
--- a/swiftstory/cards.py
+++ b/swiftstory/cards.py
@@ -2,18 +2,18 @@ import json
import os
from typing import List
-import pkg_resources
+from pkg_resources import resource_stream
class Cards:
@staticmethod
def get_white_cards(lang: str) -> List[str]:
''' Read the file containing the white cards and return a list of cards '''
- fh = pkg_resources.resource_stream(__name__, os.path.join("data/lang", lang, "cards/white.json"))
- return json.load(fh)
+ return json.load(resource_stream(__name__,
+ os.path.join("data/lang", lang, "cards/white.json")))
@staticmethod
def get_black_cards(lang: str) -> List[str]:
''' Read the file containing the black cards and return a list of cards '''
- fh = pkg_resources.resource_stream(__name__, os.path.join("data/lang", lang, "cards/black.json"))
- return json.load(fh)
+ return json.load(resource_stream(__name__,
+ os.path.join("data/lang", lang, "cards/black.json")))