(self, name, value)
| 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 |
| 683 | # settable property then try to invoke the descriptor to set the attribute |
| 684 | # and return if successful. |
| 685 | klass_attr = getattr(type(self), name, None) |
| 686 | if klass_attr is not None: |
| 687 | try: |
| 688 | return klass_attr.__set__(self, value) |
| 689 | except AttributeError: |
| 690 | pass |
| 691 | # If we did not find a settable descriptor then we look in the attribute |
| 692 | # spec to see if there is a MuJoCo attribute matching this name. |
| 693 | attribute_name = name if name != constants.DCLASS else constants.CLASS |
| 694 | if attribute_name in self._spec.attributes: |
| 695 | self._set_attribute(attribute_name, value) |
| 696 | else: |
| 697 | raise AttributeError('can\'t set attribute: {}'.format(name)) |
| 698 | |
| 699 | def __delattr__(self, name): |
| 700 | if name in self._spec.children: |
nothing calls this directly
no test coverage detected