MCPcopy Index your code
hub / github.com/theskumar/python-dotenv / _walk_to_root

Function _walk_to_root

src/dotenv/main.py:314–329  ·  view source on GitHub ↗

Yield directories starting from the given directory up to the root

(path: str)

Source from the content-addressed store, hash-verified

312
313
314def _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
332def find_dotenv(

Callers 1

find_dotenvFunction · 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…