def read_workers(path): result = {} for data in json_data.read(path): result[data["worker_guid"]] = Worker(data["name"], data["surname"], data["worker_guid"], data["cards"]) return result
def read_logs(path): result = {} for data in json_data.read(path): result[data["time"]] = RegistryLog(data["time"], data["term_guid"], data["card_guid"], data["worker_guid"]) return result
def __init__(self): self.__conf_dict = json_data.read(CONFIG_PATH) self.__term_dict = Server.read_terminals( self.__conf_dict["terms_path"]) self.__workers_dict = Server.read_workers( self.__conf_dict["workers_path"]) self.__logs_dict = Server.read_logs(self.__conf_dict["logs_path"])
def read_terminals(path): """ :param path: Path to terminals json file :return: Dictionary of with terminals from file """ result = {} for data in json_data.read(path): result[data["term_guid"]] = Terminal(data["term_guid"], data["name"]) return result
def read_logs(path): """ :param path: Path to logs json file :return: Dictionary with logs from file """ result = {} for data in json_data.read(path): result[data["time"]] = RegistryLog(data["time"], data["term_guid"], data["card_guid"], data["worker_guid"]) return result
def read_workers(path): """ :param path: Path to workers json file :return: Dictionary with workers from file """ result = {} for data in json_data.read(path): result[data["worker_guid"]] = Worker(data["name"], data["surname"], data["worker_guid"], data["cards"]) return result
def read_terminals(path): result = {} for data in json_data.read(path): result[data["term_guid"]] = Terminal(data["term_guid"], data["name"]) return result