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

Function get_config

codecarbon/cli/cli_utils.py:11–24  ·  view source on GitHub ↗
(path: Optional[Path] = None)

Source from the content-addressed store, hash-verified

9
10
11def get_config(path: Optional[Path] = None):
12 p = path or Path.cwd().resolve() / ".codecarbon.config"
13
14 if p.exists():
15 config = configparser.ConfigParser()
16 config.read(str(p))
17 if "codecarbon" in config.sections():
18 d = dict(config["codecarbon"])
19 return d
20
21 else:
22 raise FileNotFoundError(
23 "No .codecarbon.config file found in the current directory."
24 )
25
26
27def get_api_endpoint(path: Optional[Path] = None):

Callers 1

show_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…