MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / _load_env_file

Function _load_env_file

verifier/AgentVerifier/WorkflowToLean.py:307–321  ·  view source on GitHub ↗

Load KEY=VALUE pairs from an env file into os.environ.

(env_path: str)

Source from the content-addressed store, hash-verified

305
306
307def _load_env_file(env_path: str) -> None:
308 """Load KEY=VALUE pairs from an env file into os.environ."""
309 with open(env_path, "r", encoding="utf-8") as f:
310 for line in f:
311 line = line.strip()
312 if not line or line.startswith("#"):
313 continue
314 if "=" not in line:
315 continue
316 key, _, val = line.partition("=")
317 key = key.strip()
318 val = val.strip()
319 if len(val) >= 2 and val[0] == val[-1] and val[0] in ('"', "'"):
320 val = val[1:-1]
321 os.environ[key] = val
322
323
324def _resolve_env_vars(value):

Callers 2

mainFunction · 0.90
WorkflowToLean.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected