MCPcopy Create free account
hub / github.com/theskumar/python-dotenv / _walk_to_root

Function _walk_to_root

src/dotenv/main.py:252–267  ·  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

250
251
252def _walk_to_root(path: str) -> Iterator[str]:
253 """
254 Yield directories starting from the given directory up to the root
255 """
256 if not os.path.exists(path):
257 raise IOError('Starting path not found')
258
259 if os.path.isfile(path):
260 path = os.path.dirname(path)
261
262 last_dir = None
263 current_dir = os.path.abspath(path)
264 while last_dir != current_dir:
265 yield current_dir
266 parent_dir = os.path.abspath(os.path.join(current_dir, os.path.pardir))
267 last_dir, current_dir = current_dir, parent_dir
268
269
270def find_dotenv(

Callers 1

find_dotenvFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected