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

Function upsert

scripts/setup_discord.py:99–102  ·  view source on GitHub ↗
(key: str, value: str, text: str)

Source from the content-addressed store, hash-verified

97 content = VM_ENV_PATH.read_text() if VM_ENV_PATH.exists() else ""
98
99 def upsert(key: str, value: str, text: str) -> str:
100 if f"{key}=" in text:
101 return re.sub(rf"{key}=.*", f"{key}={value}", text)
102 return text + f"\n{key}={value}"
103
104 content = upsert("DISCORD_BOT_TOKEN", token, content)
105 if slash_command:

Callers 1

update_vm_envFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected