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

Method construct_mapping

monai/utils/misc.py:771–781  ·  view source on GitHub ↗
(self, node, deep=False)

Source from the content-addressed store, hash-verified

769class CheckKeyDuplicatesYamlLoader(SafeLoader):
770
771 def construct_mapping(self, node, deep=False):
772 mapping = set()
773 for key_node, _ in node.value:
774 key = self.construct_object(key_node, deep=deep)
775 if key in mapping:
776 if os.environ.get("MONAI_FAIL_ON_DUPLICATE_CONFIG", "0") == "1":
777 raise ValueError(f"Duplicate key: `{key}`")
778 else:
779 warnings.warn(f"Duplicate key: `{key}`")
780 mapping.add(key)
781 return super().construct_mapping(node, deep)
782
783
784class ConvertUnits:

Callers

nothing calls this directly

Calls 2

getMethod · 0.80
addMethod · 0.80

Tested by

no test coverage detected