MCPcopy Index your code
hub / github.com/RustPython/RustPython / iglob

Function iglob

Lib/glob.py:37–67  ·  view source on GitHub ↗

Return an iterator which yields the paths matching a pathname pattern. The pattern may contain simple shell-style wildcards a la fnmatch. However, unlike fnmatch, filenames starting with a dot are special cases that are not matched by '*' and '?' patterns. The order of the retu

(pathname, *, root_dir=None, dir_fd=None, recursive=False,
          include_hidden=False)

Source from the content-addressed store, hash-verified

35 include_hidden=include_hidden))
36
37def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False,
38 include_hidden=False):
39 """Return an iterator which yields the paths matching a pathname pattern.
40
41 The pattern may contain simple shell-style wildcards a la
42 fnmatch. However, unlike fnmatch, filenames starting with a
43 dot are special cases that are not matched by '*' and '?'
44 patterns.
45
46 The order of the returned paths is undefined. Sort them if you need a
47 particular order.
48
49 If recursive is true, the pattern '**' will match any files and
50 zero or more directories and subdirectories.
51 """
52 sys.audit("glob.glob", pathname, recursive)
53 sys.audit("glob.glob/2", pathname, recursive, root_dir, dir_fd)
54 if root_dir is not None:
55 root_dir = os.fspath(root_dir)
56 else:
57 root_dir = pathname[:0]
58 it = _iglob(pathname, root_dir, dir_fd, recursive, False,
59 include_hidden=include_hidden)
60 if not pathname or recursive and _isrecursive(pathname[:2]):
61 try:
62 s = next(it) # skip empty string
63 if s:
64 it = itertools.chain((s,), it)
65 except StopIteration:
66 pass
67 return it
68
69def _iglob(pathname, root_dir, dir_fd, recursive, dironly,
70 include_hidden=False):

Callers 1

globFunction · 0.85

Calls 4

_iglobFunction · 0.85
_isrecursiveFunction · 0.85
nextFunction · 0.85
chainMethod · 0.80

Tested by

no test coverage detected