(root, pattern, condition)
| 68 | |
| 69 | |
| 70 | def _rglob(root, pattern, condition): |
| 71 | dirs = [root] |
| 72 | recurse = pattern[:3] in {"**/", "**\\"} |
| 73 | if recurse: |
| 74 | pattern = pattern[3:] |
| 75 | |
| 76 | while dirs: |
| 77 | d = dirs.pop(0) |
| 78 | if recurse: |
| 79 | dirs.extend( |
| 80 | filter( |
| 81 | condition, (type(root)(f2) for f2 in os.scandir(d) if f2.is_dir()) |
| 82 | ) |
| 83 | ) |
| 84 | yield from ( |
| 85 | (f.relative_to(root), f) |
| 86 | for f in d.glob(pattern) |
| 87 | if f.is_file() and condition(f) |
| 88 | ) |
| 89 | |
| 90 | |
| 91 | def _return_true(f): |
no test coverage detected
searching dependent graphs…