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

Method iter_subconfigs

monai/bundle/reference_resolver.py:247–257  ·  view source on GitHub ↗

Iterate over the sub-configs of the input config, the output `sub_id` uses `cls.sep` to denote substructure. Args: id: id string of the current input config. config: input config to be iterated.

(cls, id: str, config: Any)

Source from the content-addressed store, hash-verified

245
246 @classmethod
247 def iter_subconfigs(cls, id: str, config: Any) -> Iterator[tuple[str, str, Any]]:
248 """
249 Iterate over the sub-configs of the input config, the output `sub_id` uses `cls.sep` to denote substructure.
250
251 Args:
252 id: id string of the current input config.
253 config: input config to be iterated.
254 """
255 for k, v in config.items() if isinstance(config, dict) else enumerate(config):
256 sub_id = f"{id}{cls.sep}{k}" if id != "" else f"{k}"
257 yield k, sub_id, v
258
259 @classmethod
260 def match_refs_pattern(cls, value: str) -> dict[str, int]:

Callers 4

find_refs_in_configMethod · 0.80
_do_resolveMethod · 0.80
_do_parseMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected