selectolax 0.3.29__cp311-cp311-win32.whl → 0.4.0__cp311-cp311-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.
Potentially problematic release.
This version of selectolax might be problematic. Click here for more details.
- selectolax/__init__.py +3 -5
- selectolax/lexbor/attrs.pxi +26 -9
- selectolax/lexbor/node.pxi +215 -60
- selectolax/lexbor/node_remove.pxi +29 -0
- selectolax/lexbor/selection.pxi +57 -26
- selectolax/lexbor/util.pxi +1 -0
- selectolax/lexbor.c +54892 -55311
- selectolax/lexbor.cp311-win32.pyd +0 -0
- selectolax/lexbor.pxd +44 -40
- selectolax/lexbor.pyi +847 -65
- selectolax/lexbor.pyx +94 -21
- selectolax/modest/node.pxi +49 -43
- selectolax/modest/selection.pxi +24 -22
- selectolax/modest/util.pxi +1 -0
- selectolax/parser.c +50273 -52325
- selectolax/parser.cp311-win32.pyd +0 -0
- selectolax/parser.pxd +17 -20
- selectolax/parser.pyi +493 -46
- selectolax/parser.pyx +41 -33
- selectolax/utils.pxi +13 -3
- selectolax-0.4.0.dist-info/METADATA +32 -0
- selectolax-0.4.0.dist-info/RECORD +27 -0
- {selectolax-0.3.29.dist-info → selectolax-0.4.0.dist-info}/WHEEL +1 -1
- selectolax-0.3.29.dist-info/METADATA +0 -194
- selectolax-0.3.29.dist-info/RECORD +0 -26
- {selectolax-0.3.29.dist-info → selectolax-0.4.0.dist-info}/licenses/LICENSE +0 -0
- {selectolax-0.3.29.dist-info → selectolax-0.4.0.dist-info}/top_level.txt +0 -0
|
Binary file
|
selectolax/lexbor.pxd
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from libc.stdint cimport
|
|
1
|
+
from libc.stdint cimport uint8_t, uint32_t, uintptr_t
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
cdef extern from "lexbor/core/core.h" nogil:
|
|
@@ -31,7 +31,6 @@ cdef extern from "lexbor/core/core.h" nogil:
|
|
|
31
31
|
lexbor_str_t* lexbor_str_create()
|
|
32
32
|
lxb_char_t * lexbor_str_data_noi(lexbor_str_t *str)
|
|
33
33
|
|
|
34
|
-
|
|
35
34
|
cdef extern from "lexbor/html/html.h" nogil:
|
|
36
35
|
ctypedef unsigned int lxb_html_document_opt_t
|
|
37
36
|
|
|
@@ -54,29 +53,26 @@ cdef extern from "lexbor/html/html.h" nogil:
|
|
|
54
53
|
void *events
|
|
55
54
|
|
|
56
55
|
ctypedef struct lexbor_str_t:
|
|
57
|
-
lxb_char_t *data
|
|
58
|
-
size_t length
|
|
59
|
-
|
|
56
|
+
lxb_char_t *data
|
|
57
|
+
size_t length
|
|
60
58
|
|
|
61
59
|
ctypedef struct lxb_dom_node_t:
|
|
62
60
|
lxb_dom_event_target_t event_target
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
|
|
65
62
|
uintptr_t local_name
|
|
66
63
|
uintptr_t prefix
|
|
67
64
|
uintptr_t ns
|
|
68
|
-
|
|
65
|
+
|
|
69
66
|
lxb_dom_document_t *owner_document
|
|
70
|
-
|
|
67
|
+
|
|
71
68
|
lxb_dom_node_t *next
|
|
72
69
|
lxb_dom_node_t *prev
|
|
73
70
|
lxb_dom_node_t *parent
|
|
74
71
|
lxb_dom_node_t *first_child
|
|
75
72
|
lxb_dom_node_t *last_child
|
|
76
73
|
void *user
|
|
77
|
-
|
|
78
|
-
lxb_dom_node_type_t type
|
|
79
74
|
|
|
75
|
+
lxb_dom_node_type_t type
|
|
80
76
|
|
|
81
77
|
ctypedef struct lxb_dom_document_t:
|
|
82
78
|
lxb_dom_node_t node
|
|
@@ -104,7 +100,6 @@ cdef extern from "lexbor/html/html.h" nogil:
|
|
|
104
100
|
|
|
105
101
|
bint scripting
|
|
106
102
|
|
|
107
|
-
|
|
108
103
|
ctypedef struct lxb_html_document_t:
|
|
109
104
|
lxb_dom_document_t dom_document
|
|
110
105
|
|
|
@@ -128,7 +123,6 @@ cdef extern from "lexbor/html/html.h" nogil:
|
|
|
128
123
|
LXB_HTML_PARSER_STATE_FRAGMENT_PROCESS = 0x03
|
|
129
124
|
LXB_HTML_PARSER_STATE_ERROR = 0x04
|
|
130
125
|
|
|
131
|
-
|
|
132
126
|
ctypedef enum lxb_dom_node_type_t:
|
|
133
127
|
LXB_DOM_NODE_TYPE_ELEMENT = 0x01
|
|
134
128
|
LXB_DOM_NODE_TYPE_ATTRIBUTE = 0x02
|
|
@@ -175,10 +169,9 @@ cdef extern from "lexbor/html/html.h" nogil:
|
|
|
175
169
|
size_t length
|
|
176
170
|
size_t struct_size
|
|
177
171
|
|
|
178
|
-
|
|
179
172
|
ctypedef struct lxb_html_tree_pending_table_t
|
|
180
|
-
ctypedef bint lxb_html_tree_insertion_mode_f
|
|
181
|
-
ctypedef lxb_status_t lxb_html_tree_append_attr_f
|
|
173
|
+
ctypedef bint lxb_html_tree_insertion_mode_f
|
|
174
|
+
ctypedef lxb_status_t lxb_html_tree_append_attr_f
|
|
182
175
|
|
|
183
176
|
ctypedef struct lxb_html_tree_t:
|
|
184
177
|
|
|
@@ -189,13 +182,13 @@ cdef extern from "lexbor/html/html.h" nogil:
|
|
|
189
182
|
|
|
190
183
|
lxb_html_form_element_t *form
|
|
191
184
|
|
|
192
|
-
lexbor_array_t *open_elements
|
|
193
|
-
lexbor_array_t *active_formatting
|
|
194
|
-
lexbor_array_obj_t *template_insertion_modes
|
|
185
|
+
lexbor_array_t *open_elements
|
|
186
|
+
lexbor_array_t *active_formatting
|
|
187
|
+
lexbor_array_obj_t *template_insertion_modes
|
|
195
188
|
|
|
196
|
-
lxb_html_tree_pending_table_t *pending_table
|
|
189
|
+
lxb_html_tree_pending_table_t *pending_table
|
|
197
190
|
|
|
198
|
-
lexbor_array_obj_t *parse_errors
|
|
191
|
+
lexbor_array_obj_t *parse_errors
|
|
199
192
|
|
|
200
193
|
bint foster_parenting
|
|
201
194
|
bint frameset_ok
|
|
@@ -222,6 +215,8 @@ cdef extern from "lexbor/html/html.h" nogil:
|
|
|
222
215
|
|
|
223
216
|
size_t ref_count
|
|
224
217
|
|
|
218
|
+
ctypedef struct lxb_html_element_t
|
|
219
|
+
|
|
225
220
|
# Functions
|
|
226
221
|
lxb_html_document_t * lxb_html_document_create()
|
|
227
222
|
lxb_status_t lxb_html_document_parse(lxb_html_document_t *document, const lxb_char_t *html, size_t size)
|
|
@@ -230,11 +225,18 @@ cdef extern from "lexbor/html/html.h" nogil:
|
|
|
230
225
|
lxb_dom_element_t * lxb_dom_document_element(lxb_dom_document_t *document)
|
|
231
226
|
|
|
232
227
|
lxb_status_t lxb_html_serialize_tree_str(lxb_dom_node_t *node, lexbor_str_t *str)
|
|
228
|
+
lxb_status_t lxb_html_serialize_deep_str(lxb_dom_node_t *node, lexbor_str_t *str)
|
|
229
|
+
lxb_html_element_t* lxb_html_element_inner_html_set(lxb_html_element_t *element,
|
|
230
|
+
const lxb_char_t *html, size_t size)
|
|
233
231
|
|
|
234
232
|
cdef class LexborNode:
|
|
235
|
-
cdef
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
cdef:
|
|
234
|
+
lxb_dom_node_t *node
|
|
235
|
+
public LexborHTMLParser parser
|
|
236
|
+
|
|
237
|
+
@staticmethod
|
|
238
|
+
cdef LexborNode new(lxb_dom_node_t *node, LexborHTMLParser parser)
|
|
239
|
+
|
|
238
240
|
|
|
239
241
|
cdef class LexborCSSSelector:
|
|
240
242
|
cdef lxb_css_parser_t* parser
|
|
@@ -242,15 +244,17 @@ cdef class LexborCSSSelector:
|
|
|
242
244
|
cdef lxb_css_selectors_t * css_selectors
|
|
243
245
|
cdef public list results
|
|
244
246
|
cdef public LexborNode current_node
|
|
245
|
-
cdef _create_css_parser(self)
|
|
246
|
-
cpdef find(self, str query, LexborNode node)
|
|
247
|
-
cpdef
|
|
247
|
+
cdef int _create_css_parser(self) except -1
|
|
248
|
+
cpdef list find(self, str query, LexborNode node)
|
|
249
|
+
cpdef list find_first(self, str query, LexborNode node)
|
|
250
|
+
cpdef list _find(self, str query, LexborNode node, bint only_first)
|
|
251
|
+
cpdef int any_matches(self, str query, LexborNode node) except -1
|
|
248
252
|
|
|
249
253
|
cdef class LexborHTMLParser:
|
|
250
254
|
cdef lxb_html_document_t *document
|
|
251
255
|
cdef public bytes raw_html
|
|
252
256
|
cdef LexborCSSSelector _selector
|
|
253
|
-
cdef _parse_html(self, char* html, size_t html_len)
|
|
257
|
+
cdef int _parse_html(self, char* html, size_t html_len) except -1
|
|
254
258
|
cdef object cached_script_texts
|
|
255
259
|
cdef object cached_script_srcs
|
|
256
260
|
|
|
@@ -267,8 +271,8 @@ cdef extern from "lexbor/dom/dom.h" nogil:
|
|
|
267
271
|
ctypedef lexbor_action_t (*lxb_dom_node_simple_walker_f)(lxb_dom_node_t *node, void *ctx)
|
|
268
272
|
|
|
269
273
|
ctypedef struct lxb_dom_character_data_t:
|
|
270
|
-
lxb_dom_node_t node
|
|
271
|
-
lexbor_str_t data
|
|
274
|
+
lxb_dom_node_t node
|
|
275
|
+
lexbor_str_t data
|
|
272
276
|
|
|
273
277
|
ctypedef struct lxb_dom_text_t:
|
|
274
278
|
lxb_dom_character_data_t char_data
|
|
@@ -289,19 +293,20 @@ cdef extern from "lexbor/dom/dom.h" nogil:
|
|
|
289
293
|
lxb_dom_element_t *owner
|
|
290
294
|
|
|
291
295
|
lxb_dom_attr_t *next
|
|
292
|
-
lxb_dom_attr_t *prev
|
|
293
|
-
|
|
296
|
+
lxb_dom_attr_t *prev
|
|
294
297
|
|
|
295
298
|
lxb_dom_collection_t * lxb_dom_collection_make(lxb_dom_document_t *document, size_t start_list_size)
|
|
296
299
|
lxb_char_t * lxb_dom_node_text_content(lxb_dom_node_t *node, size_t *len)
|
|
300
|
+
lxb_status_t lxb_dom_node_text_content_set(lxb_dom_node_t *node, const lxb_char_t *content, size_t len)
|
|
301
|
+
void lxb_dom_node_remove(lxb_dom_node_t *node)
|
|
297
302
|
void * lxb_dom_document_destroy_text_noi(lxb_dom_document_t *document, lxb_char_t *text)
|
|
298
|
-
lxb_dom_node_t *
|
|
303
|
+
lxb_dom_node_t * lxb_dom_document_root(lxb_dom_document_t *document)
|
|
299
304
|
lxb_char_t * lxb_dom_element_qualified_name(lxb_dom_element_t *element, size_t *len)
|
|
300
305
|
lxb_dom_node_t * lxb_dom_node_destroy(lxb_dom_node_t *node)
|
|
301
306
|
lxb_dom_node_t * lxb_dom_node_destroy_deep(lxb_dom_node_t *root)
|
|
302
307
|
lxb_dom_attr_t * lxb_dom_element_first_attribute_noi(lxb_dom_element_t *element)
|
|
303
308
|
|
|
304
|
-
const lxb_char_t * lxb_dom_attr_local_name_noi(lxb_dom_attr_t *attr, size_t *len)
|
|
309
|
+
const lxb_char_t * lxb_dom_attr_local_name_noi(lxb_dom_attr_t *attr, size_t *len)
|
|
305
310
|
const lxb_char_t * lxb_dom_attr_value_noi(lxb_dom_attr_t *attr, size_t *len)
|
|
306
311
|
|
|
307
312
|
lxb_dom_attr_t * lxb_dom_element_set_attribute(lxb_dom_element_t *element,
|
|
@@ -314,13 +319,13 @@ cdef extern from "lexbor/dom/dom.h" nogil:
|
|
|
314
319
|
lxb_tag_id_t lxb_dom_node_tag_id_noi(lxb_dom_node_t *node)
|
|
315
320
|
lxb_dom_node_t * lxb_dom_document_import_node(lxb_dom_document_t *doc, lxb_dom_node_t *node, bint deep)
|
|
316
321
|
void lxb_dom_node_insert_after(lxb_dom_node_t *to, lxb_dom_node_t *node)
|
|
317
|
-
lxb_status_t lxb_dom_node_replace_all(lxb_dom_node_t *parent, lxb_dom_node_t *node)
|
|
322
|
+
lxb_status_t lxb_dom_node_replace_all(lxb_dom_node_t *parent, lxb_dom_node_t *node)
|
|
318
323
|
void lxb_dom_node_insert_child(lxb_dom_node_t *to, lxb_dom_node_t *node)
|
|
319
324
|
void lxb_dom_node_insert_before(lxb_dom_node_t *to, lxb_dom_node_t *node)
|
|
320
325
|
void lxb_dom_node_insert_after(lxb_dom_node_t *to, lxb_dom_node_t *node)
|
|
321
|
-
|
|
322
326
|
lxb_dom_text_t * lxb_dom_document_create_text_node(lxb_dom_document_t *document, const lxb_char_t *data, size_t len)
|
|
323
327
|
void lxb_dom_node_simple_walk(lxb_dom_node_t *root, lxb_dom_node_simple_walker_f walker_cb, void *ctx)
|
|
328
|
+
lxb_dom_node_t* lxb_dom_node_clone(lxb_dom_node_t *node, bint deep)
|
|
324
329
|
|
|
325
330
|
|
|
326
331
|
cdef extern from "lexbor/dom/interfaces/element.h" nogil:
|
|
@@ -348,7 +353,7 @@ cdef extern from "lexbor/css/css.h" nogil:
|
|
|
348
353
|
lxb_css_parser_t * lxb_css_parser_create()
|
|
349
354
|
lxb_status_t lxb_css_parser_init(lxb_css_parser_t *parser, lxb_css_syntax_tokenizer_t *tkz)
|
|
350
355
|
lxb_css_parser_t * lxb_css_parser_destroy(lxb_css_parser_t *parser, bint self_destroy)
|
|
351
|
-
lxb_css_memory_t * lxb_css_memory_destroy(lxb_css_memory_t *memory, bint self_destroy)
|
|
356
|
+
lxb_css_memory_t * lxb_css_memory_destroy(lxb_css_memory_t *memory, bint self_destroy)
|
|
352
357
|
void lxb_css_selector_list_destroy_memory(lxb_css_selector_list_t *list)
|
|
353
358
|
|
|
354
359
|
|
|
@@ -559,8 +564,7 @@ cdef extern from "lexbor/selectors/selectors.h" nogil:
|
|
|
559
564
|
ctypedef struct lxb_selectors_t
|
|
560
565
|
ctypedef struct lxb_css_selector_list_t
|
|
561
566
|
ctypedef struct lxb_css_selector_specificity_t
|
|
562
|
-
ctypedef lxb_status_t (*lxb_selectors_cb_f)(lxb_dom_node_t *node, lxb_css_selector_specificity_t *spec,
|
|
563
|
-
void *ctx)
|
|
567
|
+
ctypedef lxb_status_t (*lxb_selectors_cb_f)(lxb_dom_node_t *node, lxb_css_selector_specificity_t *spec, void *ctx)
|
|
564
568
|
ctypedef enum lxb_selectors_opt_t:
|
|
565
569
|
LXB_SELECTORS_OPT_DEFAULT = 0x00
|
|
566
570
|
LXB_SELECTORS_OPT_MATCH_ROOT = 1 << 1
|
|
@@ -577,4 +581,4 @@ cdef extern from "lexbor/selectors/selectors.h" nogil:
|
|
|
577
581
|
lxb_status_t lxb_selectors_init(lxb_selectors_t *selectors)
|
|
578
582
|
lxb_selectors_t * lxb_selectors_destroy(lxb_selectors_t *selectors, bint self_destroy)
|
|
579
583
|
lxb_status_t lxb_selectors_find(lxb_selectors_t *selectors, lxb_dom_node_t *root,
|
|
580
|
-
|
|
584
|
+
lxb_css_selector_list_t *list, lxb_selectors_cb_f cb, void *ctx)
|