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

Method _eq_elm_strs

src/pptx/oxml/xmlchemy.py:90–105  ·  view source on GitHub ↗

True if the element in `line_2` is XML-equivalent to the element in `line`. In particular, the order of attributes in XML is not significant.

(self, line: str, line_2: str)

Source from the content-addressed store, hash-verified

88 return sorted(attr_lst)
89
90 def _eq_elm_strs(self, line: str, line_2: str) -> bool:
91 """True if the element in `line_2` is XML-equivalent to the element in `line`.
92
93 In particular, the order of attributes in XML is not significant.
94 """
95 front, attrs, close, text = self._parse_line(line)
96 front_2, attrs_2, close_2, text_2 = self._parse_line(line_2)
97 if front != front_2:
98 return False
99 if self._attr_seq(attrs) != self._attr_seq(attrs_2):
100 return False
101 if close != close_2:
102 return False
103 if text != text_2:
104 return False
105 return True
106
107 def _parse_line(self, line: str):
108 """Return front, attrs, close, text 4-tuple result of parsing XML element string `line`."""

Callers 1

__eq__Method · 0.95

Calls 2

_parse_lineMethod · 0.95
_attr_seqMethod · 0.95

Tested by

no test coverage detected