MCPcopy Create free account
hub / github.com/ashleve/rootutils / _rootutils_recursive_search

Function _rootutils_recursive_search

rootutils/rootutils.py:9–27  ·  view source on GitHub ↗

Recursively search for files from the `indicators` list, starting from given path. Args: path (Path): Starting folder path. indicators (Iterable[str]): List of filenames to search for. Returns: Optional[Path]: Path to folder containing at list one of the files from

(path: Path, indicators: Iterable[str])

Source from the content-addressed store, hash-verified

7
8
9def _rootutils_recursive_search(path: Path, indicators: Iterable[str]) -> Optional[Path]:
10 """Recursively search for files from the `indicators` list, starting from given path.
11
12 Args:
13 path (Path): Starting folder path.
14 indicators (Iterable[str]): List of filenames to search for.
15
16 Returns:
17 Optional[Path]: Path to folder containing at list one of the files from the list.
18 """
19 for file in indicators:
20 found = list(path.glob(file))
21 if len(found) > 0:
22 return path
23
24 if path.parent == path:
25 return None
26
27 return _rootutils_recursive_search(path.parent, indicators)
28
29
30def find_root(

Callers 1

find_rootFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…