Base class for lxml element proxy classes. An element proxy class is one whose primary responsibilities are fulfilled by manipulating the attributes and child elements of an XML element. They are the most common type of class in python-pptx other than custom element (oxml) classes.
| 11 | |
| 12 | |
| 13 | class ElementProxy(object): |
| 14 | """Base class for lxml element proxy classes. |
| 15 | |
| 16 | An element proxy class is one whose primary responsibilities are fulfilled by manipulating the |
| 17 | attributes and child elements of an XML element. They are the most common type of class in |
| 18 | python-pptx other than custom element (oxml) classes. |
| 19 | """ |
| 20 | |
| 21 | def __init__(self, element: BaseOxmlElement): |
| 22 | self._element = element |
| 23 | |
| 24 | def __eq__(self, other: object) -> bool: |
| 25 | """Return |True| if this proxy object refers to the same oxml element as does *other*. |
| 26 | |
| 27 | ElementProxy objects are value objects and should maintain no mutable local state. |
| 28 | Equality for proxy objects is defined as referring to the same XML element, whether or not |
| 29 | they are the same proxy object instance. |
| 30 | """ |
| 31 | if not isinstance(other, ElementProxy): |
| 32 | return False |
| 33 | return self._element is other._element |
| 34 | |
| 35 | def __ne__(self, other: object) -> bool: |
| 36 | if not isinstance(other, ElementProxy): |
| 37 | return True |
| 38 | return self._element is not other._element |
| 39 | |
| 40 | @property |
| 41 | def element(self): |
| 42 | """The lxml element proxied by this object.""" |
| 43 | return self._element |
| 44 | |
| 45 | |
| 46 | class ParentedElementProxy(ElementProxy): |
no outgoing calls
searching dependent graphs…