Exemplo n.º 1
0
import copy

import translations
from util import dig, extract_search_tag

_ = translations.Translations().get


class BaseGameData:
    def __init__(self, data):
        self.data = data

    def set_release_date(self, release_date):
        self.data['release_date'] = release_date

    def set_kingdom_name(self, kingdom_name):
        self.data['kingdom_name'] = kingdom_name

    def get(self, key, default=None):
        return self.data.get(key, default)

    def __contains__(self, item):
        return item in self.data

    def __getattr__(self, item):
        return self.data[item]

    def __str__(self):
        return f'<Pet id={self.data["id"]} name={self.data["reference_name"]} kingdom={self.data["kingdom_id"]}>'

Exemplo n.º 2
0
def update_translations():
    global _
    importlib.reload(translations)
    del _
    _ = translations.Translations().get