_commonstore.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:provenance 作者: bmabey 项目源码 文件源码
def chained_put(chained, id, value, put=None, overwrite=False, contains=op.contains, **kargs):
    stores_with_write = [s for s in chained.stores if s._write]
    if len(stores_with_write) == 0:
        raise PermissionError('put', chained, 'write')

    record = None
    putin = []
    for store in stores_with_write:
        if overwrite or not contains(store, id):
            if put:
                record = put(store, id, value, **kargs)
            else:
                record = store.put(id, value, **kargs)
            putin.append(store)

    if (len(putin) == 0 and
        len(stores_with_write) > 0):
        raise KeyExistsError(id, chained)

    return record
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号