lxml 5.2.0__cp310-cp310-win32.whl → 5.2.2__cp310-cp310-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. lxml/ElementInclude.py +244 -244
  2. lxml/__init__.py +22 -22
  3. lxml/_elementpath.cp310-win32.pyd +0 -0
  4. lxml/_elementpath.py +341 -341
  5. lxml/apihelpers.pxi +1793 -1793
  6. lxml/builder.cp310-win32.pyd +0 -0
  7. lxml/builder.py +232 -232
  8. lxml/classlookup.pxi +580 -580
  9. lxml/cleanup.pxi +215 -215
  10. lxml/cssselect.py +101 -101
  11. lxml/debug.pxi +90 -90
  12. lxml/docloader.pxi +178 -178
  13. lxml/doctestcompare.py +488 -488
  14. lxml/dtd.pxi +478 -478
  15. lxml/etree.cp310-win32.pyd +0 -0
  16. lxml/etree.h +6 -6
  17. lxml/etree.pyx +3732 -3711
  18. lxml/extensions.pxi +833 -833
  19. lxml/html/ElementSoup.py +10 -10
  20. lxml/html/__init__.py +1923 -1923
  21. lxml/html/_diffcommand.py +86 -86
  22. lxml/html/_html5builder.py +100 -100
  23. lxml/html/_setmixin.py +56 -56
  24. lxml/html/builder.py +133 -133
  25. lxml/html/clean.py +21 -21
  26. lxml/html/defs.py +135 -135
  27. lxml/html/diff.cp310-win32.pyd +0 -0
  28. lxml/html/diff.py +878 -878
  29. lxml/html/formfill.py +299 -299
  30. lxml/html/html5parser.py +260 -260
  31. lxml/html/soupparser.py +314 -314
  32. lxml/html/usedoctest.py +13 -13
  33. lxml/includes/c14n.pxd +25 -25
  34. lxml/includes/config.pxd +3 -3
  35. lxml/includes/dtdvalid.pxd +18 -18
  36. lxml/includes/etree_defs.h +379 -379
  37. lxml/includes/etreepublic.pxd +237 -237
  38. lxml/includes/htmlparser.pxd +56 -56
  39. lxml/includes/lxml-version.h +1 -1
  40. lxml/includes/relaxng.pxd +64 -64
  41. lxml/includes/schematron.pxd +34 -34
  42. lxml/includes/tree.pxd +494 -494
  43. lxml/includes/uri.pxd +5 -5
  44. lxml/includes/xinclude.pxd +22 -22
  45. lxml/includes/xmlerror.pxd +852 -852
  46. lxml/includes/xmlparser.pxd +265 -265
  47. lxml/includes/xmlschema.pxd +35 -35
  48. lxml/includes/xpath.pxd +136 -136
  49. lxml/includes/xslt.pxd +190 -190
  50. lxml/isoschematron/__init__.py +348 -348
  51. lxml/isoschematron/resources/rng/iso-schematron.rng +709 -709
  52. lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl +75 -75
  53. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl +312 -312
  54. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl +1159 -1159
  55. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl +54 -54
  56. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl +1796 -1796
  57. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl +588 -588
  58. lxml/iterparse.pxi +438 -438
  59. lxml/lxml.etree.h +6 -6
  60. lxml/nsclasses.pxi +281 -281
  61. lxml/objectify.cp310-win32.pyd +0 -0
  62. lxml/objectify.pyx +2145 -2145
  63. lxml/objectpath.pxi +332 -332
  64. lxml/parser.pxi +1994 -1994
  65. lxml/parsertarget.pxi +180 -180
  66. lxml/proxy.pxi +619 -619
  67. lxml/public-api.pxi +178 -178
  68. lxml/pyclasslookup.py +3 -3
  69. lxml/readonlytree.pxi +565 -565
  70. lxml/relaxng.pxi +165 -165
  71. lxml/sax.cp310-win32.pyd +0 -0
  72. lxml/sax.py +275 -275
  73. lxml/saxparser.pxi +875 -875
  74. lxml/schematron.pxi +168 -168
  75. lxml/serializer.pxi +1871 -1871
  76. lxml/usedoctest.py +13 -13
  77. lxml/xinclude.pxi +67 -67
  78. lxml/xmlerror.pxi +1654 -1654
  79. lxml/xmlid.pxi +179 -179
  80. lxml/xmlschema.pxi +215 -215
  81. lxml/xpath.pxi +487 -487
  82. lxml/xslt.pxi +950 -950
  83. lxml/xsltext.pxi +242 -242
  84. {lxml-5.2.0.dist-info → lxml-5.2.2.dist-info}/LICENSE.txt +29 -29
  85. {lxml-5.2.0.dist-info → lxml-5.2.2.dist-info}/LICENSES.txt +29 -29
  86. {lxml-5.2.0.dist-info → lxml-5.2.2.dist-info}/METADATA +9 -17
  87. {lxml-5.2.0.dist-info → lxml-5.2.2.dist-info}/RECORD +89 -89
  88. {lxml-5.2.0.dist-info → lxml-5.2.2.dist-info}/WHEEL +0 -0
  89. {lxml-5.2.0.dist-info → lxml-5.2.2.dist-info}/top_level.txt +0 -0
lxml/xsltext.pxi CHANGED
@@ -1,242 +1,242 @@
1
- # XSLT extension elements
2
-
3
- cdef class XSLTExtension:
4
- """Base class of an XSLT extension element.
5
- """
6
- def execute(self, context, self_node, input_node, output_parent):
7
- """execute(self, context, self_node, input_node, output_parent)
8
- Execute this extension element.
9
-
10
- Subclasses must override this method. They may append
11
- elements to the `output_parent` element here, or set its text
12
- content. To this end, the `input_node` provides read-only
13
- access to the current node in the input document, and the
14
- `self_node` points to the extension element in the stylesheet.
15
-
16
- Note that the `output_parent` parameter may be `None` if there
17
- is no parent element in the current context (e.g. no content
18
- was added to the output tree yet).
19
- """
20
- pass
21
-
22
- def apply_templates(self, _XSLTContext context not None, node, output_parent=None,
23
- *, elements_only=False, remove_blank_text=False):
24
- """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
25
-
26
- Call this method to retrieve the result of applying templates
27
- to an element.
28
-
29
- The return value is a list of elements or text strings that
30
- were generated by the XSLT processor. If you pass
31
- ``elements_only=True``, strings will be discarded from the result
32
- list. The option ``remove_blank_text=True`` will only discard
33
- strings that consist entirely of whitespace (e.g. formatting).
34
- These options do not apply to Elements, only to bare string results.
35
-
36
- If you pass an Element as `output_parent` parameter, the result
37
- will instead be appended to the element (including attributes
38
- etc.) and the return value will be `None`. This is a safe way
39
- to generate content into the output document directly, without
40
- having to take care of special values like text or attributes.
41
- Note that the string discarding options will be ignored in this
42
- case.
43
- """
44
- cdef xmlNode* c_parent
45
- cdef xmlNode* c_node
46
- cdef xmlNode* c_context_node
47
- assert context._xsltCtxt is not NULL, "XSLT context not initialised"
48
- c_context_node = _roNodeOf(node)
49
- #assert c_context_node.doc is context._xsltContext.node.doc, \
50
- # "switching input documents during transformation is not currently supported"
51
-
52
- if output_parent is not None:
53
- c_parent = _nonRoNodeOf(output_parent)
54
- else:
55
- c_parent = tree.xmlNewDocNode(
56
- context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
57
-
58
- c_node = context._xsltCtxt.insert
59
- context._xsltCtxt.insert = c_parent
60
- xslt.xsltProcessOneNode(
61
- context._xsltCtxt, c_context_node, NULL)
62
- context._xsltCtxt.insert = c_node
63
-
64
- if output_parent is not None:
65
- return None
66
-
67
- try:
68
- return self._collectXSLTResultContent(
69
- context, c_parent, elements_only, remove_blank_text)
70
- finally:
71
- # free all intermediate nodes that will not be freed by proxies
72
- tree.xmlFreeNode(c_parent)
73
-
74
- def process_children(self, _XSLTContext context not None, output_parent=None,
75
- *, elements_only=False, remove_blank_text=False):
76
- """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
77
-
78
- Call this method to process the XSLT content of the extension
79
- element itself.
80
-
81
- The return value is a list of elements or text strings that
82
- were generated by the XSLT processor. If you pass
83
- ``elements_only=True``, strings will be discarded from the result
84
- list. The option ``remove_blank_text=True`` will only discard
85
- strings that consist entirely of whitespace (e.g. formatting).
86
- These options do not apply to Elements, only to bare string results.
87
-
88
- If you pass an Element as `output_parent` parameter, the result
89
- will instead be appended to the element (including attributes
90
- etc.) and the return value will be `None`. This is a safe way
91
- to generate content into the output document directly, without
92
- having to take care of special values like text or attributes.
93
- Note that the string discarding options will be ignored in this
94
- case.
95
- """
96
- cdef xmlNode* c_parent
97
- cdef xslt.xsltTransformContext* c_ctxt = context._xsltCtxt
98
- cdef xmlNode* c_old_output_parent = c_ctxt.insert
99
- assert context._xsltCtxt is not NULL, "XSLT context not initialised"
100
-
101
- # output_parent node is used for adding results instead of
102
- # elements list used in apply_templates, that's easier and allows to
103
- # use attributes added to extension element with <xsl:attribute>.
104
-
105
- if output_parent is not None:
106
- c_parent = _nonRoNodeOf(output_parent)
107
- else:
108
- c_parent = tree.xmlNewDocNode(
109
- context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
110
-
111
- c_ctxt.insert = c_parent
112
- xslt.xsltApplyOneTemplate(c_ctxt,
113
- c_ctxt.node, c_ctxt.inst.children, NULL, NULL)
114
- c_ctxt.insert = c_old_output_parent
115
-
116
- if output_parent is not None:
117
- return None
118
-
119
- try:
120
- return self._collectXSLTResultContent(
121
- context, c_parent, elements_only, remove_blank_text)
122
- finally:
123
- # free all intermediate nodes that will not be freed by proxies
124
- tree.xmlFreeNode(c_parent)
125
-
126
- cdef _collectXSLTResultContent(self, _XSLTContext context, xmlNode* c_parent,
127
- bint elements_only, bint remove_blank_text):
128
- cdef xmlNode* c_node
129
- cdef xmlNode* c_next
130
- cdef _ReadOnlyProxy proxy
131
- cdef list results = [] # or maybe _collectAttributes(c_parent, 2) ?
132
- c_node = c_parent.children
133
- while c_node is not NULL:
134
- c_next = c_node.next
135
- if c_node.type == tree.XML_TEXT_NODE:
136
- if not elements_only:
137
- s = funicode(c_node.content)
138
- if not remove_blank_text or s.strip():
139
- results.append(s)
140
- s = None
141
- elif c_node.type == tree.XML_ELEMENT_NODE:
142
- proxy = _newReadOnlyProxy(
143
- context._extension_element_proxy, c_node)
144
- results.append(proxy)
145
- # unlink node and make sure it will be freed later on
146
- tree.xmlUnlinkNode(c_node)
147
- proxy.free_after_use()
148
- else:
149
- raise TypeError, \
150
- f"unsupported XSLT result type: {c_node.type}"
151
- c_node = c_next
152
- return results
153
-
154
-
155
- cdef _registerXSLTExtensions(xslt.xsltTransformContext* c_ctxt,
156
- extension_dict):
157
- for ns_utf, name_utf in extension_dict:
158
- xslt.xsltRegisterExtElement(
159
- c_ctxt, _xcstr(name_utf), _xcstr(ns_utf),
160
- <xslt.xsltTransformFunction>_callExtensionElement)
161
-
162
- cdef void _callExtensionElement(xslt.xsltTransformContext* c_ctxt,
163
- xmlNode* c_context_node,
164
- xmlNode* c_inst_node,
165
- void* dummy) noexcept with gil:
166
- cdef _XSLTContext context
167
- cdef XSLTExtension extension
168
- cdef python.PyObject* dict_result
169
- cdef xmlNode* c_node
170
- cdef _ReadOnlyProxy context_node = None, self_node = None
171
- cdef object output_parent # not restricted to ro-nodes
172
- c_uri = _getNs(c_inst_node)
173
- if c_uri is NULL:
174
- # not allowed, and should never happen
175
- return
176
- if c_ctxt.xpathCtxt.userData is NULL:
177
- # just for safety, should never happen
178
- return
179
- context = <_XSLTContext>c_ctxt.xpathCtxt.userData
180
- try:
181
- try:
182
- dict_result = python.PyDict_GetItem(
183
- context._extension_elements, (c_uri, c_inst_node.name))
184
- if dict_result is NULL:
185
- raise KeyError, f"extension element {funicode(c_inst_node.name)} not found"
186
- extension = <object>dict_result
187
-
188
- try:
189
- # build the context proxy nodes
190
- self_node = _newReadOnlyProxy(None, c_inst_node)
191
- if _isElement(c_ctxt.insert):
192
- output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert)
193
- else:
194
- # may be the document node or other stuff
195
- output_parent = _newOpaqueAppendOnlyNodeWrapper(c_ctxt.insert)
196
- if c_context_node.type in (tree.XML_DOCUMENT_NODE,
197
- tree.XML_HTML_DOCUMENT_NODE):
198
- c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
199
- if c_node is not NULL:
200
- context_node = _newReadOnlyProxy(self_node, c_node)
201
- else:
202
- context_node = None
203
- elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,
204
- tree.XML_TEXT_NODE,
205
- tree.XML_CDATA_SECTION_NODE):
206
- # this isn't easy to support using read-only
207
- # nodes, as the smart-string factory must
208
- # instantiate the parent proxy somehow...
209
- raise TypeError(f"Unsupported element type: {c_context_node.type}")
210
- else:
211
- context_node = _newReadOnlyProxy(self_node, c_context_node)
212
-
213
- # run the XSLT extension
214
- context._extension_element_proxy = self_node
215
- extension.execute(context, self_node, context_node, output_parent)
216
- finally:
217
- context._extension_element_proxy = None
218
- if self_node is not None:
219
- _freeReadOnlyProxies(self_node)
220
- except Exception as e:
221
- try:
222
- e = unicode(e).encode("UTF-8")
223
- except:
224
- e = repr(e).encode("UTF-8")
225
- message = python.PyBytes_FromFormat(
226
- "Error executing extension element '%s': %s",
227
- c_inst_node.name, _cstr(e))
228
- xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)
229
- context._exc._store_raised()
230
- except:
231
- # just in case
232
- message = python.PyBytes_FromFormat(
233
- "Error executing extension element '%s'", c_inst_node.name)
234
- xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)
235
- context._exc._store_raised()
236
- except:
237
- # no Python functions here - everything can fail...
238
- xslt.xsltTransformError(c_ctxt, NULL, c_inst_node,
239
- "Error during XSLT extension element evaluation")
240
- context._exc._store_raised()
241
- finally:
242
- return # swallow any further exceptions
1
+ # XSLT extension elements
2
+
3
+ cdef class XSLTExtension:
4
+ """Base class of an XSLT extension element.
5
+ """
6
+ def execute(self, context, self_node, input_node, output_parent):
7
+ """execute(self, context, self_node, input_node, output_parent)
8
+ Execute this extension element.
9
+
10
+ Subclasses must override this method. They may append
11
+ elements to the `output_parent` element here, or set its text
12
+ content. To this end, the `input_node` provides read-only
13
+ access to the current node in the input document, and the
14
+ `self_node` points to the extension element in the stylesheet.
15
+
16
+ Note that the `output_parent` parameter may be `None` if there
17
+ is no parent element in the current context (e.g. no content
18
+ was added to the output tree yet).
19
+ """
20
+ pass
21
+
22
+ def apply_templates(self, _XSLTContext context not None, node, output_parent=None,
23
+ *, elements_only=False, remove_blank_text=False):
24
+ """apply_templates(self, context, node, output_parent=None, elements_only=False, remove_blank_text=False)
25
+
26
+ Call this method to retrieve the result of applying templates
27
+ to an element.
28
+
29
+ The return value is a list of elements or text strings that
30
+ were generated by the XSLT processor. If you pass
31
+ ``elements_only=True``, strings will be discarded from the result
32
+ list. The option ``remove_blank_text=True`` will only discard
33
+ strings that consist entirely of whitespace (e.g. formatting).
34
+ These options do not apply to Elements, only to bare string results.
35
+
36
+ If you pass an Element as `output_parent` parameter, the result
37
+ will instead be appended to the element (including attributes
38
+ etc.) and the return value will be `None`. This is a safe way
39
+ to generate content into the output document directly, without
40
+ having to take care of special values like text or attributes.
41
+ Note that the string discarding options will be ignored in this
42
+ case.
43
+ """
44
+ cdef xmlNode* c_parent
45
+ cdef xmlNode* c_node
46
+ cdef xmlNode* c_context_node
47
+ assert context._xsltCtxt is not NULL, "XSLT context not initialised"
48
+ c_context_node = _roNodeOf(node)
49
+ #assert c_context_node.doc is context._xsltContext.node.doc, \
50
+ # "switching input documents during transformation is not currently supported"
51
+
52
+ if output_parent is not None:
53
+ c_parent = _nonRoNodeOf(output_parent)
54
+ else:
55
+ c_parent = tree.xmlNewDocNode(
56
+ context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
57
+
58
+ c_node = context._xsltCtxt.insert
59
+ context._xsltCtxt.insert = c_parent
60
+ xslt.xsltProcessOneNode(
61
+ context._xsltCtxt, c_context_node, NULL)
62
+ context._xsltCtxt.insert = c_node
63
+
64
+ if output_parent is not None:
65
+ return None
66
+
67
+ try:
68
+ return self._collectXSLTResultContent(
69
+ context, c_parent, elements_only, remove_blank_text)
70
+ finally:
71
+ # free all intermediate nodes that will not be freed by proxies
72
+ tree.xmlFreeNode(c_parent)
73
+
74
+ def process_children(self, _XSLTContext context not None, output_parent=None,
75
+ *, elements_only=False, remove_blank_text=False):
76
+ """process_children(self, context, output_parent=None, elements_only=False, remove_blank_text=False)
77
+
78
+ Call this method to process the XSLT content of the extension
79
+ element itself.
80
+
81
+ The return value is a list of elements or text strings that
82
+ were generated by the XSLT processor. If you pass
83
+ ``elements_only=True``, strings will be discarded from the result
84
+ list. The option ``remove_blank_text=True`` will only discard
85
+ strings that consist entirely of whitespace (e.g. formatting).
86
+ These options do not apply to Elements, only to bare string results.
87
+
88
+ If you pass an Element as `output_parent` parameter, the result
89
+ will instead be appended to the element (including attributes
90
+ etc.) and the return value will be `None`. This is a safe way
91
+ to generate content into the output document directly, without
92
+ having to take care of special values like text or attributes.
93
+ Note that the string discarding options will be ignored in this
94
+ case.
95
+ """
96
+ cdef xmlNode* c_parent
97
+ cdef xslt.xsltTransformContext* c_ctxt = context._xsltCtxt
98
+ cdef xmlNode* c_old_output_parent = c_ctxt.insert
99
+ assert context._xsltCtxt is not NULL, "XSLT context not initialised"
100
+
101
+ # output_parent node is used for adding results instead of
102
+ # elements list used in apply_templates, that's easier and allows to
103
+ # use attributes added to extension element with <xsl:attribute>.
104
+
105
+ if output_parent is not None:
106
+ c_parent = _nonRoNodeOf(output_parent)
107
+ else:
108
+ c_parent = tree.xmlNewDocNode(
109
+ context._xsltCtxt.output, NULL, <unsigned char*>"fake-parent", NULL)
110
+
111
+ c_ctxt.insert = c_parent
112
+ xslt.xsltApplyOneTemplate(c_ctxt,
113
+ c_ctxt.node, c_ctxt.inst.children, NULL, NULL)
114
+ c_ctxt.insert = c_old_output_parent
115
+
116
+ if output_parent is not None:
117
+ return None
118
+
119
+ try:
120
+ return self._collectXSLTResultContent(
121
+ context, c_parent, elements_only, remove_blank_text)
122
+ finally:
123
+ # free all intermediate nodes that will not be freed by proxies
124
+ tree.xmlFreeNode(c_parent)
125
+
126
+ cdef _collectXSLTResultContent(self, _XSLTContext context, xmlNode* c_parent,
127
+ bint elements_only, bint remove_blank_text):
128
+ cdef xmlNode* c_node
129
+ cdef xmlNode* c_next
130
+ cdef _ReadOnlyProxy proxy
131
+ cdef list results = [] # or maybe _collectAttributes(c_parent, 2) ?
132
+ c_node = c_parent.children
133
+ while c_node is not NULL:
134
+ c_next = c_node.next
135
+ if c_node.type == tree.XML_TEXT_NODE:
136
+ if not elements_only:
137
+ s = funicode(c_node.content)
138
+ if not remove_blank_text or s.strip():
139
+ results.append(s)
140
+ s = None
141
+ elif c_node.type == tree.XML_ELEMENT_NODE:
142
+ proxy = _newReadOnlyProxy(
143
+ context._extension_element_proxy, c_node)
144
+ results.append(proxy)
145
+ # unlink node and make sure it will be freed later on
146
+ tree.xmlUnlinkNode(c_node)
147
+ proxy.free_after_use()
148
+ else:
149
+ raise TypeError, \
150
+ f"unsupported XSLT result type: {c_node.type}"
151
+ c_node = c_next
152
+ return results
153
+
154
+
155
+ cdef _registerXSLTExtensions(xslt.xsltTransformContext* c_ctxt,
156
+ extension_dict):
157
+ for ns_utf, name_utf in extension_dict:
158
+ xslt.xsltRegisterExtElement(
159
+ c_ctxt, _xcstr(name_utf), _xcstr(ns_utf),
160
+ <xslt.xsltTransformFunction>_callExtensionElement)
161
+
162
+ cdef void _callExtensionElement(xslt.xsltTransformContext* c_ctxt,
163
+ xmlNode* c_context_node,
164
+ xmlNode* c_inst_node,
165
+ void* dummy) noexcept with gil:
166
+ cdef _XSLTContext context
167
+ cdef XSLTExtension extension
168
+ cdef python.PyObject* dict_result
169
+ cdef xmlNode* c_node
170
+ cdef _ReadOnlyProxy context_node = None, self_node = None
171
+ cdef object output_parent # not restricted to ro-nodes
172
+ c_uri = _getNs(c_inst_node)
173
+ if c_uri is NULL:
174
+ # not allowed, and should never happen
175
+ return
176
+ if c_ctxt.xpathCtxt.userData is NULL:
177
+ # just for safety, should never happen
178
+ return
179
+ context = <_XSLTContext>c_ctxt.xpathCtxt.userData
180
+ try:
181
+ try:
182
+ dict_result = python.PyDict_GetItem(
183
+ context._extension_elements, (c_uri, c_inst_node.name))
184
+ if dict_result is NULL:
185
+ raise KeyError, f"extension element {funicode(c_inst_node.name)} not found"
186
+ extension = <object>dict_result
187
+
188
+ try:
189
+ # build the context proxy nodes
190
+ self_node = _newReadOnlyProxy(None, c_inst_node)
191
+ if _isElement(c_ctxt.insert):
192
+ output_parent = _newAppendOnlyProxy(self_node, c_ctxt.insert)
193
+ else:
194
+ # may be the document node or other stuff
195
+ output_parent = _newOpaqueAppendOnlyNodeWrapper(c_ctxt.insert)
196
+ if c_context_node.type in (tree.XML_DOCUMENT_NODE,
197
+ tree.XML_HTML_DOCUMENT_NODE):
198
+ c_node = tree.xmlDocGetRootElement(<xmlDoc*>c_context_node)
199
+ if c_node is not NULL:
200
+ context_node = _newReadOnlyProxy(self_node, c_node)
201
+ else:
202
+ context_node = None
203
+ elif c_context_node.type in (tree.XML_ATTRIBUTE_NODE,
204
+ tree.XML_TEXT_NODE,
205
+ tree.XML_CDATA_SECTION_NODE):
206
+ # this isn't easy to support using read-only
207
+ # nodes, as the smart-string factory must
208
+ # instantiate the parent proxy somehow...
209
+ raise TypeError(f"Unsupported element type: {c_context_node.type}")
210
+ else:
211
+ context_node = _newReadOnlyProxy(self_node, c_context_node)
212
+
213
+ # run the XSLT extension
214
+ context._extension_element_proxy = self_node
215
+ extension.execute(context, self_node, context_node, output_parent)
216
+ finally:
217
+ context._extension_element_proxy = None
218
+ if self_node is not None:
219
+ _freeReadOnlyProxies(self_node)
220
+ except Exception as e:
221
+ try:
222
+ e = unicode(e).encode("UTF-8")
223
+ except:
224
+ e = repr(e).encode("UTF-8")
225
+ message = python.PyBytes_FromFormat(
226
+ "Error executing extension element '%s': %s",
227
+ c_inst_node.name, _cstr(e))
228
+ xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)
229
+ context._exc._store_raised()
230
+ except:
231
+ # just in case
232
+ message = python.PyBytes_FromFormat(
233
+ "Error executing extension element '%s'", c_inst_node.name)
234
+ xslt.xsltTransformError(c_ctxt, NULL, c_inst_node, "%s", message)
235
+ context._exc._store_raised()
236
+ except:
237
+ # no Python functions here - everything can fail...
238
+ xslt.xsltTransformError(c_ctxt, NULL, c_inst_node,
239
+ "Error during XSLT extension element evaluation")
240
+ context._exc._store_raised()
241
+ finally:
242
+ return # swallow any further exceptions
@@ -1,29 +1,29 @@
1
- Copyright (c) 2004 Infrae. All rights reserved.
2
-
3
- Redistribution and use in source and binary forms, with or without
4
- modification, are permitted provided that the following conditions are
5
- met:
6
-
7
- 1. Redistributions of source code must retain the above copyright
8
- notice, this list of conditions and the following disclaimer.
9
-
10
- 2. Redistributions in binary form must reproduce the above copyright
11
- notice, this list of conditions and the following disclaimer in
12
- the documentation and/or other materials provided with the
13
- distribution.
14
-
15
- 3. Neither the name of Infrae nor the names of its contributors may
16
- be used to endorse or promote products derived from this software
17
- without specific prior written permission.
18
-
19
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INFRAE OR
23
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ Copyright (c) 2004 Infrae. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are
5
+ met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in
12
+ the documentation and/or other materials provided with the
13
+ distribution.
14
+
15
+ 3. Neither the name of Infrae nor the names of its contributors may
16
+ be used to endorse or promote products derived from this software
17
+ without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INFRAE OR
23
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,29 +1,29 @@
1
- lxml is copyright Infrae and distributed under the BSD license (see
2
- doc/licenses/BSD.txt), with the following exceptions:
3
-
4
- Some code, such a selftest.py, selftest2.py and
5
- src/lxml/_elementpath.py are derived from ElementTree and
6
- cElementTree. See doc/licenses/elementtree.txt for the license text.
7
-
8
- lxml.cssselect and lxml.html are copyright Ian Bicking and distributed
9
- under the BSD license (see doc/licenses/BSD.txt).
10
-
11
- test.py, the test-runner script, is GPL and copyright Shuttleworth
12
- Foundation. See doc/licenses/GPL.txt. It is believed the unchanged
13
- inclusion of test.py to run the unit test suite falls under the
14
- "aggregation" clause of the GPL and thus does not affect the license
15
- of the rest of the package.
16
-
17
- The isoschematron implementation uses several XSL and RelaxNG resources:
18
- * The (XML syntax) RelaxNG schema for schematron, copyright International
19
- Organization for Standardization (see
20
- src/lxml/isoschematron/resources/rng/iso-schematron.rng for the license
21
- text)
22
- * The skeleton iso-schematron-xlt1 pure-xslt schematron implementation
23
- xsl stylesheets, copyright Rick Jelliffe and Academia Sinica Computing
24
- Center, Taiwan (see the xsl files here for the license text:
25
- src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/)
26
- * The xsd/rng schema schematron extraction xsl transformations are unlicensed
27
- and copyright the respective authors as noted (see
28
- src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl and
29
- src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl)
1
+ lxml is copyright Infrae and distributed under the BSD license (see
2
+ doc/licenses/BSD.txt), with the following exceptions:
3
+
4
+ Some code, such a selftest.py, selftest2.py and
5
+ src/lxml/_elementpath.py are derived from ElementTree and
6
+ cElementTree. See doc/licenses/elementtree.txt for the license text.
7
+
8
+ lxml.cssselect and lxml.html are copyright Ian Bicking and distributed
9
+ under the BSD license (see doc/licenses/BSD.txt).
10
+
11
+ test.py, the test-runner script, is GPL and copyright Shuttleworth
12
+ Foundation. See doc/licenses/GPL.txt. It is believed the unchanged
13
+ inclusion of test.py to run the unit test suite falls under the
14
+ "aggregation" clause of the GPL and thus does not affect the license
15
+ of the rest of the package.
16
+
17
+ The isoschematron implementation uses several XSL and RelaxNG resources:
18
+ * The (XML syntax) RelaxNG schema for schematron, copyright International
19
+ Organization for Standardization (see
20
+ src/lxml/isoschematron/resources/rng/iso-schematron.rng for the license
21
+ text)
22
+ * The skeleton iso-schematron-xlt1 pure-xslt schematron implementation
23
+ xsl stylesheets, copyright Rick Jelliffe and Academia Sinica Computing
24
+ Center, Taiwan (see the xsl files here for the license text:
25
+ src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/)
26
+ * The xsd/rng schema schematron extraction xsl transformations are unlicensed
27
+ and copyright the respective authors as noted (see
28
+ src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl and
29
+ src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lxml
3
- Version: 5.2.0
3
+ Version: 5.2.2
4
4
  Summary: Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.
5
5
  Home-page: https://lxml.de/
6
6
  Author: lxml dev team
@@ -71,26 +71,18 @@ https://github.com/lxml/lxml/tarball/lxml-5.2#egg=lxml-5.2bugfix
71
71
  as soon as a maintenance branch has been established. Note that this
72
72
  requires Cython to be installed at an appropriate version for the build.
73
73
 
74
- 5.2.0 (2024-03-30)
74
+ 5.2.2 (2024-05-12)
75
75
  ==================
76
76
 
77
- Other changes
78
- -------------
77
+ Bugs fixed
78
+ ----------
79
79
 
80
- * LP#1958539: The ``lxml.html.clean`` implementation suffered from several (only if used)
81
- security issues in the past and was now extracted into a separate library:
80
+ * GH#417: The ``test_feed_parser`` test could fail if ``lxml_html_clean`` was not installed.
81
+ It is now skipped in that case.
82
82
 
83
- https://github.com/fedora-python/lxml_html_clean
83
+ * LP#2059910: The minimum CPU architecture for the Linux x86 binary wheels was set back to
84
+ "core2", without SSE 4.2.
84
85
 
85
- Projects that use lxml without "lxml.html.clean" will not notice any difference,
86
- except that they won't have potentially vulnerable code installed.
87
- The module is available as an "extra" setuptools dependency "lxml[html_clean]",
88
- so that Projects that need "lxml.html.clean" will need to switch their requirements
89
- from "lxml" to "lxml[html_clean]", or install the new library themselves.
90
-
91
- * The minimum CPU architecture for the Linux x86 binary wheels was upgraded to
92
- "sandybridge" (launched 2011), and glibc 2.28 / gcc 12 (manylinux_2_28) wheels were added.
93
-
94
- * Built with Cython 3.0.10.
86
+ * If libxml2 uses iconv, the compile time version is available as `etree.ICONV_COMPILED_VERSION`.
95
87
 
96
88