MCPcopy
hub / github.com/TaskingAI/TaskingAI / load_int_env

Function load_int_env

plugin/config.py:35–48  ·  view source on GitHub ↗

Load environment variable as int :param name: name of the environment variable :param required: whether the environment variable is required

(name: str, required: bool = False)

Source from the content-addressed store, hash-verified

33
34
35def load_int_env(name: str, required: bool = False) -> int:
36 """
37 Load environment variable as int
38 :param name: name of the environment variable
39 :param required: whether the environment variable is required
40 """
41 if os.environ.get(name):
42 return int(os.environ.get(name))
43
44 if default_env_values.get(name) is not None:
45 return default_env_values.get(name)
46
47 if required:
48 raise Exception(f"Env {name} is not set")
49
50
51class Config:

Callers 1

__init__Method · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected