MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / _wrap_parsed

Function _wrap_parsed

monai/bundle/config_parser.py:44–59  ·  view source on GitHub ↗

Wrap a parsed dict/list in a :class:`_ConfigProxy` so nested access keeps chaining; pass scalars through. Args: parser: the owning :class:`ConfigParser`, used to resolve chained ids. id: the ``::``-separated id that produced ``value``. value: the parsed content to w

(parser: ConfigParser, id: str, value: Any)

Source from the content-addressed store, hash-verified

42
43
44def _wrap_parsed(parser: ConfigParser, id: str, value: Any) -> Any:
45 """
46 Wrap a parsed dict/list in a :class:`_ConfigProxy` so nested access keeps chaining; pass scalars through.
47
48 Args:
49 parser: the owning :class:`ConfigParser`, used to resolve chained ids.
50 id: the ``::``-separated id that produced ``value``.
51 value: the parsed content to wrap.
52
53 Returns:
54 A :class:`_ConfigProxy` wrapping ``value`` if it is a ``dict`` or ``list``,
55 otherwise ``value`` unchanged.
56 """
57 if isinstance(value, (dict, list)):
58 return _ConfigProxy(parser, id, value)
59 return value
60
61
62class _ConfigProxy:

Callers 2

_chainMethod · 0.85
__getattr__Method · 0.85

Calls 1

_ConfigProxyClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…