Lines Matching refs:path
527 filename should be the path to a file or directory on the filesystem.
531 leading path separators removed).
546 arcname = os.path.normpath(os.path.splitdrive(arcname)[1])
1228 file: Either the path to the file, or a file-like object.
1229 If it is a path, the file will be opened and closed by ZipFile.
1666 def extract(self, member, path=None, pwd=None):
1670 specify a different directory using `path'.
1672 if path is None:
1673 path = os.getcwd()
1675 path = os.fspath(path)
1677 return self._extract_member(member, path, pwd)
1679 def extractall(self, path=None, members=None, pwd=None):
1681 directory. `path' specifies a different directory to extract to.
1688 if path is None:
1689 path = os.getcwd()
1691 path = os.fspath(path)
1694 self._extract_member(zipinfo, path, pwd)
1713 file on the path targetpath.
1720 arcname = member.filename.replace('/', os.path.sep)
1722 if os.path.altsep:
1723 arcname = arcname.replace(os.path.altsep, os.path.sep)
1725 # UNC path, redundant separators, "." and ".." components.
1726 arcname = os.path.splitdrive(arcname)[1]
1727 invalid_path_parts = ('', os.path.curdir, os.path.pardir)
1728 arcname = os.path.sep.join(x for x in arcname.split(os.path.sep)
1730 if os.path.sep == '\\':
1732 arcname = self._sanitize_windows_name(arcname, os.path.sep)
1734 targetpath = os.path.join(targetpath, arcname)
1735 targetpath = os.path.normpath(targetpath)
1738 upperdirs = os.path.dirname(targetpath)
1739 if upperdirs and not os.path.exists(upperdirs):
1743 if not os.path.isdir(targetpath):
2038 label = 'path' if os.path.isdir(pathname) else 'file'
2041 dir, name = os.path.split(pathname)
2042 if os.path.isdir(pathname):
2043 initname = os.path.join(pathname, "__init__.py")
2044 if os.path.isfile(initname):
2060 path = os.path.join(pathname, filename)
2061 root, ext = os.path.splitext(filename)
2062 if os.path.isdir(path):
2063 if os.path.isfile(os.path.join(path, "__init__.py")):
2065 self.writepy(path, basename,
2068 if filterfunc and not filterfunc(path):
2070 print('file %r skipped by filterfunc' % path)
2072 fname, arcname = self._get_codename(path[0:-3],
2082 path = os.path.join(pathname, filename)
2083 root, ext = os.path.splitext(filename)
2085 if filterfunc and not filterfunc(path):
2087 print('file %r skipped by filterfunc' % path)
2089 fname, arcname = self._get_codename(path[0:-3],
2104 """Return (filename, archivename) for the path.
2106 Given a module name path, return the correct file path and
2128 if (os.path.isfile(file_pyc) and
2132 elif (os.path.isfile(pycache_opt0) and
2138 elif (os.path.isfile(pycache_opt1) and
2144 elif (os.path.isfile(pycache_opt2) and
2176 if not (os.path.isfile(fname) and
2180 archivename = os.path.split(arcname)[1]
2186 def _parents(path):
2188 Given a path with elements separated by
2189 posixpath.sep, generate all parents of that path.
2202 return itertools.islice(_ancestry(path), 1, None)
2205 def _ancestry(path):
2207 Given a path with elements separated by
2208 posixpath.sep, generate all elements of that path
2221 path = path.rstrip(posixpath.sep)
2222 while path and path != posixpath.sep:
2223 yield path
2224 path, tail = posixpath.split(path)
2250 Ensure a relative path with posix separators and no dot names.
2405 From there, several path operations are available.
2523 def _is_child(self, path):
2524 return posixpath.dirname(path.at.rstrip("/")) == self.at.rstrip("/")
2615 def addToZip(zf, path, zippath):
2616 if os.path.isfile(path):
2617 zf.write(path, zippath, ZIP_DEFLATED)
2618 elif os.path.isdir(path):
2620 zf.write(path, zippath)
2621 for nm in sorted(os.listdir(path)):
2623 os.path.join(path, nm), os.path.join(zippath, nm))
2627 for path in files:
2628 zippath = os.path.basename(path)
2630 zippath = os.path.basename(os.path.dirname(path))
2633 addToZip(zf, path, zippath)