Removes this element from the model.
(self, affect_attachments=False)
| 719 | child._check_attachments_on_remove(affect_attachments) # pylint: disable=protected-access |
| 720 | |
| 721 | def remove(self, affect_attachments=False): |
| 722 | """Removes this element from the model.""" |
| 723 | self._check_attachments_on_remove(affect_attachments) |
| 724 | if affect_attachments: |
| 725 | for attachment in self._attachments.values(): |
| 726 | attachment.remove(affect_attachments=True) |
| 727 | for child in list(self._children): |
| 728 | child.remove(affect_attachments) |
| 729 | if self._spec.repeated or self._spec.on_demand: |
| 730 | self._parent._children.remove(self) # pylint: disable=protected-access |
| 731 | for attribute in self._attributes.values(): |
| 732 | attribute._force_clear() # pylint: disable=protected-access |
| 733 | self._parent = None |
| 734 | self._is_removed = True |
| 735 | else: |
| 736 | for attribute in self._attributes.values(): |
| 737 | attribute._force_clear() # pylint: disable=protected-access |
| 738 | self.namescope.increment_revision() |
| 739 | |
| 740 | @property |
| 741 | def is_removed(self): |
no test coverage detected