Esempio n. 1
0
def load_palettes(path):
    palette_list = files.json_read(path)
    palettes = []
    for palette in palette_list:
        palette = palette_from_dict(palette)
        palettes.append(palette)

    return palettes
Esempio n. 2
0
def load_incidents(path, incident_names):
    data = files.json_read(path)

    incidents = []
    for incident_name in incident_names:
        incident = incident_from_dict(data[incident_name])
        incidents.append(incident)

    return incidents
Esempio n. 3
0
import random
import pygame

import const
import colors
import graphics
import files

DEATH_EFFECTS_PATH = files.json_path("death_effects")
death_effects = files.json_read(DEATH_EFFECTS_PATH)

BENIGN_EFFECTS_PATH = files.json_path("benign_effects")
benign_effects = files.json_read(BENIGN_EFFECTS_PATH)

ALLERGENS_PATH = files.json_path("allergens")
allergens = files.json_read(ALLERGENS_PATH)

BRANDS_PATH = files.json_path("brands")
brands = files.json_read(BRANDS_PATH)

letters = [chr(a) for a in range(ord('a'), ord('z'))]


def generate_verification_code(length):
    code = []
    for _ in range(length):
        code.append(random.choice(letters))
    code.sort()
    return "".join(code)

Esempio n. 4
0
 def load_progress(self):
     self._completed_levels = files.json_read(self._save_file_path)
     misc.force_length(self.completed_levels, self._level_count, False)
Esempio n. 5
0
def load_incident(path, incident_name):
    data = files.json_read(path)
    incident = incident_from_dict(data[incident_name])

    return incident