MCPcopy Index your code
hub / github.com/python/cpython / open_dir_fd

Function open_dir_fd

Lib/test/support/os_helper.py:609–619  ·  view source on GitHub ↗

Open a file descriptor to a directory.

(path)

Source from the content-addressed store, hash-verified

607
608@contextlib.contextmanager
609def open_dir_fd(path):
610 """Open a file descriptor to a directory."""
611 assert os.path.isdir(path)
612 flags = os.O_RDONLY
613 if hasattr(os, "O_DIRECTORY"):
614 flags |= os.O_DIRECTORY
615 dir_fd = os.open(path, flags)
616 try:
617 yield dir_fd
618 finally:
619 os.close(dir_fd)
620
621
622def fs_is_case_insensitive(directory):

Callers

nothing calls this directly

Calls 3

isdirMethod · 0.45
openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…