Esempio n. 1
0
File: run.py Progetto: 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
Esempio n. 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
Esempio n. 3
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)
Esempio n. 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)