Skip to content

Commit d5bf66c

Browse files
committed
Fixing third-party stubtest errors
1 parent d03c6f2 commit d5bf66c

File tree

7 files changed

+44
-31
lines changed

7 files changed

+44
-31
lines changed

stubs/tinycss2/tinycss2/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ from .serializer import serialize as serialize, serialize_identifier as serializ
1212
from .tokenizer import parse_component_value_list as parse_component_value_list
1313

1414
__version__: str = ...
15+
VERSION: str = ...

stubs/tinycss2/tinycss2/ast.pyi

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
from collections.abc import Iterable
21
from typing import Literal
32

43
class Node:
5-
__slots__ = str | Iterable[str]
64
source_line: int
75
source_column: int
86
type: str
@@ -11,152 +9,152 @@ class Node:
119
def serialize(self) -> str: ...
1210

1311
class ParseError(Node):
14-
__slots__ = str | Iterable[str]
1512
type: Literal["error"]
1613
kind: str
1714
message: str
15+
repr_format: str
1816
def __init__(self, line: int, column: int, kind: str, message: str) -> None: ...
1917

2018
class Comment(Node):
21-
__slots__ = str | Iterable[str]
2219
type: Literal["comment"]
2320
value: str
21+
repr_format: str
2422
def __init__(self, line: int, column: int, value: str) -> None: ...
2523

2624
class WhitespaceToken(Node):
27-
__slots__ = str | Iterable[str]
2825
type: Literal["whitespace"]
2926
value: str
27+
repr_format: str
3028
def __init__(self, line: int, column: int, value: str) -> None: ...
3129

3230
class LiteralToken(Node):
33-
__slots__ = str | Iterable[str]
3431
type: Literal["literal"]
3532
value: str
33+
repr_format: str
3634
def __init__(self, line: int, column: int, value: str) -> None: ...
3735
def __eq__(self, other: object) -> bool: ...
3836
def __ne__(self, other: object) -> bool: ...
3937

4038
class IdentToken(Node):
41-
__slots__ = str | Iterable[str]
4239
type: Literal["ident"]
4340
value: str
4441
lower_value: str
42+
repr_format: str
4543
def __init__(self, line: int, column: int, value: str) -> None: ...
4644

4745
class AtKeywordToken(Node):
48-
__slots__ = str | Iterable[str]
4946
type: Literal["at-keyword"]
5047
value: str
5148
lower_value: str
49+
repr_format: str
5250
def __init__(self, line: int, column: int, value: str) -> None: ...
5351

5452
class HashToken(Node):
55-
__slots__ = str | Iterable[str]
5653
type: Literal["hash"]
5754
value: str
5855
is_identifier: bool
56+
repr_format: str
5957
def __init__(self, line: int, column: int, value: str, is_identifier: bool) -> None: ...
6058

6159
class StringToken(Node):
62-
__slots__ = str | Iterable[str]
6360
type: Literal["string"]
6461
value: str
6562
representation: str
63+
repr_format: str
6664
def __init__(self, line: int, column: int, value: str, representation: str) -> None: ...
6765

6866
class URLToken(Node):
69-
__slots__ = str | Iterable[str]
7067
type: Literal["url"]
7168
value: str
7269
representation: str
70+
repr_format: str
7371
def __init__(self, line: int, column: int, value: str, representation: str) -> None: ...
7472

7573
class UnicodeRangeToken(Node):
76-
__slots__ = str | Iterable[str]
7774
type: Literal["unicode-range"]
7875
start: int
7976
end: int
77+
repr_format: str
8078
def __init__(self, line: int, column: int, start: int, end: int) -> None: ...
8179

8280
class NumberToken(Node):
83-
__slots__ = str | Iterable[str]
8481
type: Literal["number"]
8582
value: float
8683
int_value: int | None
8784
is_integer: bool
8885
representation: str
86+
repr_format: str
8987
def __init__(self, line: int, column: int, value: float, int_value: int | None, representation: str) -> None: ...
9088

9189
class PercentageToken(Node):
92-
__slots__ = str | Iterable[str]
9390
type: Literal["percentage"]
9491
value: float
9592
int_value: int | None
9693
is_integer: bool
9794
representation: str
95+
repr_format: str
9896
def __init__(self, line: int, column: int, value: float, int_value: int | None, representation: str) -> None: ...
9997

10098
class DimensionToken(Node):
101-
__slots__ = str | Iterable[str]
10299
type: Literal["dimension"]
103100
value: float
104101
int_value: int | None
105102
is_integer: bool
106103
representation: str
107104
unit: str
108105
lower_unit: str
106+
repr_format: str
109107
def __init__(self, line: int, column: int, value: float, int_value: int | None, representation: str, unit: str) -> None: ...
110108

111109
class ParenthesesBlock(Node):
112-
__slots__ = str | Iterable[str]
113-
type: Literal["()"]
110+
type: Literal["() block"]
114111
content: list[Node]
112+
repr_format: str
115113
def __init__(self, line: int, column: int, content: list[Node]) -> None: ...
116114

117115
class SquareBracketsBlock(Node):
118-
__slots__ = str | Iterable[str]
119-
type: Literal["[]"]
116+
type: Literal["[] block"]
120117
content: list[Node]
118+
repr_format: str
121119
def __init__(self, line: int, column: int, content: list[Node]) -> None: ...
122120

123121
class CurlyBracketsBlock(Node):
124-
__slots__ = str | Iterable[str]
125-
type: Literal["{}"]
122+
type: Literal["{} block"]
126123
content: list[Node]
124+
repr_format: str
127125
def __init__(self, line: int, column: int, content: list[Node]) -> None: ...
128126

129127
class FunctionBlock(Node):
130-
__slots__ = str | Iterable[str]
131128
type: Literal["function"]
132129
name: str
133130
lower_name: str
134131
arguments: list[Node]
132+
repr_format: str
135133
def __init__(self, line: int, column: int, name: str, arguments: list[Node]) -> None: ...
136134

137135
class Declaration(Node):
138-
__slots__ = str | Iterable[str]
139136
type: Literal["declaration"]
140137
name: str
141138
lower_name: str
142139
value: list[Node]
143140
important: bool
141+
repr_format: str
144142
def __init__(self, line: int, column: int, name: str, lower_name: str, value: list[Node], important: bool) -> None: ...
145143

146144
class QualifiedRule(Node):
147-
__slots__ = str | Iterable[str]
148145
type: Literal["qualified-rule"]
149146
prelude: list[Node]
150147
content: list[Node]
148+
repr_format: str
151149
def __init__(self, line: int, column: int, prelude: list[Node], content: list[Node]) -> None: ...
152150

153151
class AtRule(Node):
154-
__slots__ = str | Iterable[str]
155152
type: Literal["at-rule"]
156153
at_keyword: str
157154
lower_at_keyword: str
158155
prelude: list[Node]
159156
content: list[Node] | None
157+
repr_format: str
160158
def __init__(
161159
self, line: int, column: int, at_keyword: str, lower_at_keyword: str, prelude: list[Node], content: list[Node] | None
162160
) -> None: ...

stubs/tinycss2/tinycss2/color4.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from typing import Literal
44
from .ast import Node
55

66
class Color:
7-
COLOR_SPACES: set[str]
7+
COLOR_SPACES: set[str] | None
88
def __init__(self, space: str, coordinates: tuple[float | None, ...], alpha: float) -> None: ...
99
def __iter__(self) -> Iterator[float | None]: ...
1010
def __getitem__(self, key: int) -> float: ...
@@ -13,3 +13,7 @@ class Color:
1313
def to(self, space: str) -> Color: ...
1414

1515
def parse_color(input: str | Iterable[Node]) -> Color | Literal["currentcolor"] | None: ...
16+
17+
COLOR_SPACES: set[str]
18+
D50: tuple[float, float, float]
19+
D65: tuple[float, float, float]

stubs/tinycss2/tinycss2/color5.pyi

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ from typing import Literal
44
from . import color4
55
from .ast import Node
66

7+
COLOR_SCHEMES: set[str]
8+
COLOR_SPACES: set[str]
9+
D50: tuple[float, float, float]
10+
D65: tuple[float, float, float]
11+
712
class Color(color4.Color):
8-
COLOR_SPACES: set[str]
13+
COLOR_SPACES: set[str] | None
914

1015
def parse_color(
11-
input: str | Iterable[Node], color_schemes: Literal["normal"] | Iterable[str] = ...
16+
input: str | Iterable[Node], color_schemes: Literal["normal"] | Iterable[str] | None = ...
1217
) -> color4.Color | Color | Literal["currentcolor"] | None: ...

stubs/tinycss2/tinycss2/nth.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
from collections.abc import Iterable
2+
from re import Pattern
23

34
from .ast import Node
45

56
def parse_nth(input: str | Iterable[Node]) -> tuple[int, int] | None: ...
67
def parse_b(tokens: Iterable[Node], a: int) -> tuple[int, int] | None: ...
78
def parse_signless_b(tokens: Iterable[Node], a: int, b_sign: int) -> tuple[int, int] | None: ...
89
def parse_end(tokens: Iterable[Node], a: int, b: int) -> tuple[int, int] | None: ...
10+
11+
N_DASH_DIGITS_RE: Pattern[str]

stubs/tinycss2/tinycss2/parser.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from typing import TypeAlias
33

44
from .ast import AtRule, Comment, Declaration, Node, ParseError, QualifiedRule, WhitespaceToken
55

6-
Rule: TypeAlias = QualifiedRule | AtRule | Comment | WhitespaceToken | ParseError
6+
_Rule: TypeAlias = QualifiedRule | AtRule | Comment | WhitespaceToken | ParseError
77

88
def parse_one_component_value(input: str | Iterable[Node], skip_comments: bool = ...) -> Node: ...
99
def parse_one_declaration(input: str | Iterable[Node], skip_comments: bool = ...) -> Declaration | ParseError: ...
@@ -14,5 +14,5 @@ def parse_declaration_list(
1414
input: str | Iterable[Node], skip_comments: bool = ..., skip_whitespace: bool = ...
1515
) -> list[Declaration | AtRule | Comment | WhitespaceToken | ParseError]: ...
1616
def parse_one_rule(input: str | Iterable[Node], skip_comments: bool = ...) -> QualifiedRule | AtRule | ParseError: ...
17-
def parse_rule_list(input: str | Iterable[Node], skip_comments: bool = ..., skip_whitespace: bool = ...) -> list[Rule]: ...
18-
def parse_stylesheet(input: str | Iterable[Node], skip_comments: bool = ..., skip_whitespace: bool = ...) -> list[Rule]: ...
17+
def parse_rule_list(input: str | Iterable[Node], skip_comments: bool = ..., skip_whitespace: bool = ...) -> list[_Rule]: ...
18+
def parse_stylesheet(input: str | Iterable[Node], skip_comments: bool = ..., skip_whitespace: bool = ...) -> list[_Rule]: ...

stubs/tinycss2/tinycss2/serializer.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ def serialize_identifier(value: str) -> str: ...
77
def serialize_name(value: str) -> str: ...
88
def serialize_string_value(value: str) -> str: ...
99
def serialize_url(value: str) -> str: ...
10+
11+
BAD_PAIRS: set[tuple[str, str]]

0 commit comments

Comments
 (0)