示例#1
0
文件: run.py 项目: oleglite/syne
def load_unit(path):
    with open(path, 'rb') as f:
        data = pickle.load(f)

    conf = make_conf(dict_to_object(data['conf']))
    unit = TimeUnit(conf, data=data['unit'])
    return unit
示例#2
0
def load_unit(path):
    with open(path, 'rb') as f:
        data = pickle.load(f)

    conf = make_conf(dict_to_object(data['conf']))
    unit = TimeUnit(conf, data=data['unit'])
    return unit
示例#3
0
文件: __init__.py 项目: oleglite/syne
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)
示例#4
0
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)