(self, **kwargs)
| 563 | self.namescope.increment_revision() |
| 564 | |
| 565 | def set_attributes(self, **kwargs): |
| 566 | if constants.DCLASS in kwargs: |
| 567 | kwargs[constants.CLASS] = kwargs[constants.DCLASS] |
| 568 | del kwargs[constants.DCLASS] |
| 569 | old_values = [] |
| 570 | with debugging.freeze_current_stack_trace(): |
| 571 | for attribute_name, new_value in kwargs.items(): |
| 572 | old_value = self._get_attribute(attribute_name) |
| 573 | try: |
| 574 | self._set_attribute(attribute_name, new_value) |
| 575 | old_values.append((attribute_name, old_value)) |
| 576 | except: |
| 577 | # On failure, restore old attribute values for those already set. |
| 578 | for name, old_value in old_values: |
| 579 | self._set_attribute(name, old_value) |
| 580 | # Then raise a meaningful error. |
| 581 | err_type, err, tb = sys.exc_info() |
| 582 | raise err_type( # pylint: disable=raise-missing-from |
| 583 | f'during assignment to attribute {attribute_name!r} of ' |
| 584 | f'element <{self._spec.name}>: {err}').with_traceback(tb) |
| 585 | |
| 586 | def _remove_attribute(self, attribute_name): |
| 587 | self._check_valid_attribute(attribute_name) |
nothing calls this directly
no test coverage detected