python类Memory()的实例源码

__init__.py 文件源码 项目:srep 作者: Answeror 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def cached(*args, **kargs):
    import joblib as jb
    from .. import CACHE
    memo = getattr(cached, 'memo', None)
    if memo is None:
        cached.memo = memo = jb.Memory(CACHE, verbose=0)
    return memo.cache(*args, **kargs)
test_cache.py 文件源码 项目:senti 作者: stevenxxiu 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def setUp(self):
        self.tempdir = tempfile.TemporaryDirectory()
        self.memory = Memory(self.tempdir.name, verbose=0)
senti_models.py 文件源码 项目:senti 作者: stevenxxiu 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, data):
        self.classes_ = data.classes_
        self.data_dir = data.data_dir
        self.unsup_docs = data.unsup_docs
        self.distant_docs = data.distant_docs
        self.distant_labels = LazyLabels(data.distant_labels)
        self.train_docs = data.train_docs
        self.train_labels = LazyLabels(data.train_labels)
        self.val_docs = data.val_docs
        self.val_labels = LazyLabels(data.val_labels)
        self.test_docs = data.test_docs
        self.memory = Memory(cachedir='cache', verbose=0)
learn.py 文件源码 项目:extract 作者: dblalock 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def add_caching_to_funcs(obj, funcNames):
    mem = Memory('../.add_caching_to_funcs', verbose=11)
    if obj is None or funcNames is None:
        return
    if isScalar(funcNames):
        funcNames = [funcNames]
    for name in funcNames:
        func = getattr(obj, name, None)
        if func is not None:
            setattr(obj, name, mem.cache(func))


问题


面经


文章

微信
公众号

扫码关注公众号