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])
| 7 | |
| 8 | |
| 9 | def _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 | |
| 30 | def find_root( |
no outgoing calls
no test coverage detected
searching dependent graphs…