MCPcopy Create free account
hub / github.com/scanny/python-pptx / ElementProxy

Class ElementProxy

src/pptx/shared.py:13–43  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

11
12
13class 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
46class ParentedElementProxy(ElementProxy):

Callers 2

element_fixtureMethod · 0.90
eq_fixtureMethod · 0.90

Calls

no outgoing calls

Tested by 2

element_fixtureMethod · 0.72
eq_fixtureMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…