Lines Matching +full:module +full:- +full:importer
3 This module exports three objects:
4 - zipimporter: a class; its constructor takes a path to a Zip archive.
5 - ZipImportError: exception raised by zipimporter objects. It's a
7 - _zip_directory_cache: a dict, mapping archive paths to zip directory
10 It is usually not needed to use the zipimport module explicitly; it is
44 MAX_COMMENT_LEN = (1 << 16) - 1
47 """zipimporter(archivepath) -> zipimporter object
99 self.prefix = _bootstrap_external._path_join(*prefix[::-1])
104 # Check whether we can satisfy the import of the module named by
110 """find_loader(fullname, path=None) -> self, str or None.
112 Search for a module specified by 'fullname'. 'fullname' must be the
113 fully qualified (dotted) module name. It returns the zipimporter
114 instance itself if the module was found, a string containing the
116 or None otherwise. The optional 'path' argument is ignored -- it's
117 there for compatibility with the importer protocol.
126 # This is a module or package.
129 # Not a module or regular package. See if this is a directory, and
144 # Check whether we can satisfy the import of the module named by
147 """find_module(fullname, path=None) -> self or None.
149 Search for a module specified by 'fullname'. 'fullname' must be the
150 fully qualified (dotted) module name. It returns the zipimporter
151 instance itself if the module was found, or None if it wasn't.
152 The optional 'path' argument is ignored -- it's there for compatibility
153 with the importer protocol.
163 """Create a ModuleSpec for the specified module.
165 Returns None if the module cannot be found.
171 # Not a module or regular package. See if this is a directory, and
190 """get_code(fullname) -> code object.
192 Return the code object for the specified module. Raise ZipImportError
193 if the module couldn't be imported.
200 """get_data(pathname) -> string with file data.
219 # Return a string matching __file__ for the named module
221 """get_filename(fullname) -> filename string.
223 Return the filename for the specified module or raise ZipImportError
227 # would come from if the module was actually loaded
233 """get_source(fullname) -> source string.
235 Return the source code for the specified module. Raise ZipImportError
236 if the module couldn't be found, return None if the archive does
237 contain the module, but has no source for it.
241 raise ZipImportError(f"can't find module {fullname!r}", name=fullname)
252 # we have the module, but no source
257 # Return a bool signifying whether the module is a package or not.
259 """is_package(fullname) -> bool.
261 Return True if the module specified by fullname is a package.
262 Raise ZipImportError if the module couldn't be found.
266 raise ZipImportError(f"can't find module {fullname!r}", name=fullname)
270 # Load and return the module named by 'fullname'.
272 """load_module(fullname) -> module.
274 Load the module specified by 'fullname'. 'fullname' must be the
275 fully qualified (dotted) module name. It returns the imported
276 module, or raises ZipImportError if it could not be imported.
292 # add __path__ to the module *before* the code gets
309 raise ImportError(f'Loaded module {fullname!r} not found in sys.modules')
343 # _zip_searchorder defines how we search for a module in the Zip
345 # non-package .pyc, and .py entries. The .pyc entries
355 # Given a module name, return the potential file path in the
369 # Return some information about a module.
381 # _read_directory(archive) -> files dict (new reference)
408 # GH-87235: On macOS all file descriptors for /dev/fd/N share the same
414 fp.seek(-END_CENTRAL_DIR_SIZE, 2)
430 max_comment_start = max(file_size - MAX_COMMENT_LEN -
446 header_position = file_size - len(data) + pos
454 header_position -= header_size
455 arc_offset = header_position - header_offset
501 if len(fp.read(header_size - name_size)) != header_size - name_size:
507 # UTF-8 file names extension
536 ' !"#$%&\'()*+,-./'
542 # non-ASCII part, 16 rows x 8 chars
627 return decompress(raw_data, -15)
635 return abs(t1 - t2) <= 1
678 raise TypeError(f'compiled module {pathname!r} is not a code object')
707 -1, -1, -1))
715 assert path[-1:] in ('c', 'o')
716 path = path[:-1]
733 assert path[-1:] in ('c', 'o')
734 path = path[:-1]
744 # Get the code object associated with the module specified by
768 # bad magic number or non-matching mtime
775 msg = f"module load failed: {import_error}"
778 raise ZipImportError(f"can't find module {fullname!r}", name=fullname)