MCPcopy
hub / github.com/tox-dev/tox / _replace_ref

Method _replace_ref

src/tox/config/loader/toml/_replace.py:131–145  ·  view source on GitHub ↗
(self, value: dict[str, TomlTypes], depth: int, *, skip_str: bool = False)

Source from the content-addressed store, hash-verified

129 return value
130
131 def _replace_ref(self, value: dict[str, TomlTypes], depth: int, *, skip_str: bool = False) -> TomlTypes:
132 if self.conf is not None and (env := value.get("env")) and (key := value.get("key")):
133 result = self.conf.get_env(cast("str", env))[cast("str", key)]
134 if isinstance(result, Command):
135 return cast("TomlTypes", result.args)
136 return cast("TomlTypes", result)
137 if of := value.get("of"):
138 validated_of = validate(of, list[str])
139 loaded = self.loader.load_raw_from_root(self.loader.section.SEP.join(validated_of))
140 if self.conf is not None:
141 *namespace_parts, ref_key = validated_of
142 namespace = self.loader.section.SEP.join(namespace_parts)
143 loaded = apply_overrides_to_raw(self.conf.overrides.get(namespace, []), ref_key, loaded)
144 return self(loaded, depth, skip_str=skip_str)
145 return value
146
147
148def _replace_glob_toml(conf: Config | None, value: dict[str, Any]) -> list[str] | str:

Callers 1

__call__Method · 0.95

Calls 6

validateFunction · 0.90
apply_overrides_to_rawFunction · 0.90
getMethod · 0.80
get_envMethod · 0.80
load_raw_from_rootMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected