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

Method get_children

dm_control/mjcf/element.py:599–614  ·  view source on GitHub ↗
(self, element_name)

Source from the content-addressed store, hash-verified

597 .format(element_name, self._spec.name))
598
599 def get_children(self, element_name):
600 child_spec = self._check_valid_child(element_name)
601 if child_spec.repeated:
602 return _ElementListView(spec=child_spec, parent=self)
603 else:
604 for child in self._children:
605 if child.tag == element_name:
606 return child
607 if child_spec.on_demand:
608 return None
609 else:
610 raise RuntimeError(
611 'Cannot find the non-repeated child <{}> of <{}>. '
612 'This should never happen, as we pre-create these in __init__. '
613 'Please file an bug report. Thank you.'
614 .format(element_name, self._spec.name))
615
616 def add(self, element_name, **kwargs):
617 """Add a new child element to this element.

Callers 5

_has_same_children_asMethod · 0.95
insertMethod · 0.95
__getattr__Method · 0.95
__delattr__Method · 0.95
_attach_childrenMethod · 0.95

Calls 2

_check_valid_childMethod · 0.95
_ElementListViewClass · 0.85

Tested by

no test coverage detected