MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / _resolve_value

Method _resolve_value

utils/vars_resolver.py:35–47  ·  view source on GitHub ↗
(self, value: Any, path: str, *, stack: Sequence[str])

Source from the content-addressed store, hash-verified

33 return data
34
35 def _resolve_value(self, value: Any, path: str, *, stack: Sequence[str]) -> Any:
36 if isinstance(value, str):
37 return self._resolve_string(value, path, stack)
38 if isinstance(value, list):
39 for idx, item in enumerate(value):
40 value[idx] = self._resolve_value(item, extend_path(path, f"[{idx}]"), stack=stack)
41 return value
42 if isinstance(value, MutableMapping):
43 for key in list(value.keys()):
44 child_path = extend_path(path, str(key))
45 value[key] = self._resolve_value(value[key], child_path, stack=stack)
46 return value
47 return value
48
49 def _resolve_string(self, raw: str, path: str, stack: Sequence[str]) -> Any:
50 only_match = _PLACEHOLDER_ONLY_PATTERN.fullmatch(raw)

Callers 2

resolveMethod · 0.95
_lookupMethod · 0.95

Calls 2

_resolve_stringMethod · 0.95
extend_pathFunction · 0.90

Tested by

no test coverage detected