MCPcopy
hub / github.com/pytest-dev/pytest-xdist / visit_path

Function visit_path

src/xdist/_path.py:8–20  ·  view source on GitHub ↗

Implements the interface of ``py.path.local.visit()`` for Path objects, to simplify porting the code over from ``py.path.local``.

(
    path: Path, *, filter: Callable[[Path], bool], recurse: Callable[[Path], bool]
)

Source from the content-addressed store, hash-verified

6
7
8def visit_path(
9 path: Path, *, filter: Callable[[Path], bool], recurse: Callable[[Path], bool]
10) -> Iterator[Path]:
11 """
12 Implements the interface of ``py.path.local.visit()`` for Path objects,
13 to simplify porting the code over from ``py.path.local``.
14 """
15 for dirpath, dirnames, filenames in os.walk(path):
16 dirnames[:] = [x for x in dirnames if recurse(Path(dirpath, x))]
17 for name in chain(dirnames, filenames):
18 p = Path(dirpath, name)
19 if filter(p):
20 yield p

Callers 2

checkMethod · 0.90
test_hrsync_filterMethod · 0.90

Calls

no outgoing calls

Tested by 1

test_hrsync_filterMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…