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

Function stream_file

src/dotenv/cli.py:68–80  ·  view source on GitHub ↗

Open a file and yield the corresponding (decoded) stream. Exits with error code 2 if the file cannot be opened.

(path: os.PathLike)

Source from the content-addressed store, hash-verified

66
67@contextmanager
68def stream_file(path: os.PathLike) -> Iterator[IO[str]]:
69 """
70 Open a file and yield the corresponding (decoded) stream.
71
72 Exits with error code 2 if the file cannot be opened.
73 """
74
75 try:
76 with open(path) as stream:
77 yield stream
78 except OSError as exc:
79 print(f"Error opening env file: {exc}", file=sys.stderr)
80 sys.exit(2)
81
82
83@cli.command(name="list")

Callers 2

list_valuesFunction · 0.85
getFunction · 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…