_compat.py 文件源码

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

项目:bawk 作者: jttwnsnd 项目源码 文件源码
def _make_cached_stream_func(src_func, wrapper_func):
    cache = WeakKeyDictionary()
    def func():
        stream = src_func()
        try:
            rv = cache.get(stream)
        except Exception:
            rv = None
        if rv is not None:
            return rv
        rv = wrapper_func()
        try:
            cache[stream] = rv
        except Exception:
            pass
        return rv
    return func
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号