selectolax 0.3.27__cp311-cp311-musllinux_1_2_x86_64.whl → 0.3.28__cp311-cp311-musllinux_1_2_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/attrs.pxi +2 -1
- selectolax/lexbor/node.pxi +1 -1
- selectolax/lexbor/selection.pxi +12 -10
- selectolax/lexbor.c +1174 -1052
- selectolax/lexbor.cpython-311-x86_64-linux-musl.so +0 -0
- selectolax/lexbor.pyi +1 -1
- selectolax/lexbor.pyx +4 -2
- selectolax/parser.c +98 -98
- selectolax/parser.pyi +2 -2
- {selectolax-0.3.27.dist-info → selectolax-0.3.28.dist-info}/LICENSE +1 -1
- {selectolax-0.3.27.dist-info → selectolax-0.3.28.dist-info}/METADATA +7 -1
- selectolax-0.3.28.dist-info/RECORD +26 -0
- selectolax-0.3.27.dist-info/RECORD +0 -26
- {selectolax-0.3.27.dist-info → selectolax-0.3.28.dist-info}/WHEEL +0 -0
- {selectolax-0.3.27.dist-info → selectolax-0.3.28.dist-info}/top_level.txt +0 -0
selectolax/__init__.py
CHANGED
selectolax/lexbor/attrs.pxi
CHANGED
|
@@ -19,8 +19,9 @@ cdef class LexborAttributes:
|
|
|
19
19
|
|
|
20
20
|
while attr != NULL:
|
|
21
21
|
key = lxb_dom_attr_local_name_noi(attr, &str_len)
|
|
22
|
+
if key is not NULL:
|
|
23
|
+
yield key.decode(_ENCODING)
|
|
22
24
|
attr = attr.next
|
|
23
|
-
yield key.decode(_ENCODING)
|
|
24
25
|
|
|
25
26
|
def __setitem__(self, str key, value):
|
|
26
27
|
value = str(value)
|
selectolax/lexbor/node.pxi
CHANGED
selectolax/lexbor/selection.pxi
CHANGED
|
@@ -77,10 +77,12 @@ cdef class LexborCSSSelector:
|
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
def __dealloc__(self):
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
if self.selectors != NULL:
|
|
81
|
+
lxb_selectors_destroy(self.selectors, True)
|
|
82
|
+
if self.parser != NULL:
|
|
83
|
+
lxb_css_parser_destroy(self.parser, True)
|
|
84
|
+
if self.css_selectors != NULL:
|
|
85
|
+
lxb_css_selectors_destroy(self.css_selectors, True)
|
|
84
86
|
|
|
85
87
|
|
|
86
88
|
|
|
@@ -104,16 +106,16 @@ cdef class LexborSelector:
|
|
|
104
106
|
raise SelectolaxError("This features is not supported by the lexbor backend. Please use Modest backend.")
|
|
105
107
|
|
|
106
108
|
@property
|
|
107
|
-
def matches(self):
|
|
109
|
+
def matches(self) -> list:
|
|
108
110
|
"""Returns all possible matches"""
|
|
109
111
|
return self.nodes
|
|
110
112
|
|
|
111
113
|
@property
|
|
112
|
-
def any_matches(self):
|
|
114
|
+
def any_matches(self) -> bool:
|
|
113
115
|
"""Returns True if there are any matches"""
|
|
114
116
|
return bool(self.nodes)
|
|
115
117
|
|
|
116
|
-
def text_contains(self, str text, bool deep=True, str separator='', bool strip=False):
|
|
118
|
+
def text_contains(self, str text, bool deep=True, str separator='', bool strip=False) -> LexborSelector:
|
|
117
119
|
"""Filter all current matches given text."""
|
|
118
120
|
nodes = []
|
|
119
121
|
for node in self.nodes:
|
|
@@ -123,7 +125,7 @@ cdef class LexborSelector:
|
|
|
123
125
|
self.nodes = nodes
|
|
124
126
|
return self
|
|
125
127
|
|
|
126
|
-
def any_text_contains(self, str text, bool deep=True, str separator='', bool strip=False):
|
|
128
|
+
def any_text_contains(self, str text, bool deep=True, str separator='', bool strip=False) -> bool:
|
|
127
129
|
"""Returns True if any node in the current search scope contains specified text"""
|
|
128
130
|
nodes = []
|
|
129
131
|
for node in self.nodes:
|
|
@@ -132,7 +134,7 @@ cdef class LexborSelector:
|
|
|
132
134
|
return True
|
|
133
135
|
return False
|
|
134
136
|
|
|
135
|
-
def attribute_longer_than(self, str attribute, int length, str start = None):
|
|
137
|
+
def attribute_longer_than(self, str attribute, int length, str start = None) -> LexborSelector:
|
|
136
138
|
"""Filter all current matches by attribute length.
|
|
137
139
|
|
|
138
140
|
Similar to `string-length` in XPath.
|
|
@@ -147,7 +149,7 @@ cdef class LexborSelector:
|
|
|
147
149
|
self.nodes = nodes
|
|
148
150
|
return self
|
|
149
151
|
|
|
150
|
-
def any_attribute_longer_than(self, str attribute, int length, str start = None):
|
|
152
|
+
def any_attribute_longer_than(self, str attribute, int length, str start = None) -> bool:
|
|
151
153
|
"""Returns True any href attribute longer than a specified length.
|
|
152
154
|
|
|
153
155
|
Similar to `string-length` in XPath.
|