MCPcopy Create free account
hub / github.com/mlco2/codecarbon / overwrite_local_config

Function overwrite_local_config

codecarbon/cli/cli_utils.py:69–80  ·  view source on GitHub ↗
(config_name, value, path: Optional[Path] = None)

Source from the content-addressed store, hash-verified

67
68
69def overwrite_local_config(config_name, value, path: Optional[Path] = None):
70 p = path or Path.cwd().resolve() / ".codecarbon.config"
71
72 config = configparser.ConfigParser()
73 if p.exists():
74 config.read(str(p))
75 if "codecarbon" not in config.sections():
76 config.add_section("codecarbon")
77
78 config["codecarbon"][config_name] = value
79 with p.open("w") as f:
80 config.write(f)
81
82
83def create_new_config_file():

Callers 1

configFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…