import json class Creatures: creatures = None @staticmethod def load_creature_data(): """Loads the monsters data from a JSON file""" with open('app/tables/creatures.json') as f: Creatures.creatures = json.load(f) def __init__(self): if not Creatures.creatures: self.load_creature_data() def get_creature(self, creature_name): """Returns the dictionary of the specified creature.""" return self.creatures.get(creature_name) def get_creature_list(self): """Returns a list of all creatures.""" return sorted(list(self.creatures.keys()))