Lines Matching refs:pathname
13 def glob(pathname, *, root_dir=None, dir_fd=None, recursive=False,
15 """Return a list of paths matching a pathname pattern.
28 return list(iglob(pathname, root_dir=root_dir, dir_fd=dir_fd, recursive=recursive,
31 def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False,
33 """Return an iterator which yields the paths matching a pathname pattern.
43 sys.audit("glob.glob", pathname, recursive)
44 sys.audit("glob.glob/2", pathname, recursive, root_dir, dir_fd)
48 root_dir = pathname[:0]
49 it = _iglob(pathname, root_dir, dir_fd, recursive, False,
51 if not pathname or recursive and _isrecursive(pathname[:2]):
60 def _iglob(pathname, root_dir, dir_fd, recursive, dironly,
62 dirname, basename = os.path.split(pathname)
63 if not has_magic(pathname):
66 if _lexists(_join(root_dir, pathname), dir_fd):
67 yield pathname
71 yield pathname
84 if dirname != pathname and has_magic(dirname):
191 def _lexists(pathname, dir_fd):
194 return os.path.lexists(pathname)
196 os.lstat(pathname, dir_fd=dir_fd)
202 def _isdir(pathname, dir_fd):
205 return os.path.isdir(pathname)
207 st = os.stat(pathname, dir_fd=dir_fd)
238 def escape(pathname):
243 drive, pathname = os.path.splitdrive(pathname)
244 if isinstance(pathname, bytes):
245 pathname = magic_check_bytes.sub(br'[\1]', pathname)
247 pathname = magic_check.sub(r'[\1]', pathname)
248 return drive + pathname