MCPcopy Create free account
hub / github.com/PolymathicAI/AstroCLIP / format_with_env

Function format_with_env

astroclip/env.py:50–62  ·  view source on GitHub ↗
(s: T)

Source from the content-addressed store, hash-verified

48
49
50def format_with_env(s: T) -> T:
51 if isinstance(s, str):
52 for k, v in default_dotenv_values().items():
53 s = s.replace("{" + k + "}", v)
54 return s
55 elif isinstance(s, dict):
56 return {k: format_with_env(v) for k, v in s.items()}
57 elif isinstance(s, list):
58 return [format_with_env(v) for v in s]
59 elif isinstance(s, Namespace):
60 return type(s)(**{k: format_with_env(v) for k, v in s.__dict__.items()})
61 else:
62 return s

Callers 11

trainer.pyFile · 0.90
do_trainFunction · 0.90
cross_match.pyFile · 0.90
embed_provabgs.pyFile · 0.90
modules.pyFile · 0.90
trainer.pyFile · 0.90
cross_match.pyFile · 0.90
embed_astroclip.pyFile · 0.90

Calls 1

default_dotenv_valuesFunction · 0.85

Tested by

no test coverage detected