Return a list of paths matching a `pathname` pattern. The pattern may contain simple shell-style wildcards a la fnmatch. Unlike fnmatch, filenames starting with a dot are special cases that are not matched by '*' and '?' patterns by default. The order of the returned list is un
(pathname, *, root_dir=None, dir_fd=None, recursive=False,
include_hidden=False)
| 14 | __all__ = ["glob", "iglob", "escape", "translate"] |
| 15 | |
| 16 | def glob(pathname, *, root_dir=None, dir_fd=None, recursive=False, |
| 17 | include_hidden=False): |
| 18 | """Return a list of paths matching a `pathname` pattern. |
| 19 | |
| 20 | The pattern may contain simple shell-style wildcards a la |
| 21 | fnmatch. Unlike fnmatch, filenames starting with a |
| 22 | dot are special cases that are not matched by '*' and '?' |
| 23 | patterns by default. |
| 24 | |
| 25 | The order of the returned list is undefined. Sort it if you need a |
| 26 | particular order. |
| 27 | |
| 28 | If `root_dir` is not None, it should be a path-like object specifying the |
| 29 | root directory for searching. It has the same effect as changing the |
| 30 | current directory before calling it (without actually |
| 31 | changing it). If pathname is relative, the result will contain |
| 32 | paths relative to `root_dir`. |
| 33 | |
| 34 | If `dir_fd` is not None, it should be a file descriptor referring to a |
| 35 | directory, and paths will then be relative to that directory. |
| 36 | |
| 37 | If `include_hidden` is true, the patterns '*', '?', '**' will match hidden |
| 38 | directories. |
| 39 | |
| 40 | If `recursive` is true, the pattern '**' will match any files and |
| 41 | zero or more directories and subdirectories. |
| 42 | """ |
| 43 | return list(iglob(pathname, root_dir=root_dir, dir_fd=dir_fd, recursive=recursive, |
| 44 | include_hidden=include_hidden)) |
| 45 | |
| 46 | def iglob(pathname, *, root_dir=None, dir_fd=None, recursive=False, |
| 47 | include_hidden=False): |
no test coverage detected
searching dependent graphs…