cache.py 文件源码

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

项目:pythonVSCode 作者: DonJayamanne 项目源码 文件源码
def load_parser(self, path, original_changed_time):
        try:
            pickle_changed_time = self._index[path]
        except KeyError:
            return None
        if original_changed_time is not None \
                and pickle_changed_time < original_changed_time:
            # the pickle file is outdated
            return None

        with open(self._get_hashed_path(path), 'rb') as f:
            try:
                gc.disable()
                parser_cache_item = pickle.load(f)
            finally:
                gc.enable()

        debug.dbg('pickle loaded: %s', path)
        parser_cache[path] = parser_cache_item
        return parser_cache_item.parser
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号