Пример #1
0
def run_and_dump(name, obj, __checksum__=None, **kw):
    adapter = get_adapter(obj, interfaces.IOperation, name=name)
    if __checksum__:
        cached = path_from_checksum(__checksum__, outdir=CACHE_DIR)
        if cached.exists():
            return load(cached, cls=adapter.returns), __checksum__
    res = adapter(**kw)
    out = dump(res, outdir=CACHE_DIR)
    return res, as_unicode(out.stem)
Пример #2
0
def write(name, obj, _outdir=None, _stem=None, **kw):
    adapter = get_adapter(obj, interfaces.IWriter, name=name)
    outfile = _outdir.joinpath(path_component('{0}.{1}'.format(_stem, name)))
    adapter.write(outfile, **kw)
    file_written(outfile)
    return outfile
Пример #3
0
def get(name, obj, **kw):
    adapter = get_adapter(obj, interfaces.IWriter, name=name)
    return adapter.get(**kw)
Пример #4
0
def read(name, interface, obj, **kw):
    adapter = get_adapter(readbase.wrapped(obj), get_interface(interface), name=name)
    return adapter(**kw)
Пример #5
0
def run(name, obj, **kw):
    adapter = get_adapter(obj, interfaces.IOperation, name=name)
    return adapter(**kw)