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

Function _update_env_key

demo/ai_scientists/packer/files/setup_server.py:23–31  ·  view source on GitHub ↗

Update a KEY=value line in the env file.

(filepath: str, key: str, value: str)

Source from the content-addressed store, hash-verified

21
22
23def _update_env_key(filepath: str, key: str, value: str) -> None:
24 """Update a KEY=value line in the env file."""
25 with open(filepath, "r") as f:
26 content = f.read()
27 pattern = rf"^{re.escape(key)}=.*$"
28 replacement = f"{key}={value}"
29 content = re.sub(pattern, replacement, content, flags=re.MULTILINE)
30 with open(filepath, "w") as f:
31 f.write(content)
32
33
34@app.route("/")

Callers 1

setupFunction · 0.85

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected