MCPcopy Index your code
hub / github.com/theskumar/python-dotenv / resolve_variables

Function resolve_variables

src/dotenv/main.py:289–311  ·  view source on GitHub ↗
(
    values: Iterable[Tuple[str, Optional[str]]],
    override: bool,
)

Source from the content-addressed store, hash-verified

287
288
289def resolve_variables(
290 values: Iterable[Tuple[str, Optional[str]]],
291 override: bool,
292) -> Mapping[str, Optional[str]]:
293 new_values: Dict[str, Optional[str]] = {}
294
295 for name, value in values:
296 if value is None:
297 result = None
298 else:
299 atoms = parse_variables(value)
300 env: Dict[str, Optional[str]] = {}
301 if override:
302 env.update(os.environ) # type: ignore
303 env.update(new_values)
304 else:
305 env.update(new_values)
306 env.update(os.environ) # type: ignore
307 result = "".join(atom.resolve(env) for atom in atoms)
308
309 new_values[name] = result
310
311 return new_values
312
313
314def _walk_to_root(path: str) -> Iterator[str]:

Callers 1

dictMethod · 0.85

Calls 2

parse_variablesFunction · 0.85
resolveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…