当前位置: 首页>>代码示例>>Python>>正文


Python zipimport._zip_directory_cache方法代码示例

本文整理汇总了Python中zipimport._zip_directory_cache方法的典型用法代码示例。如果您正苦于以下问题:Python zipimport._zip_directory_cache方法的具体用法?Python zipimport._zip_directory_cache怎么用?Python zipimport._zip_directory_cache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在zipimport的用法示例。


在下文中一共展示了zipimport._zip_directory_cache方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _remove_and_clear_zip_directory_cache_data

# 需要导入模块: import zipimport [as 别名]
# 或者: from zipimport import _zip_directory_cache [as 别名]
def _remove_and_clear_zip_directory_cache_data(normalized_path):
    def clear_and_remove_cached_zip_archive_directory_data(path, old_entry):
        old_entry.clear()

    _update_zipimporter_cache(
        normalized_path, zipimport._zip_directory_cache,
        updater=clear_and_remove_cached_zip_archive_directory_data)

# PyPy Python implementation does not allow directly writing to the
# zipimport._zip_directory_cache and so prevents us from attempting to correct
# its content. The best we can do there is clear the problematic cache content
# and have PyPy repopulate it as needed. The downside is that if there are any
# stale zipimport.zipimporter instances laying around, attempting to use them
# will fail due to not having its zip archive directory information available
# instead of being automatically corrected to use the new correct zip archive
# directory information. 
开发者ID:jpush,项目名称:jbox,代码行数:18,代码来源:easy_install.py

示例2: _replace_zip_directory_cache_data

# 需要导入模块: import zipimport [as 别名]
# 或者: from zipimport import _zip_directory_cache [as 别名]
def _replace_zip_directory_cache_data(normalized_path):
        def replace_cached_zip_archive_directory_data(path, old_entry):
            # N.B. In theory, we could load the zip directory information just
            # once for all updated path spellings, and then copy it locally and
            # update its contained path strings to contain the correct
            # spelling, but that seems like a way too invasive move (this cache
            # structure is not officially documented anywhere and could in
            # theory change with new Python releases) for no significant
            # benefit.
            old_entry.clear()
            zipimport.zipimporter(path)
            old_entry.update(zipimport._zip_directory_cache[path])
            return old_entry

        _update_zipimporter_cache(
            normalized_path, zipimport._zip_directory_cache,
            updater=replace_cached_zip_archive_directory_data) 
开发者ID:jpush,项目名称:jbox,代码行数:19,代码来源:easy_install.py

示例3: _remove_and_clear_zip_directory_cache_data

# 需要导入模块: import zipimport [as 别名]
# 或者: from zipimport import _zip_directory_cache [as 别名]
def _remove_and_clear_zip_directory_cache_data(normalized_path):
    def clear_and_remove_cached_zip_archive_directory_data(path, old_entry):
        old_entry.clear()

    _update_zipimporter_cache(
        normalized_path, zipimport._zip_directory_cache,
        updater=clear_and_remove_cached_zip_archive_directory_data)


# PyPy Python implementation does not allow directly writing to the
# zipimport._zip_directory_cache and so prevents us from attempting to correct
# its content. The best we can do there is clear the problematic cache content
# and have PyPy repopulate it as needed. The downside is that if there are any
# stale zipimport.zipimporter instances laying around, attempting to use them
# will fail due to not having its zip archive directory information available
# instead of being automatically corrected to use the new correct zip archive
# directory information. 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:19,代码来源:easy_install.py

示例4: uncache_zipdir

# 需要导入模块: import zipimport [as 别名]
# 或者: from zipimport import _zip_directory_cache [as 别名]
def uncache_zipdir(path):
    """
    Remove any globally cached zip file related data for `path`

    Stale zipimport.zipimporter objects need to be removed when a zip file is
    replaced as they contain cached zip file directory information. If they are
    asked to get data from their zip file, they will use that cached
    information to calculate the data location in the zip file. This calculated
    location may be incorrect for the replaced zip file, which may in turn
    cause the read operation to either fail or return incorrect data.

    Note we have no way to clear any local caches from here. That is left up to
    whomever is in charge of maintaining that cache.

    """
    normalized_path = normalize_path(path)
    _uncache(normalized_path, zipimport._zip_directory_cache)
    _uncache(normalized_path, sys.path_importer_cache) 
开发者ID:MayOneUS,项目名称:pledgeservice,代码行数:20,代码来源:easy_install.py


注:本文中的zipimport._zip_directory_cache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。