MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / _sync_attributes

Method _sync_attributes

dm_control/mjcf/element.py:942–958  ·  view source on GitHub ↗
(self, other, copying)

Source from the content-addressed store, hash-verified

940 other_attribute))
941
942 def _sync_attributes(self, other, copying):
943 self._check_conflicting_attributes(other, copying)
944 for attribute_name, other_attribute in other.get_attributes().items():
945 if attribute_name == constants.DCLASS:
946 attribute_name = constants.CLASS
947
948 self_attribute = self._attributes[attribute_name]
949 if other_attribute is not None:
950 if self_attribute.conflict_behavior in _CONFLICT_BEHAVIOR_FUNC:
951 if self_attribute.value is not None:
952 self_attribute.value = (
953 _CONFLICT_BEHAVIOR_FUNC[self_attribute.conflict_behavior](
954 self_attribute.value, other_attribute))
955 else:
956 self_attribute.value = other_attribute
957 elif copying or not self_attribute.conflict_allowed:
958 self_attribute.value = other_attribute
959
960 def _attach_children(self, other, exclude_worldbody, dry_run=False):
961 for other_child in other.all_children():

Callers 2

_attachMethod · 0.95
copy_intoMethod · 0.80

Calls 3

itemsMethod · 0.80
get_attributesMethod · 0.45

Tested by

no test coverage detected