MCPcopy Create free account
hub / github.com/base/base / read_optional

Function read_optional

etc/scripts/local/docs-index.py:266–268  ·  view source on GitHub ↗

Read a text file, returning '' if it does not exist.

(path: Path)

Source from the content-addressed store, hash-verified

264
265
266def read_optional(path: Path) -> str:
267 """Read a text file, returning '' if it does not exist."""
268 return path.read_text(encoding="utf-8") if path.exists() else ""
269
270
271def load_manifest(root: Path) -> list[Entry]:

Callers 2

write_outputsFunction · 0.85
stale_outputsFunction · 0.85

Calls 1

existsMethod · 0.45

Tested by

no test coverage detected