summaryrefslogtreecommitdiff
path: root/swiftstory/cards.py
blob: 3c11f498ce039b6552e9fa6f41ca2f5ea835a60e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
""" Module that defines helpers to read cards from the filesystem. """

import json
import os
from typing import List

from pkg_resources import resource_stream


class Cards:
    """ Dummy class that provides helper functions to retrieve the cards from
    the FS. """
    @staticmethod
    def get_white_cards(lang: str) -> List[str]:
        ''' Read the file containing the white cards and return a list of cards '''
        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 '''
        return json.load(resource_stream(__name__,
                                         os.path.join("data/lang", lang, "cards/black.json")))