cardDB.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:hearthscan-bot 作者: d-schmidt 项目源码 文件源码
def __load(self):

        # load cards
        with open(self.cardJSON, 'r', encoding='utf8') as file:
            cards = json.load(file)
        with open(self.tokenJSON, 'r', encoding='utf8') as file:
            tokens = json.load(file)

        # json to db full of text
        for name, card in itertools.chain(cards.items(), tokens.items()):
            clean = CardDB.cleanName(name)
            if clean in self.__db:
                log.error("load() duplicate name, already in the db: %s",
                        clean)
                raise Exception('duplicate card')

            self.__db[clean] = formatter.createCardText(card, self.constants)

        self.tokens = [CardDB.cleanName(name) for name in tokens.keys()]

        # finally load temp file
        self.refreshTemp()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号