MCPcopy Index your code
hub / github.com/python/cpython / glob

Method glob

Lib/pathlib/types.py:327–341  ·  view source on GitHub ↗

Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern.

(self, pattern, *, recurse_symlinks=True)

Source from the content-addressed store, hash-verified

325 raise NotImplementedError
326
327 def glob(self, pattern, *, recurse_symlinks=True):
328 """Iterate over this subtree and yield all existing files (of any
329 kind, including directories) matching the given relative pattern.
330 """
331 anchor, parts = _explode_path(pattern, self.parser.split)
332 if anchor:
333 raise NotImplementedError("Non-relative patterns are unsupported")
334 elif not parts:
335 raise ValueError(f"Unacceptable pattern: {pattern!r}")
336 elif not recurse_symlinks:
337 raise NotImplementedError("recurse_symlinks=False is unsupported")
338 case_sensitive = self.parser.normcase('Aa') == 'Aa'
339 globber = _PathGlobber(self.parser.sep, case_sensitive, recursive=True)
340 select = globber.selector(parts)
341 return select(self.joinpath(''))
342
343 def walk(self, top_down=True, on_error=None, follow_symlinks=False):
344 """Walk the directory tree from this directory, similar to os.walk()."""

Callers

nothing calls this directly

Calls 6

_explode_pathFunction · 0.85
_PathGlobberClass · 0.85
normcaseMethod · 0.80
selectorMethod · 0.80
selectFunction · 0.50
joinpathMethod · 0.45

Tested by

no test coverage detected