lxml 6.0.0__cp39-cp39-manylinux_2_31_armv7l.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 (174) hide show
  1. lxml/ElementInclude.py +244 -0
  2. lxml/__init__.py +22 -0
  3. lxml/_elementpath.cpython-39-arm-linux-gnueabihf.so +0 -0
  4. lxml/_elementpath.py +343 -0
  5. lxml/apihelpers.pxi +1801 -0
  6. lxml/builder.cpython-39-arm-linux-gnueabihf.so +0 -0
  7. lxml/builder.py +243 -0
  8. lxml/classlookup.pxi +580 -0
  9. lxml/cleanup.pxi +215 -0
  10. lxml/cssselect.py +101 -0
  11. lxml/debug.pxi +36 -0
  12. lxml/docloader.pxi +178 -0
  13. lxml/doctestcompare.py +488 -0
  14. lxml/dtd.pxi +479 -0
  15. lxml/etree.cpython-39-arm-linux-gnueabihf.so +0 -0
  16. lxml/etree.h +244 -0
  17. lxml/etree.pyx +3853 -0
  18. lxml/etree_api.h +204 -0
  19. lxml/extensions.pxi +830 -0
  20. lxml/html/ElementSoup.py +10 -0
  21. lxml/html/__init__.py +1927 -0
  22. lxml/html/_diffcommand.py +86 -0
  23. lxml/html/_difflib.cpython-39-arm-linux-gnueabihf.so +0 -0
  24. lxml/html/_difflib.py +2106 -0
  25. lxml/html/_html5builder.py +100 -0
  26. lxml/html/_setmixin.py +56 -0
  27. lxml/html/builder.py +173 -0
  28. lxml/html/clean.py +21 -0
  29. lxml/html/defs.py +135 -0
  30. lxml/html/diff.cpython-39-arm-linux-gnueabihf.so +0 -0
  31. lxml/html/diff.py +972 -0
  32. lxml/html/formfill.py +299 -0
  33. lxml/html/html5parser.py +260 -0
  34. lxml/html/soupparser.py +314 -0
  35. lxml/html/usedoctest.py +13 -0
  36. lxml/includes/__init__.pxd +0 -0
  37. lxml/includes/__init__.py +0 -0
  38. lxml/includes/c14n.pxd +25 -0
  39. lxml/includes/config.pxd +3 -0
  40. lxml/includes/dtdvalid.pxd +18 -0
  41. lxml/includes/etree_defs.h +379 -0
  42. lxml/includes/etreepublic.pxd +237 -0
  43. lxml/includes/extlibs/__init__.py +0 -0
  44. lxml/includes/extlibs/libcharset.h +45 -0
  45. lxml/includes/extlibs/localcharset.h +137 -0
  46. lxml/includes/extlibs/zconf.h +543 -0
  47. lxml/includes/extlibs/zlib.h +1938 -0
  48. lxml/includes/htmlparser.pxd +56 -0
  49. lxml/includes/libexslt/__init__.py +0 -0
  50. lxml/includes/libexslt/exslt.h +108 -0
  51. lxml/includes/libexslt/exsltconfig.h +70 -0
  52. lxml/includes/libexslt/exsltexports.h +63 -0
  53. lxml/includes/libxml/HTMLparser.h +339 -0
  54. lxml/includes/libxml/HTMLtree.h +148 -0
  55. lxml/includes/libxml/SAX.h +18 -0
  56. lxml/includes/libxml/SAX2.h +170 -0
  57. lxml/includes/libxml/__init__.py +0 -0
  58. lxml/includes/libxml/c14n.h +115 -0
  59. lxml/includes/libxml/catalog.h +183 -0
  60. lxml/includes/libxml/chvalid.h +230 -0
  61. lxml/includes/libxml/debugXML.h +79 -0
  62. lxml/includes/libxml/dict.h +82 -0
  63. lxml/includes/libxml/encoding.h +307 -0
  64. lxml/includes/libxml/entities.h +147 -0
  65. lxml/includes/libxml/globals.h +25 -0
  66. lxml/includes/libxml/hash.h +251 -0
  67. lxml/includes/libxml/list.h +137 -0
  68. lxml/includes/libxml/nanoftp.h +16 -0
  69. lxml/includes/libxml/nanohttp.h +98 -0
  70. lxml/includes/libxml/parser.h +1633 -0
  71. lxml/includes/libxml/parserInternals.h +591 -0
  72. lxml/includes/libxml/relaxng.h +224 -0
  73. lxml/includes/libxml/schemasInternals.h +959 -0
  74. lxml/includes/libxml/schematron.h +143 -0
  75. lxml/includes/libxml/threads.h +81 -0
  76. lxml/includes/libxml/tree.h +1326 -0
  77. lxml/includes/libxml/uri.h +106 -0
  78. lxml/includes/libxml/valid.h +485 -0
  79. lxml/includes/libxml/xinclude.h +141 -0
  80. lxml/includes/libxml/xlink.h +193 -0
  81. lxml/includes/libxml/xmlIO.h +419 -0
  82. lxml/includes/libxml/xmlautomata.h +163 -0
  83. lxml/includes/libxml/xmlerror.h +962 -0
  84. lxml/includes/libxml/xmlexports.h +96 -0
  85. lxml/includes/libxml/xmlmemory.h +188 -0
  86. lxml/includes/libxml/xmlmodule.h +61 -0
  87. lxml/includes/libxml/xmlreader.h +444 -0
  88. lxml/includes/libxml/xmlregexp.h +116 -0
  89. lxml/includes/libxml/xmlsave.h +111 -0
  90. lxml/includes/libxml/xmlschemas.h +254 -0
  91. lxml/includes/libxml/xmlschemastypes.h +152 -0
  92. lxml/includes/libxml/xmlstring.h +140 -0
  93. lxml/includes/libxml/xmlunicode.h +15 -0
  94. lxml/includes/libxml/xmlversion.h +332 -0
  95. lxml/includes/libxml/xmlwriter.h +489 -0
  96. lxml/includes/libxml/xpath.h +569 -0
  97. lxml/includes/libxml/xpathInternals.h +639 -0
  98. lxml/includes/libxml/xpointer.h +48 -0
  99. lxml/includes/libxslt/__init__.py +0 -0
  100. lxml/includes/libxslt/attributes.h +39 -0
  101. lxml/includes/libxslt/documents.h +93 -0
  102. lxml/includes/libxslt/extensions.h +262 -0
  103. lxml/includes/libxslt/extra.h +72 -0
  104. lxml/includes/libxslt/functions.h +78 -0
  105. lxml/includes/libxslt/imports.h +75 -0
  106. lxml/includes/libxslt/keys.h +53 -0
  107. lxml/includes/libxslt/namespaces.h +68 -0
  108. lxml/includes/libxslt/numbersInternals.h +73 -0
  109. lxml/includes/libxslt/pattern.h +84 -0
  110. lxml/includes/libxslt/preproc.h +43 -0
  111. lxml/includes/libxslt/security.h +104 -0
  112. lxml/includes/libxslt/templates.h +77 -0
  113. lxml/includes/libxslt/transform.h +207 -0
  114. lxml/includes/libxslt/variables.h +118 -0
  115. lxml/includes/libxslt/xslt.h +110 -0
  116. lxml/includes/libxslt/xsltInternals.h +1995 -0
  117. lxml/includes/libxslt/xsltconfig.h +146 -0
  118. lxml/includes/libxslt/xsltexports.h +64 -0
  119. lxml/includes/libxslt/xsltlocale.h +44 -0
  120. lxml/includes/libxslt/xsltutils.h +343 -0
  121. lxml/includes/lxml-version.h +3 -0
  122. lxml/includes/relaxng.pxd +64 -0
  123. lxml/includes/schematron.pxd +34 -0
  124. lxml/includes/tree.pxd +492 -0
  125. lxml/includes/uri.pxd +5 -0
  126. lxml/includes/xinclude.pxd +22 -0
  127. lxml/includes/xmlerror.pxd +852 -0
  128. lxml/includes/xmlparser.pxd +303 -0
  129. lxml/includes/xmlschema.pxd +35 -0
  130. lxml/includes/xpath.pxd +136 -0
  131. lxml/includes/xslt.pxd +190 -0
  132. lxml/isoschematron/__init__.py +348 -0
  133. lxml/isoschematron/resources/rng/iso-schematron.rng +709 -0
  134. lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl +75 -0
  135. lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl +77 -0
  136. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl +313 -0
  137. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl +1160 -0
  138. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl +55 -0
  139. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl +1796 -0
  140. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl +588 -0
  141. lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt +84 -0
  142. lxml/iterparse.pxi +438 -0
  143. lxml/lxml.etree.h +244 -0
  144. lxml/lxml.etree_api.h +204 -0
  145. lxml/nsclasses.pxi +281 -0
  146. lxml/objectify.cpython-39-arm-linux-gnueabihf.so +0 -0
  147. lxml/objectify.pyx +2149 -0
  148. lxml/objectpath.pxi +332 -0
  149. lxml/parser.pxi +2059 -0
  150. lxml/parsertarget.pxi +180 -0
  151. lxml/proxy.pxi +619 -0
  152. lxml/public-api.pxi +178 -0
  153. lxml/pyclasslookup.py +3 -0
  154. lxml/readonlytree.pxi +565 -0
  155. lxml/relaxng.pxi +165 -0
  156. lxml/sax.cpython-39-arm-linux-gnueabihf.so +0 -0
  157. lxml/sax.py +286 -0
  158. lxml/saxparser.pxi +875 -0
  159. lxml/schematron.pxi +173 -0
  160. lxml/serializer.pxi +1849 -0
  161. lxml/usedoctest.py +13 -0
  162. lxml/xinclude.pxi +67 -0
  163. lxml/xmlerror.pxi +1654 -0
  164. lxml/xmlid.pxi +179 -0
  165. lxml/xmlschema.pxi +215 -0
  166. lxml/xpath.pxi +487 -0
  167. lxml/xslt.pxi +957 -0
  168. lxml/xsltext.pxi +242 -0
  169. lxml-6.0.0.dist-info/METADATA +163 -0
  170. lxml-6.0.0.dist-info/RECORD +174 -0
  171. lxml-6.0.0.dist-info/WHEEL +5 -0
  172. lxml-6.0.0.dist-info/licenses/LICENSE.txt +31 -0
  173. lxml-6.0.0.dist-info/licenses/LICENSES.txt +29 -0
  174. lxml-6.0.0.dist-info/top_level.txt +1 -0
lxml/builder.py ADDED
@@ -0,0 +1,243 @@
1
+ # cython: language_level=2
2
+
3
+ #
4
+ # Element generator factory by Fredrik Lundh.
5
+ #
6
+ # Source:
7
+ # http://online.effbot.org/2006_11_01_archive.htm#et-builder
8
+ # http://effbot.python-hosting.com/file/stuff/sandbox/elementlib/builder.py
9
+ #
10
+ # --------------------------------------------------------------------
11
+ # The ElementTree toolkit is
12
+ #
13
+ # Copyright (c) 1999-2004 by Fredrik Lundh
14
+ #
15
+ # By obtaining, using, and/or copying this software and/or its
16
+ # associated documentation, you agree that you have read, understood,
17
+ # and will comply with the following terms and conditions:
18
+ #
19
+ # Permission to use, copy, modify, and distribute this software and
20
+ # its associated documentation for any purpose and without fee is
21
+ # hereby granted, provided that the above copyright notice appears in
22
+ # all copies, and that both that copyright notice and this permission
23
+ # notice appear in supporting documentation, and that the name of
24
+ # Secret Labs AB or the author not be used in advertising or publicity
25
+ # pertaining to distribution of the software without specific, written
26
+ # prior permission.
27
+ #
28
+ # SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
29
+ # TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
30
+ # ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
31
+ # BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
32
+ # DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
33
+ # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
34
+ # ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
35
+ # OF THIS SOFTWARE.
36
+ # --------------------------------------------------------------------
37
+
38
+ """
39
+ The ``E`` Element factory for generating XML documents.
40
+ """
41
+
42
+
43
+ import lxml.etree as ET
44
+ _QName = ET.QName
45
+
46
+ from functools import partial
47
+
48
+ try:
49
+ from types import GenericAlias as _GenericAlias
50
+ except ImportError:
51
+ # Python 3.8 - we only need this as return value from "__class_getitem__"
52
+ def _GenericAlias(cls, item):
53
+ return f"{cls.__name__}[{item.__name__}]"
54
+
55
+ try:
56
+ basestring
57
+ except NameError:
58
+ basestring = str
59
+
60
+ try:
61
+ unicode
62
+ except NameError:
63
+ unicode = str
64
+
65
+
66
+ class ElementMaker:
67
+ """Element generator factory.
68
+
69
+ Unlike the ordinary Element factory, the E factory allows you to pass in
70
+ more than just a tag and some optional attributes; you can also pass in
71
+ text and other elements. The text is added as either text or tail
72
+ attributes, and elements are inserted at the right spot. Some small
73
+ examples::
74
+
75
+ >>> from lxml import etree as ET
76
+ >>> from lxml.builder import E
77
+
78
+ >>> ET.tostring(E("tag"))
79
+ '<tag/>'
80
+ >>> ET.tostring(E("tag", "text"))
81
+ '<tag>text</tag>'
82
+ >>> ET.tostring(E("tag", "text", key="value"))
83
+ '<tag key="value">text</tag>'
84
+ >>> ET.tostring(E("tag", E("subtag", "text"), "tail"))
85
+ '<tag><subtag>text</subtag>tail</tag>'
86
+
87
+ For simple tags, the factory also allows you to write ``E.tag(...)`` instead
88
+ of ``E('tag', ...)``::
89
+
90
+ >>> ET.tostring(E.tag())
91
+ '<tag/>'
92
+ >>> ET.tostring(E.tag("text"))
93
+ '<tag>text</tag>'
94
+ >>> ET.tostring(E.tag(E.subtag("text"), "tail"))
95
+ '<tag><subtag>text</subtag>tail</tag>'
96
+
97
+ Here's a somewhat larger example; this shows how to generate HTML
98
+ documents, using a mix of prepared factory functions for inline elements,
99
+ nested ``E.tag`` calls, and embedded XHTML fragments::
100
+
101
+ # some common inline elements
102
+ A = E.a
103
+ I = E.i
104
+ B = E.b
105
+
106
+ def CLASS(v):
107
+ # helper function, 'class' is a reserved word
108
+ return {'class': v}
109
+
110
+ page = (
111
+ E.html(
112
+ E.head(
113
+ E.title("This is a sample document")
114
+ ),
115
+ E.body(
116
+ E.h1("Hello!", CLASS("title")),
117
+ E.p("This is a paragraph with ", B("bold"), " text in it!"),
118
+ E.p("This is another paragraph, with a ",
119
+ A("link", href="http://www.python.org"), "."),
120
+ E.p("Here are some reserved characters: <spam&egg>."),
121
+ ET.XML("<p>And finally, here is an embedded XHTML fragment.</p>"),
122
+ )
123
+ )
124
+ )
125
+
126
+ print ET.tostring(page)
127
+
128
+ Here's a prettyprinted version of the output from the above script::
129
+
130
+ <html>
131
+ <head>
132
+ <title>This is a sample document</title>
133
+ </head>
134
+ <body>
135
+ <h1 class="title">Hello!</h1>
136
+ <p>This is a paragraph with <b>bold</b> text in it!</p>
137
+ <p>This is another paragraph, with <a href="http://www.python.org">link</a>.</p>
138
+ <p>Here are some reserved characters: &lt;spam&amp;egg&gt;.</p>
139
+ <p>And finally, here is an embedded XHTML fragment.</p>
140
+ </body>
141
+ </html>
142
+
143
+ For namespace support, you can pass a namespace map (``nsmap``)
144
+ and/or a specific target ``namespace`` to the ElementMaker class::
145
+
146
+ >>> E = ElementMaker(namespace="http://my.ns/")
147
+ >>> print(ET.tostring( E.test ))
148
+ <test xmlns="http://my.ns/"/>
149
+
150
+ >>> E = ElementMaker(namespace="http://my.ns/", nsmap={'p':'http://my.ns/'})
151
+ >>> print(ET.tostring( E.test ))
152
+ <p:test xmlns:p="http://my.ns/"/>
153
+ """
154
+
155
+ def __init__(self, typemap=None,
156
+ namespace=None, nsmap=None, makeelement=None):
157
+ self._namespace = '{' + namespace + '}' if namespace is not None else None
158
+ self._nsmap = dict(nsmap) if nsmap else None
159
+
160
+ assert makeelement is None or callable(makeelement)
161
+ self._makeelement = makeelement if makeelement is not None else ET.Element
162
+
163
+ # initialize the default type map functions for this element factory
164
+ typemap = dict(typemap) if typemap else {}
165
+
166
+ def add_text(elem, item):
167
+ try:
168
+ last_child = elem[-1]
169
+ except IndexError:
170
+ elem.text = (elem.text or "") + item
171
+ else:
172
+ last_child.tail = (last_child.tail or "") + item
173
+
174
+ def add_cdata(elem, cdata):
175
+ if elem.text:
176
+ raise ValueError("Can't add a CDATA section. Element already has some text: %r" % elem.text)
177
+ elem.text = cdata
178
+
179
+ if str not in typemap:
180
+ typemap[str] = add_text
181
+ if unicode not in typemap:
182
+ typemap[unicode] = add_text
183
+ if ET.CDATA not in typemap:
184
+ typemap[ET.CDATA] = add_cdata
185
+
186
+ def add_dict(elem, item):
187
+ attrib = elem.attrib
188
+ for k, v in item.items():
189
+ if isinstance(v, basestring):
190
+ attrib[k] = v
191
+ else:
192
+ attrib[k] = typemap[type(v)](None, v)
193
+
194
+ if dict not in typemap:
195
+ typemap[dict] = add_dict
196
+
197
+ self._typemap = typemap
198
+
199
+ def __call__(self, tag, *children, **attrib):
200
+ typemap = self._typemap
201
+
202
+ # We'll usually get a 'str', and the compiled type check is very fast.
203
+ if not isinstance(tag, str) and isinstance(tag, _QName):
204
+ # A QName is explicitly qualified, do not look at self._namespace.
205
+ tag = tag.text
206
+ elif self._namespace is not None and tag[0] != '{':
207
+ tag = self._namespace + tag
208
+ elem = self._makeelement(tag, nsmap=self._nsmap)
209
+ if attrib:
210
+ typemap[dict](elem, attrib)
211
+
212
+ for item in children:
213
+ if callable(item):
214
+ item = item()
215
+ t = typemap.get(type(item))
216
+ if t is None:
217
+ if ET.iselement(item):
218
+ elem.append(item)
219
+ continue
220
+ for basetype in type(item).__mro__:
221
+ # See if the typemap knows of any of this type's bases.
222
+ t = typemap.get(basetype)
223
+ if t is not None:
224
+ break
225
+ else:
226
+ raise TypeError("bad argument type: %s(%r)" %
227
+ (type(item).__name__, item))
228
+ v = t(elem, item)
229
+ if v:
230
+ typemap.get(type(v))(elem, v)
231
+
232
+ return elem
233
+
234
+ def __getattr__(self, tag):
235
+ return partial(self, tag)
236
+
237
+ # Allow subscripting ElementMaker in type annotions (PEP 560)
238
+ def __class_getitem__(cls, item):
239
+ return _GenericAlias(cls, item)
240
+
241
+
242
+ # create factory object
243
+ E = ElementMaker()