def make_conf(*args, **kwargs): """ 1. get_conf(conf_module) 2. get_conf(key=value, ...) :return: conf with default values added (where needed) """ conf = object_to_dict(default_conf) if len(args) == 1: dict_conf = object_to_dict(args[0]) else: dict_conf = kwargs conf.update(dict_conf) return dict_to_object(conf)
def make_conf(*args, **kwargs): """ 1. get_conf(conf_module) 2. get_conf(key=value, ...) :return: conf with default values added (where needed) """ conf = object_to_dict(default_conf) if len(args) == 1: dict_conf = object_to_dict(args[0]) else: dict_conf = kwargs conf.update(dict_conf) return dict_to_object(conf)
def save_unit(unit, path): data = { 'conf': object_to_dict(unit.conf), 'unit': unit.get_data() } with open(path, 'wb') as f: pickle.dump(data, f)
def save_unit(unit, path): data = {'conf': object_to_dict(unit.conf), 'unit': unit.get_data()} with open(path, 'wb') as f: pickle.dump(data, f)