selectolax 0.3.25__cp312-cp312-musllinux_1_2_i686.whl → 0.3.27__cp312-cp312-musllinux_1_2_i686.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/parser.pyi CHANGED
@@ -1,15 +1,28 @@
1
- from typing import Iterator, TypeVar, Literal
1
+ from typing import Any, Iterator, TypeVar, Literal, overload
2
2
 
3
3
  DefaultT = TypeVar("DefaultT")
4
4
 
5
5
  class _Attributes:
6
6
  @staticmethod
7
- def create(node: "Node", decode_errors: str) -> "_Attributes": ...
7
+ def create(node: Node, decode_errors: str) -> _Attributes: ...
8
8
  def keys(self) -> Iterator[str]: ...
9
- def items(self) -> Iterator[tuple[str, str]]: ...
10
- def values(self) -> Iterator[str]: ...
11
- def get(self, key, default: DefaultT | None = None) -> str | DefaultT: ...
12
- def sget(self, key, default: str = "") -> str | DefaultT: ...
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
25
+ def sget(self, key: str, default: str = "") -> str: ...
13
26
 
14
27
  class Selector:
15
28
  """An advanced CSS selector that supports additional operations.
@@ -18,12 +31,12 @@ class Selector:
18
31
 
19
32
  Please note, this is an experimental feature that can change in the future."""
20
33
 
21
- def __init__(self, node: "Node", query: str): ...
22
- def css(self, query: str) -> "Node":
34
+ def __init__(self, node: Node, query: str): ...
35
+ def css(self, query: str) -> Node:
23
36
  """Evaluate CSS selector against current scope."""
24
37
  ...
25
38
  @property
26
- def matches(self) -> list["Node"]:
39
+ def matches(self) -> list[Node]:
27
40
  """Returns all possible selector matches"""
28
41
  ...
29
42
  @property
@@ -32,7 +45,7 @@ class Selector:
32
45
  ...
33
46
  def text_contains(
34
47
  self, text: str, deep: bool = True, separator: str = "", strip: bool = False
35
- ) -> "Selector":
48
+ ) -> Selector:
36
49
  """Filter all current matches given text."""
37
50
  ...
38
51
  def any_text_contains(
@@ -42,7 +55,7 @@ class Selector:
42
55
  ...
43
56
  def attribute_long_than(
44
57
  self, text: str, length: int, start: str | None = None
45
- ) -> "Selector":
58
+ ) -> Selector:
46
59
  """Filter all current matches by attribute length.
47
60
 
48
61
  Similar to string-length in XPath."""
@@ -56,15 +69,15 @@ class Selector:
56
69
  ...
57
70
 
58
71
  class Node:
59
- parser: "HTMLParser"
72
+ parser: HTMLParser
60
73
  @property
61
- def attributes(self) -> dict[str, None | str]:
74
+ def attributes(self) -> dict[str, str | None]:
62
75
  """Get all attributes that belong to the current node.
63
76
 
64
77
  The value of empty attributes is None."""
65
78
  ...
66
79
  @property
67
- def attrs(self) -> "_Attributes":
80
+ def attrs(self) -> _Attributes:
68
81
  """A dict-like object that is similar to the attributes property, but operates directly on the Node data."""
69
82
  ...
70
83
  @property
@@ -88,10 +101,10 @@ class Node:
88
101
  def text(self, deep: bool = True, separator: str = "", strip: bool = False) -> str:
89
102
  """Returns the text of the node including text of all its child nodes."""
90
103
  ...
91
- def iter(self, include_text: bool = False) -> Iterator["Node"]:
104
+ def iter(self, include_text: bool = False) -> Iterator[Node]:
92
105
  """Iterate over nodes on the current level."""
93
106
  ...
94
- def traverse(self, include_text: bool = False) -> Iterator["Node"]:
107
+ def traverse(self, include_text: bool = False) -> Iterator[Node]:
95
108
  """Iterate over all child and next nodes starting from the current level."""
96
109
  ...
97
110
  @property
@@ -99,30 +112,30 @@ class Node:
99
112
  """Return the name of the current tag (e.g. div, p, img)."""
100
113
  ...
101
114
  @property
102
- def child(self) -> None | "Node":
115
+ def child(self) -> Node | None:
103
116
  """Return the child node."""
104
117
  ...
105
118
  @property
106
- def parent(self) -> None | "Node":
119
+ def parent(self) -> Node | None:
107
120
  """Return the parent node."""
108
121
  ...
109
122
  @property
110
- def next(self) -> None | "Node":
123
+ def next(self) -> Node | None:
111
124
  """Return next node."""
112
125
  ...
113
126
  @property
114
- def prev(self) -> None | "Node":
127
+ def prev(self) -> Node | None:
115
128
  """Return previous node."""
116
129
  ...
117
130
  @property
118
- def last_child(self) -> None | "Node":
131
+ def last_child(self) -> Node | None:
119
132
  """Return last child node."""
120
133
  ...
121
134
  @property
122
- def html(self) -> None | str:
135
+ def html(self) -> str | None:
123
136
  """Return HTML representation of the current node including all its child nodes."""
124
137
  ...
125
- def css(self, query: str) -> list["Node"]:
138
+ def css(self, query: str) -> list[Node]:
126
139
  """Evaluate CSS selector against current node and its child nodes."""
127
140
  ...
128
141
  def any_css_matches(self, selectors: tuple[str]) -> bool:
@@ -131,9 +144,18 @@ class Node:
131
144
  def css_matches(self, selector: str) -> bool:
132
145
  """Returns True if CSS selector matches a node."""
133
146
  ...
147
+ @overload
134
148
  def css_first(
135
- self, query: str, default: DefaultT | None = None, strict: bool = False
136
- ) -> "Node" | DefaultT:
149
+ self, query: str, default: Any = ..., strict: Literal[True] = ...
150
+ ) -> Node: ...
151
+ @overload
152
+ def css_first(
153
+ self, query: str, default: DefaultT, strict: bool = False
154
+ ) -> Node | DefaultT: ...
155
+ @overload
156
+ def css_first(
157
+ self, query: str, default: None = ..., strict: bool = False
158
+ ) -> Node | None:
137
159
  """Evaluate CSS selector against current node and its child nodes."""
138
160
  ...
139
161
  def decompose(self, recursive: bool = True) -> None:
@@ -171,7 +193,7 @@ class Node:
171
193
 
172
194
  Currently, works on text nodes only."""
173
195
  ...
174
- def select(self, query: str | None = None) -> "Selector":
196
+ def select(self, query: str | None = None) -> Selector:
175
197
  """Select nodes given a CSS selector.
176
198
 
177
199
  Works similarly to the css method, but supports chained filtering and extra features.
@@ -208,14 +230,23 @@ class HTMLParser:
208
230
  use_meta_tags: bool = True,
209
231
  decode_errors: Literal["strict", "ignore", "replace"] = "ignore",
210
232
  ): ...
211
- def css(self, query: str) -> list["Node"]:
233
+ def css(self, query: str) -> list[Node]:
212
234
  """A CSS selector.
213
235
 
214
236
  Matches pattern query against HTML tree."""
215
237
  ...
238
+ @overload
239
+ def css_first(
240
+ self, query: str, default: Any = ..., strict: Literal[True] = ...
241
+ ) -> Node: ...
242
+ @overload
243
+ def css_first(
244
+ self, query: str, default: DefaultT, strict: bool = False
245
+ ) -> Node | DefaultT: ...
246
+ @overload
216
247
  def css_first(
217
- self, query: str, default: DefaultT | None = None, strict: bool = False
218
- ) -> DefaultT | "Node":
248
+ self, query: str, default: None = ..., strict: bool = False
249
+ ) -> Node | None:
219
250
  """Same as css but returns only the first match."""
220
251
  ...
221
252
  @property
@@ -225,18 +256,18 @@ class HTMLParser:
225
256
  Returns unknown in case the encoding is not determined."""
226
257
  ...
227
258
  @property
228
- def root(self) -> "Node" | None:
259
+ def root(self) -> Node | None:
229
260
  """Returns root node."""
230
261
  ...
231
262
  @property
232
- def head(self) -> "Node" | None:
263
+ def head(self) -> Node | None:
233
264
  """Returns head node."""
234
265
  ...
235
266
  @property
236
- def body(self) -> "Node" | None:
267
+ def body(self) -> Node | None:
237
268
  """Returns document body."""
238
269
  ...
239
- def tags(self, name: str) -> list["Node"]:
270
+ def tags(self, name: str) -> list[Node]:
240
271
  """Returns a list of tags that match specified name."""
241
272
  ...
242
273
  def text(self, deep: bool = True, separator: str = "", strip: bool = False) -> str:
@@ -249,10 +280,10 @@ class HTMLParser:
249
280
  Works the same as th unwrap method, but applied to a list of tags."""
250
281
  ...
251
282
  @property
252
- def html(self) -> None | str:
283
+ def html(self) -> str | None:
253
284
  """Return HTML representation of the page."""
254
285
  ...
255
- def select(self, query: str | None = None) -> "Selector" | None:
286
+ def select(self, query: str | None = None) -> Selector | None:
256
287
  """Select nodes given a CSS selector.
257
288
 
258
289
  Works similarly to the css method, but supports chained filtering and extra features.
@@ -272,7 +303,7 @@ class HTMLParser:
272
303
  Caches values on the first call to improve performance."""
273
304
  ...
274
305
  def css_matches(self, selector: str) -> bool: ...
275
- def clone(self) -> "HTMLParser":
306
+ def clone(self) -> HTMLParser:
276
307
  """Clone the current tree."""
277
308
  ...
278
309
  def merge_text_nodes(self):
@@ -281,14 +312,14 @@ class HTMLParser:
281
312
  This is useful for text extraction."""
282
313
  ...
283
314
 
284
- def create_tag(tag: str) -> "Node":
315
+ def create_tag(tag: str) -> Node:
285
316
  """
286
317
  Given an HTML tag name, e.g. `"div"`, create a single empty node for that tag,
287
318
  e.g. `"<div></div>"`.
288
319
  """
289
320
  ...
290
321
 
291
- def parse_fragment(html: str) -> list["Node"]:
322
+ def parse_fragment(html: str) -> list[Node]:
292
323
  """
293
324
  Given HTML, parse it into a list of Nodes, such that the nodes
294
325
  correspond to the given HTML.
selectolax/utils.pxi CHANGED
@@ -34,7 +34,7 @@ def get_fragment_type(
34
34
  tree = parser_cls(html)
35
35
 
36
36
  import re
37
- html_re = re.compile(r"<html|<body|<head", re.IGNORECASE)
37
+ html_re = re.compile(r"<html|<body|<head(?!er)", re.IGNORECASE)
38
38
 
39
39
  has_html = False
40
40
  has_head = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: selectolax
3
- Version: 0.3.25
3
+ Version: 0.3.27
4
4
  Summary: Fast HTML5 parser with CSS selectors.
5
5
  Home-page: https://github.com/rushter/selectolax
6
6
  Author: Artem Golubin
@@ -1,26 +1,26 @@
1
- selectolax/lexbor.pxd,sha256=PwygBdb1blWAQcxXubZS5uffhgcXaqgySNMPFMT02-c,20958
2
- selectolax/lexbor.cpython-312-i386-linux-musl.so,sha256=LEKcn1NJBLa5JfT4hdPcjfIOUz-yHgJ0gTD6-ai_9V4,16891572
3
- selectolax/parser.cpython-312-i386-linux-musl.so,sha256=sK8FEzgOl-BsNHFegqwmTMLyXOQOL8I_ecT1lay82M8,6246756
4
- selectolax/parser.pyi,sha256=gDTx5Qde0rKrWDMSpZZDS5XJbPlERnwSQCN8bg5U4AA,10558
1
+ selectolax/lexbor.pyi,sha256=X2PMQR2XLd2rOPliKSpeFZ_VEf6mOQFTcFm0ChQbzsQ,6544
5
2
  selectolax/parser.pxd,sha256=zZlg1vHUg6o4MXaiwKAo5S5hO_DqBGc4_E10qJ2EcM4,24564
3
+ selectolax/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ selectolax/lexbor.c,sha256=7SRJXN6hy0mWsjF76dgRDMk__7EFx01O2D9mfaH8DK4,2353665
5
+ selectolax/lexbor.pyx,sha256=ffEzBnZjGTsI-H5qck7bfjVRE9vteOhQnDp6RjVD7G0,10750
6
+ selectolax/__init__.py,sha256=c_YcZI0XHUarueRv6JL0z5WjcrLiV5ygw8PGIGFQiKs,175
7
+ selectolax/parser.pyi,sha256=kbR5eWvkJEy-9Hx3L_4JmGy3caIl0ki4SiagWz-fnhw,11557
6
8
  selectolax/base.pxi,sha256=eiPKlY9gG3l49qJoRQVLl1Ljza6z1k0A-met6sDPcqE,89
9
+ selectolax/utils.pxi,sha256=uB0-0naFQPy1JpR2DiIlKnyLyC76yWLnUHSuH11xg6s,3459
10
+ selectolax/lexbor.pxd,sha256=PwygBdb1blWAQcxXubZS5uffhgcXaqgySNMPFMT02-c,20958
11
+ selectolax/parser.c,sha256=TWYQCHK9KIL7277qgc5OEtzCcok8rJJJsmG39f5PCsg,2214825
7
12
  selectolax/parser.pyx,sha256=o1HkYE_nQr3TS7EPlldJx2-ygU9B5FI2uWYFzdF-VaI,12953
8
- selectolax/__init__.py,sha256=oWCGdiVLnaTCmGs0dtRQpNGri89OdU7AwSRoqhmbajI,175
9
- selectolax/lexbor.c,sha256=7rs-9d175hT0mRx49Lwnzbw2Hbd9kqpo6TYhn9oI3UU,2353590
10
- selectolax/lexbor.pyx,sha256=ffEzBnZjGTsI-H5qck7bfjVRE9vteOhQnDp6RjVD7G0,10750
11
- selectolax/lexbor.pyi,sha256=FFVEZfXI8BwvUI0AtNQRUaTTzf66sXq2PWXiggaglug,5543
12
- selectolax/utils.pxi,sha256=rPNMFqS0PRLkQPugwPfj-pnHCzkQzQ2cjIRMPZdR6R8,3453
13
- selectolax/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- selectolax/parser.c,sha256=7APT8EQr5vuogGiSwCRNUi_S32l0YAVV8f1CYtVSkNM,2214750
15
- selectolax/lexbor/util.pxi,sha256=Zq7S-zlyU3wOo49wGHQHnmmhpbkrcJm59ZCTPENcZQA,563
16
- selectolax/lexbor/node.pxi,sha256=1XNzUwCbTYXy4D6rZtHxMpoJ9M-xoprB9wjdsiaWhr0,29346
13
+ selectolax/lexbor.cpython-312-i386-linux-musl.so,sha256=ufQICtfCTvSnTUwmzTSWtRKg0Mp7c-xlGVV7P9WVvnU,16891580
14
+ selectolax/parser.cpython-312-i386-linux-musl.so,sha256=8y6Jne-LP6hI8Tkd--pqLvp2RHCvU_jtxsqTFFtYv3g,6246764
17
15
  selectolax/lexbor/selection.pxi,sha256=PqjvpL6H9uFcmcQWVGfML8FDsTO7tGoZujpA00g9pWk,6444
18
16
  selectolax/lexbor/attrs.pxi,sha256=-518D5v70GgMJhtsxWrWcgIMnXg8afECpUubzq8kqqs,3102
17
+ selectolax/lexbor/util.pxi,sha256=Zq7S-zlyU3wOo49wGHQHnmmhpbkrcJm59ZCTPENcZQA,563
18
+ selectolax/lexbor/node.pxi,sha256=1XNzUwCbTYXy4D6rZtHxMpoJ9M-xoprB9wjdsiaWhr0,29346
19
+ selectolax/modest/selection.pxi,sha256=S55MMxEW2B1oPExB_DRwPM46WoWZU73J3rFRZU1URuQ,6393
19
20
  selectolax/modest/util.pxi,sha256=aX9UnRNTITImHVBTlIs9efOd3EyugLq_Lwuo0zVTiuQ,551
20
21
  selectolax/modest/node.pxi,sha256=NrMzJnQJDCmgTHpUxpMHDyAfQ_AS_n_Cr_2ryEKjyL0,32550
21
- selectolax/modest/selection.pxi,sha256=S55MMxEW2B1oPExB_DRwPM46WoWZU73J3rFRZU1URuQ,6393
22
- selectolax-0.3.25.dist-info/top_level.txt,sha256=e5MuEM2PrQzoDlWetkFli9uXSlxa_ktW5jJEihhaI1c,11
23
- selectolax-0.3.25.dist-info/METADATA,sha256=XbR_TA9gBumRbVEUX7o7IlMBJgDVyAFF0sgmFxCP-v8,5928
24
- selectolax-0.3.25.dist-info/WHEEL,sha256=keQAt_ShtBm9e5UyXQHlogOYqntwDnvEGVyQY3Tkxig,110
25
- selectolax-0.3.25.dist-info/RECORD,,
26
- selectolax-0.3.25.dist-info/LICENSE,sha256=kYggm2ZJzBgL79x1gCsYsx8rFIYP2IE-BdXRV3Rm0NU,1077
22
+ selectolax-0.3.27.dist-info/METADATA,sha256=QwBuZChcMfcqnAmJByM0BzfEPHvJXT2wIA4Acp_6DVU,5928
23
+ selectolax-0.3.27.dist-info/RECORD,,
24
+ selectolax-0.3.27.dist-info/top_level.txt,sha256=e5MuEM2PrQzoDlWetkFli9uXSlxa_ktW5jJEihhaI1c,11
25
+ selectolax-0.3.27.dist-info/WHEEL,sha256=keQAt_ShtBm9e5UyXQHlogOYqntwDnvEGVyQY3Tkxig,110
26
+ selectolax-0.3.27.dist-info/LICENSE,sha256=kYggm2ZJzBgL79x1gCsYsx8rFIYP2IE-BdXRV3Rm0NU,1077