Yield directories starting from the given directory up to the root
(path: str)
| 312 | |
| 313 | |
| 314 | def _walk_to_root(path: str) -> Iterator[str]: |
| 315 | """ |
| 316 | Yield directories starting from the given directory up to the root |
| 317 | """ |
| 318 | if not os.path.exists(path): |
| 319 | raise IOError("Starting path not found") |
| 320 | |
| 321 | if os.path.isfile(path): |
| 322 | path = os.path.dirname(path) |
| 323 | |
| 324 | last_dir = None |
| 325 | current_dir = os.path.abspath(path) |
| 326 | while last_dir != current_dir: |
| 327 | yield current_dir |
| 328 | parent_dir = os.path.abspath(os.path.join(current_dir, os.path.pardir)) |
| 329 | last_dir, current_dir = current_dir, parent_dir |
| 330 | |
| 331 | |
| 332 | def find_dotenv( |
no outgoing calls
no test coverage detected
searching dependent graphs…