selectolax 0.3.24__cp310-cp310-musllinux_1_2_aarch64.whl → 0.3.26__cp310-cp310-musllinux_1_2_aarch64.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/util.pxi +19 -0
- selectolax/lexbor.c +21690 -16316
- selectolax/lexbor.cpython-310-aarch64-linux-gnu.so +0 -0
- selectolax/lexbor.pyi +86 -36
- selectolax/lexbor.pyx +1 -0
- selectolax/modest/util.pxi +19 -0
- selectolax/parser.c +6696 -1318
- selectolax/parser.cpython-310-aarch64-linux-gnu.so +0 -0
- selectolax/parser.pyi +87 -35
- selectolax/parser.pyx +1 -0
- selectolax/utils.pxi +94 -0
- {selectolax-0.3.24.dist-info → selectolax-0.3.26.dist-info}/METADATA +7 -2
- selectolax-0.3.26.dist-info/RECORD +26 -0
- selectolax-0.3.24.dist-info/RECORD +0 -24
- {selectolax-0.3.24.dist-info → selectolax-0.3.26.dist-info}/LICENSE +0 -0
- {selectolax-0.3.24.dist-info → selectolax-0.3.26.dist-info}/WHEEL +0 -0
- {selectolax-0.3.24.dist-info → selectolax-0.3.26.dist-info}/top_level.txt +0 -0
|
Binary file
|
selectolax/lexbor.pyi
CHANGED
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
from typing import Iterator, TypeVar, NoReturn
|
|
1
|
+
from typing import Any, Iterator, Literal, TypeVar, NoReturn, overload
|
|
2
2
|
|
|
3
3
|
DefaultT = TypeVar("DefaultT")
|
|
4
4
|
|
|
5
5
|
class LexborAttributes:
|
|
6
6
|
@staticmethod
|
|
7
|
-
def create(node:
|
|
7
|
+
def create(node: LexborAttributes) -> LexborAttributes: ...
|
|
8
8
|
def keys(self) -> Iterator[str]: ...
|
|
9
|
-
def items(self) -> Iterator[tuple[str, str]]: ...
|
|
10
|
-
def values(self) -> Iterator[str]: ...
|
|
11
|
-
def
|
|
9
|
+
def items(self) -> Iterator[tuple[str, str | None]]: ...
|
|
10
|
+
def values(self) -> Iterator[str | None]: ...
|
|
11
|
+
def __iter__(self) -> Iterator[str]: ...
|
|
12
|
+
def __len__(self) -> int: ...
|
|
13
|
+
def __getitem__(self, key: str) -> str | None: ...
|
|
14
|
+
def __setitem__(self, key: str, value: str) -> None: ...
|
|
15
|
+
def __delitem__(self, key: str) -> None: ...
|
|
16
|
+
def __contains__(self, key: str) -> bool: ...
|
|
17
|
+
def __repr__(self) -> str: ...
|
|
18
|
+
@overload
|
|
19
|
+
def get(self, key: str, default: DefaultT) -> DefaultT | str | None: ...
|
|
20
|
+
@overload
|
|
21
|
+
def get(self, key: str, default: None = ...) -> str | None: ...
|
|
22
|
+
@overload
|
|
23
|
+
def sget(self, key: str, default: str | DefaultT) -> str | DefaultT: ...
|
|
24
|
+
@overload
|
|
12
25
|
def sget(self, key: str, default: str = "") -> str: ...
|
|
13
26
|
|
|
14
27
|
class LexborSelector:
|
|
@@ -20,37 +33,38 @@ class LexborSelector:
|
|
|
20
33
|
def any_matches(self) -> bool: ...
|
|
21
34
|
def text_contains(
|
|
22
35
|
self, text: str, deep: bool = True, separator: str = "", strip: bool = False
|
|
23
|
-
) ->
|
|
36
|
+
) -> LexborSelector: ...
|
|
24
37
|
def any_text_contains(
|
|
25
38
|
self, text: str, deep: bool = True, separator: str = "", strip: bool = False
|
|
26
39
|
) -> bool: ...
|
|
27
40
|
def attribute_longer_than(
|
|
28
41
|
self, attribute: str, length: int, start: str | None = None
|
|
29
|
-
) ->
|
|
42
|
+
) -> LexborSelector: ...
|
|
30
43
|
def any_attribute_longer_than(
|
|
31
44
|
self, attribute: str, length: int, start: str | None = None
|
|
32
45
|
) -> bool: ...
|
|
33
46
|
|
|
34
47
|
class LexborCSSSelector:
|
|
35
48
|
def __init__(self): ...
|
|
36
|
-
def find(self, query: str, node:
|
|
37
|
-
def any_matches(self, query: str, node:
|
|
49
|
+
def find(self, query: str, node: LexborNode) -> list[LexborNode]: ...
|
|
50
|
+
def any_matches(self, query: str, node: LexborNode) -> bool: ...
|
|
38
51
|
|
|
39
52
|
class LexborNode:
|
|
53
|
+
parser: LexborHTMLParser
|
|
40
54
|
@property
|
|
41
55
|
def mem_id(self) -> int: ...
|
|
42
56
|
@property
|
|
43
|
-
def child(self) ->
|
|
57
|
+
def child(self) -> LexborNode | None: ...
|
|
44
58
|
@property
|
|
45
|
-
def first_child(self) ->
|
|
59
|
+
def first_child(self) -> LexborNode | None: ...
|
|
46
60
|
@property
|
|
47
|
-
def parent(self) ->
|
|
61
|
+
def parent(self) -> LexborNode | None: ...
|
|
48
62
|
@property
|
|
49
|
-
def next(self) ->
|
|
63
|
+
def next(self) -> LexborNode | None: ...
|
|
50
64
|
@property
|
|
51
|
-
def prev(self) ->
|
|
65
|
+
def prev(self) -> LexborNode | None: ...
|
|
52
66
|
@property
|
|
53
|
-
def last_child(self) ->
|
|
67
|
+
def last_child(self) -> LexborNode | None: ...
|
|
54
68
|
@property
|
|
55
69
|
def html(self) -> str | None: ...
|
|
56
70
|
def __hash__(self) -> int: ...
|
|
@@ -58,10 +72,19 @@ class LexborNode:
|
|
|
58
72
|
def text(
|
|
59
73
|
self, deep: bool = True, separator: str = "", strip: bool = False
|
|
60
74
|
) -> str: ...
|
|
61
|
-
def css(self, query: str) -> list[
|
|
75
|
+
def css(self, query: str) -> list[LexborNode]: ...
|
|
76
|
+
@overload
|
|
62
77
|
def css_first(
|
|
63
|
-
self, query: str, default:
|
|
64
|
-
) ->
|
|
78
|
+
self, query: str, default: Any = ..., strict: Literal[True] = ...
|
|
79
|
+
) -> LexborNode: ...
|
|
80
|
+
@overload
|
|
81
|
+
def css_first(
|
|
82
|
+
self, query: str, default: DefaultT, strict: bool = False
|
|
83
|
+
) -> LexborNode | DefaultT: ...
|
|
84
|
+
@overload
|
|
85
|
+
def css_first(
|
|
86
|
+
self, query: str, default: None = ..., strict: bool = False
|
|
87
|
+
) -> LexborNode | None: ...
|
|
65
88
|
def any_css_matches(self, selectors: tuple[str]) -> bool: ...
|
|
66
89
|
def css_matches(self, selector: str) -> bool: ...
|
|
67
90
|
@property
|
|
@@ -73,22 +96,23 @@ class LexborNode:
|
|
|
73
96
|
@property
|
|
74
97
|
def attributes(self) -> dict[str, str | None]: ...
|
|
75
98
|
@property
|
|
76
|
-
def attrs(self) ->
|
|
99
|
+
def attrs(self) -> LexborAttributes: ...
|
|
77
100
|
@property
|
|
78
|
-
def id(self) ->
|
|
79
|
-
def iter(self, include_text: bool = False) -> Iterator[
|
|
101
|
+
def id(self) -> str | None: ...
|
|
102
|
+
def iter(self, include_text: bool = False) -> Iterator[LexborNode]: ...
|
|
80
103
|
def unwrap(self) -> None: ...
|
|
81
104
|
def unwrap_tags(self, tags: list[str]) -> None: ...
|
|
82
|
-
def traverse(self, include_text: bool = False) -> Iterator[
|
|
83
|
-
def replace_with(self, value: bytes | str |
|
|
84
|
-
def insert_before(self, value: bytes | str |
|
|
85
|
-
def insert_after(self, value: bytes | str |
|
|
105
|
+
def traverse(self, include_text: bool = False) -> Iterator[LexborNode]: ...
|
|
106
|
+
def replace_with(self, value: bytes | str | LexborNode) -> None: ...
|
|
107
|
+
def insert_before(self, value: bytes | str | LexborNode) -> None: ...
|
|
108
|
+
def insert_after(self, value: bytes | str | LexborNode) -> None: ...
|
|
109
|
+
def insert_child(self, value: bytes | str | LexborNode) -> None: ...
|
|
86
110
|
@property
|
|
87
111
|
def raw_value(self) -> NoReturn: ...
|
|
88
112
|
def scripts_contain(self, query: str) -> bool: ...
|
|
89
113
|
def scripts_srcs_contain(self, queries: tuple[str]) -> bool: ...
|
|
90
114
|
def remove(self, recursive: bool = True) -> None: ...
|
|
91
|
-
def select(self, query: str | None = None) ->
|
|
115
|
+
def select(self, query: str | None = None) -> LexborSelector: ...
|
|
92
116
|
@property
|
|
93
117
|
def text_content(self) -> str | None: ...
|
|
94
118
|
|
|
@@ -97,26 +121,52 @@ class LexborHTMLParser:
|
|
|
97
121
|
@property
|
|
98
122
|
def selector(self) -> "LexborCSSSelector": ...
|
|
99
123
|
@property
|
|
100
|
-
def root(self) ->
|
|
124
|
+
def root(self) -> LexborNode | None: ...
|
|
101
125
|
@property
|
|
102
|
-
def body(self) ->
|
|
126
|
+
def body(self) -> LexborNode | None: ...
|
|
103
127
|
@property
|
|
104
|
-
def head(self) ->
|
|
105
|
-
def tags(self, name: str) -> list[
|
|
128
|
+
def head(self) -> LexborNode | None: ...
|
|
129
|
+
def tags(self, name: str) -> list[LexborNode]: ...
|
|
106
130
|
def text(
|
|
107
131
|
self, deep: bool = True, separator: str = "", strip: bool = False
|
|
108
132
|
) -> str: ...
|
|
109
133
|
@property
|
|
110
|
-
def html(self) ->
|
|
111
|
-
def css(self, query: str) -> list[
|
|
134
|
+
def html(self) -> str | None: ...
|
|
135
|
+
def css(self, query: str) -> list[LexborNode]: ...
|
|
136
|
+
@overload
|
|
137
|
+
def css_first(
|
|
138
|
+
self, query: str, default: Any = ..., strict: Literal[True] = ...
|
|
139
|
+
) -> LexborNode: ...
|
|
140
|
+
@overload
|
|
112
141
|
def css_first(
|
|
113
|
-
self, query: str, default: DefaultT
|
|
114
|
-
) ->
|
|
142
|
+
self, query: str, default: DefaultT, strict: bool = False
|
|
143
|
+
) -> LexborNode | DefaultT: ...
|
|
144
|
+
@overload
|
|
145
|
+
def css_first(
|
|
146
|
+
self, query: str, default: None = ..., strict: bool = False
|
|
147
|
+
) -> LexborNode | None: ...
|
|
115
148
|
def strip_tags(self, tags: list[str], recursive: bool = False) -> None: ...
|
|
116
|
-
def select(self, query: str | None = None) ->
|
|
149
|
+
def select(self, query: str | None = None) -> LexborSelector | None: ...
|
|
117
150
|
def any_css_matches(self, selectors: tuple[str]) -> bool: ...
|
|
118
151
|
def scripts_contain(self, query: str) -> bool: ...
|
|
119
152
|
def scripts_srcs_contain(self, queries: tuple[str]) -> bool: ...
|
|
120
153
|
def css_matches(self, selector: str) -> bool: ...
|
|
121
|
-
def clone(self) ->
|
|
154
|
+
def clone(self) -> LexborHTMLParser: ...
|
|
122
155
|
def unwrap_tags(self, tags: list[str]) -> None: ...
|
|
156
|
+
|
|
157
|
+
def create_tag(tag: str) -> LexborNode:
|
|
158
|
+
"""
|
|
159
|
+
Given an HTML tag name, e.g. `"div"`, create a single empty node for that tag,
|
|
160
|
+
e.g. `"<div></div>"`.
|
|
161
|
+
"""
|
|
162
|
+
...
|
|
163
|
+
|
|
164
|
+
def parse_fragment(html: str) -> list[LexborNode]:
|
|
165
|
+
"""
|
|
166
|
+
Given HTML, parse it into a list of Nodes, such that the nodes
|
|
167
|
+
correspond to the given HTML.
|
|
168
|
+
|
|
169
|
+
For contrast, HTMLParser adds `<html>`, `<head>`, and `<body>` tags
|
|
170
|
+
if they are missing. This function does not add these tags.
|
|
171
|
+
"""
|
|
172
|
+
...
|
selectolax/lexbor.pyx
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
include "../utils.pxi"
|
|
2
|
+
|
|
3
|
+
def create_tag(tag: str):
|
|
4
|
+
"""
|
|
5
|
+
Given an HTML tag name, e.g. `"div"`, create a single empty node for that tag,
|
|
6
|
+
e.g. `"<div></div>"`.
|
|
7
|
+
"""
|
|
8
|
+
return do_create_tag(tag, HTMLParser)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def parse_fragment(html: str):
|
|
12
|
+
"""
|
|
13
|
+
Given HTML, parse it into a list of Nodes, such that the nodes
|
|
14
|
+
correspond to the given HTML.
|
|
15
|
+
|
|
16
|
+
For contrast, HTMLParser adds `<html>`, `<head>`, and `<body>` tags
|
|
17
|
+
if they are missing. This function does not add these tags.
|
|
18
|
+
"""
|
|
19
|
+
return do_parse_fragment(html, HTMLParser)
|