Python-Dateien

Neu laden
Gefunden: 162 Datei(en)
zipimport.py
# Source Generated with Decompyle++
# File: zipimport.pyc (Python 3.13)

import _frozen_importlib_external as _bootstrap_external
from _frozen_importlib_external import _unpack_uint16, _unpack_uint32
import _frozen_importlib as _bootstrap
import _imp
import _io
import marshal
import sys
import time
import _warnings
__all__ = [
    'ZipImportError',
    'zipimporter']
path_sep = _bootstrap_external.path_sep
alt_path_sep = _bootstrap_external.path_separators[1:]

class ZipImportError(ImportError):
    pass

_zip_directory_cache = { }
_module_type = type(sys)
END_CENTRAL_DIR_SIZE = 22
STRING_END_ARCHIVE = b'PK\x05\x06'
MAX_COMMENT_LEN = 65535

class zipimporter(_bootstrap_external._LoaderBasics):
    
    def __init__(self, path):
        if not isinstance(path, str):
            raise TypeError(f'''expected str, not {type(path)!r}''')
        if not None:
            raise ZipImportError('archive path is empty', path = path)
        if None:
            path = path.replace(alt_path_sep, path_sep)
        prefix = []
        st = _bootstrap_external._path_stat(path)
        if st.st_mode & 61440 < 32768:
            raise ZipImportError('not a Zip file', path = path)
        continue
        files = _zip_directory_cache[path]

    
    def find_loader(self, fullname, path = (None,)):
        _warnings.warn('zipimporter.find_loader() is deprecated and slated for removal in Python 3.12; use find_spec() instead', DeprecationWarning)
        mi = _get_module_info(self, fullname)
        return (self, [])
        modpath = _get_module_path(self, fullname)
        if _is_dir(self, modpath):
            return (None, [
                f'''{self.archive}{path_sep}{modpath}'''])
        return (None, [])

    
    def find_module(self, fullname, path = (None,)):
        _warnings.warn('zipimporter.find_module() is deprecated and slated for removal in Python 3.12; use find_spec() instead', DeprecationWarning)
        return self.find_loader(fullname, path)[0]

    
    def find_spec(self, fullname, target = (None,)):
        module_info = _get_module_info(self, fullname)
        return _bootstrap.spec_from_loader(fullname, self, is_package = module_info)
        modpath = _get_module_path(self, fullname)
        if _is_dir(self, modpath):
            path = f'''{self.archive}{path_sep}{modpath}'''
            spec = _bootstrap.ModuleSpec(name = fullname, loader = None, is_package = True)
            spec.submodule_search_locations.append(path)
            return spec

    
    def get_code(self, fullname):
        (code, ispackage, modpath) = _get_module_code(self, fullname)
        return code

    
    def get_data(self, pathname):
        if alt_path_sep:
            pathname = pathname.replace(alt_path_sep, path_sep)
        key = pathname
        if pathname.startswith(self.archive + path_sep):
            key = pathname[len(self.archive + path_sep):]
        toc_entry = self._files[key]

    
    def get_filename(self, fullname):
        (code, ispackage, modpath) = _get_module_code(self, fullname)
        return modpath

    
    def get_source(self, fullname):
        mi = _get_module_info(self, fullname)
        if mi is not None:
            raise ZipImportError(f'''can\'t find module {fullname!r}''', name = fullname)
        path = None(self, fullname)
        if mi:
            fullpath = _bootstrap_external._path_join(path, '__init__.py')
        else:
            fullpath = f'''{path}.py'''
        toc_entry = self._files[fullpath]

    
    def is_package(self, fullname):
        mi = _get_module_info(self, fullname)
        if mi is not None:
            raise ZipImportError(f'''can\'t find module {fullname!r}''', name = fullname)

    
    def load_module(self, fullname):
        msg = 'zipimport.zipimporter.load_module() is deprecated and slated for removal in Python 3.12; use exec_module() instead'
        _warnings.warn(msg, DeprecationWarning)
        (code, ispackage, modpath) = _get_module_code(self, fullname)
        mod = sys.modules.get(fullname)
        if not isinstance(mod, _module_type):
            mod