selectolax 0.3.29__cp311-cp311-macosx_10_9_x86_64.whl → 0.3.30__cp311-cp311-macosx_10_9_x86_64.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 +1 -1
- selectolax/lexbor/node.pxi +6 -6
- selectolax/lexbor/selection.pxi +6 -0
- selectolax/lexbor.c +1578 -1429
- selectolax/lexbor.cpython-311-darwin.so +0 -0
- selectolax/lexbor.pyi +5 -0
- selectolax/lexbor.pyx +6 -0
- selectolax/modest/node.pxi +8 -6
- selectolax/parser.c +3316 -3001
- selectolax/parser.cpython-311-darwin.so +0 -0
- selectolax/parser.pyx +15 -4
- {selectolax-0.3.29.dist-info → selectolax-0.3.30.dist-info}/METADATA +20 -17
- selectolax-0.3.30.dist-info/RECORD +26 -0
- {selectolax-0.3.29.dist-info → selectolax-0.3.30.dist-info}/WHEEL +2 -1
- selectolax-0.3.29.dist-info/RECORD +0 -26
- {selectolax-0.3.29.dist-info → selectolax-0.3.30.dist-info}/licenses/LICENSE +0 -0
- {selectolax-0.3.29.dist-info → selectolax-0.3.30.dist-info}/top_level.txt +0 -0
selectolax/__init__.py
CHANGED
selectolax/lexbor/node.pxi
CHANGED
|
@@ -6,16 +6,16 @@ _TAG_TO_NAME = {
|
|
|
6
6
|
0x0004: "-comment",
|
|
7
7
|
}
|
|
8
8
|
ctypedef fused str_or_LexborNode:
|
|
9
|
-
|
|
9
|
+
str
|
|
10
10
|
bytes
|
|
11
11
|
LexborNode
|
|
12
12
|
|
|
13
13
|
cdef inline bytes to_bytes(str_or_LexborNode value):
|
|
14
14
|
cdef bytes bytes_val
|
|
15
|
-
if isinstance(value,
|
|
16
|
-
bytes_val = value.encode(
|
|
15
|
+
if isinstance(value, unicode):
|
|
16
|
+
bytes_val = <bytes>value.encode("utf-8")
|
|
17
17
|
elif isinstance(value, bytes):
|
|
18
|
-
bytes_val =
|
|
18
|
+
bytes_val = <bytes>value
|
|
19
19
|
return bytes_val
|
|
20
20
|
|
|
21
21
|
@cython.final
|
|
@@ -431,7 +431,7 @@ cdef class LexborNode:
|
|
|
431
431
|
>>> tree.css_first('i').unwrap()
|
|
432
432
|
>>> tree.html
|
|
433
433
|
'<html><head></head><body><div>Hello world!</div></body></html>'
|
|
434
|
-
|
|
434
|
+
|
|
435
435
|
Note: by default, empty tags are ignored, use "delete_empty" to change this.
|
|
436
436
|
"""
|
|
437
437
|
if self.node.first_child == NULL:
|
|
@@ -472,7 +472,7 @@ cdef class LexborNode:
|
|
|
472
472
|
>>> tree.body.unwrap_tags(['i','a'])
|
|
473
473
|
>>> tree.body.html
|
|
474
474
|
'<body><div>Hello world!</div></body>'
|
|
475
|
-
|
|
475
|
+
|
|
476
476
|
Note: by default, empty tags are ignored, use "delete_empty" to change this.
|
|
477
477
|
"""
|
|
478
478
|
|
selectolax/lexbor/selection.pxi
CHANGED
|
@@ -38,6 +38,9 @@ cdef class LexborCSSSelector:
|
|
|
38
38
|
cdef lxb_char_t* c_selector
|
|
39
39
|
cdef lxb_css_selector_list_t * selectors_list
|
|
40
40
|
|
|
41
|
+
if not isinstance(query, str):
|
|
42
|
+
raise TypeError("Query must be a string.")
|
|
43
|
+
|
|
41
44
|
bytes_query = query.encode(_ENCODING)
|
|
42
45
|
selectors_list = lxb_css_selectors_parse(self.parser, <lxb_char_t *> bytes_query, <size_t>len(query))
|
|
43
46
|
|
|
@@ -59,6 +62,9 @@ cdef class LexborCSSSelector:
|
|
|
59
62
|
cdef lxb_char_t * c_selector
|
|
60
63
|
cdef lxb_css_selector_list_t * selectors_list
|
|
61
64
|
|
|
65
|
+
if not isinstance(query, str):
|
|
66
|
+
raise TypeError("Query must be a string.")
|
|
67
|
+
|
|
62
68
|
bytes_query = query.encode(_ENCODING)
|
|
63
69
|
selectors_list = lxb_css_selectors_parse(self.parser, <lxb_char_t *> bytes_query, <size_t> len(query))
|
|
64
70
|
|