Lines Matching full:path

4 - zipimporter: a class; its constructor takes a path to a Zip archive.
11 used by the builtin import mechanism for sys.path items that are paths
49 Create a new zipimporter instance. 'archivepath' must be a path to
50 a zipfile, or to a specific path inside a zipfile. For example, it can be
61 # Split the "subdirectory" from the Zip archive path, lookup a matching
64 def __init__(self, path):
65 if not isinstance(path, str):
66 raise TypeError(f"expected str, not {type(path)!r}")
67 if not path:
68 raise ZipImportError('archive path is empty', path=path)
70 path = path.replace(alt_path_sep, path_sep)
75 st = _bootstrap_external._path_stat(path)
78 # Back up one path element.
79 dirname, basename = _bootstrap_external._path_split(path)
80 if dirname == path:
81 raise ZipImportError('not a Zip file', path=path)
82 path = dirname
88 raise ZipImportError('not a Zip file', path=path)
92 files = _zip_directory_cache[path]
94 files = _read_directory(path)
95 _zip_directory_cache[path] = files
97 self.archive = path
98 # a prefix directory following the ZIP file path.
107 # full path if it's a possible namespace portion, None if we
109 def find_loader(self, fullname, path=None):
110 """find_loader(fullname, path=None) -> self, str or None.
115 full path name if it's possibly a portion of a namespace package,
116 or None otherwise. The optional 'path' argument is ignored -- it's
132 # We're only interested in the last path component of fullname
137 # package. Return the string representing its path,
146 def find_module(self, fullname, path=None):
147 """find_module(fullname, path=None) -> self or None.
152 The optional 'path' argument is ignored -- it's there for compatibility
160 return self.find_loader(fullname, path)[0]
174 # We're only interested in the last path component of fullname
179 # package. Return the string representing its path,
181 path = f'{self.archive}{path_sep}{modpath}'
184 spec.submodule_search_locations.append(path)
243 path = _get_module_path(self, fullname)
245 fullpath = _bootstrap_external._path_join(path, '__init__.py')
247 fullpath = f'{path}.py'
294 path = _get_module_path(self, fullname)
295 fullpath = _bootstrap_external._path_join(self.archive, path)
330 """Reload the file data of the archive path."""
355 # Given a module name, return the potential file path in the
360 # Does this path represent a directory?
361 def _is_dir(self, path):
364 # appended path separator, exists.
365 dirpath = path + path_sep
371 path = _get_module_path(self, fullname)
373 fullpath = path + suffix
383 # Given a path to a Zip archive, build a dict, mapping file names
405 raise ZipImportError(f"can't open Zip file: {archive!r}", path=archive)
418 raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
420 raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
429 path=archive)
437 path=archive)
441 path=archive)
445 path=archive)
451 raise ZipImportError(f'bad central directory size: {archive!r}', path=archive)
453 raise ZipImportError(f'bad central directory offset: {archive!r}', path=archive)
457 raise ZipImportError(f'bad central directory size or offset: {archive!r}', path=archive)
465 raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
488 raise ZipImportError(f'bad local header offset: {archive!r}', path=archive)
494 raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
496 raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
502 raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
504 raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
517 path = _bootstrap_external._path_join(archive, name)
518 t = (path, compress, data_size, file_size, file_offset, time, date, crc)
586 # Given a path to a Zip file and a toc_entry, return the (uncompressed) data.
597 raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
604 raise ZipImportError(f'bad local file header: {archive!r}', path=archive)
613 raise ZipImportError(f"can't read Zip file: {archive!r}", path=archive)
644 'path': fullpath,
709 # Given a path to a .pyc file in the archive, return the
712 def _get_mtime_and_size_of_source(self, path):
715 assert path[-1:] in ('c', 'o')
716 path = path[:-1]
717 toc_entry = self._files[path]
728 # Given a path to a .pyc file in the archive, return the
731 def _get_pyc_source(self, path):
733 assert path[-1:] in ('c', 'o')
734 path = path[:-1]
737 toc_entry = self._files[path]
747 path = _get_module_path(self, fullname)
750 fullpath = path + suffix