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

Method __getattr__

dm_control/mjcf/element.py:663–679  ·  view source on GitHub ↗
(self, name)

Source from the content-addressed store, hash-verified

661 return new_element
662
663 def __getattr__(self, name):
664 if self._last_attribute_error:
665 # This means that we got here through a @property raising AttributeError.
666 # We therefore just re-raise the last AttributeError back to the user.
667 # Note that self._last_attribute_error was set by our specially
668 # instrumented @property decorator.
669 exc = self._last_attribute_error
670 self._last_attribute_error = None
671 raise exc # pylint: disable=raising-bad-type
672 elif name in self._spec.children:
673 return self.get_children(name)
674 elif name in self._spec.attributes:
675 return self._get_attribute(name)
676 elif name == constants.DCLASS and constants.CLASS in self._spec.attributes:
677 return self._get_attribute(constants.CLASS)
678 else:
679 raise AttributeError('object has no attribute: {}'.format(name))
680
681 def __setattr__(self, name, value):
682 # If this name corresponds to a descriptor for a slotted attribute or

Callers

nothing calls this directly

Calls 2

get_childrenMethod · 0.95
_get_attributeMethod · 0.95

Tested by

no test coverage detected