-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[tinycss2] Add stubs for tinycss2 #15623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Video-Nomad
wants to merge
5
commits into
python:main
Choose a base branch
from
Video-Nomad:tinycss2-stubs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d03c6f2
[tinycss2] Add stubs for tinycss2
Video-Nomad d5bf66c
Fixing third-party stubtest errors
Video-Nomad dec38e3
Added change requests
Video-Nomad 45bb75c
Merge branch 'main' into tinycss2-stubs
Video-Nomad e360840
Fix ast type narrowing (back to Literal)
Video-Nomad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,8 +1,6 @@ | ||||||
| from collections.abc import Iterable | ||||||
| from typing import Literal | ||||||
|
|
||||||
| class Node: | ||||||
| __slots__ = str | Iterable[str] | ||||||
| source_line: int | ||||||
| source_column: int | ||||||
| type: str | ||||||
|
|
@@ -11,152 +9,152 @@ class Node: | |||||
| def serialize(self) -> str: ... | ||||||
|
|
||||||
| class ParseError(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["error"] | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It probably makes sense to use
Suggested change
|
||||||
| kind: str | ||||||
| message: str | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, kind: str, message: str) -> None: ... | ||||||
|
|
||||||
| class Comment(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["comment"] | ||||||
| value: str | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, value: str) -> None: ... | ||||||
|
|
||||||
| class WhitespaceToken(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["whitespace"] | ||||||
| value: str | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, value: str) -> None: ... | ||||||
|
|
||||||
| class LiteralToken(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["literal"] | ||||||
| value: str | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, value: str) -> None: ... | ||||||
| def __eq__(self, other: object) -> bool: ... | ||||||
| def __ne__(self, other: object) -> bool: ... | ||||||
|
|
||||||
| class IdentToken(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["ident"] | ||||||
| value: str | ||||||
| lower_value: str | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, value: str) -> None: ... | ||||||
|
|
||||||
| class AtKeywordToken(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["at-keyword"] | ||||||
| value: str | ||||||
| lower_value: str | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, value: str) -> None: ... | ||||||
|
|
||||||
| class HashToken(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["hash"] | ||||||
| value: str | ||||||
| is_identifier: bool | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, value: str, is_identifier: bool) -> None: ... | ||||||
|
|
||||||
| class StringToken(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["string"] | ||||||
| value: str | ||||||
| representation: str | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, value: str, representation: str) -> None: ... | ||||||
|
|
||||||
| class URLToken(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["url"] | ||||||
| value: str | ||||||
| representation: str | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, value: str, representation: str) -> None: ... | ||||||
|
|
||||||
| class UnicodeRangeToken(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["unicode-range"] | ||||||
| start: int | ||||||
| end: int | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, start: int, end: int) -> None: ... | ||||||
|
|
||||||
| class NumberToken(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["number"] | ||||||
| value: float | ||||||
| int_value: int | None | ||||||
| is_integer: bool | ||||||
| representation: str | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, value: float, int_value: int | None, representation: str) -> None: ... | ||||||
|
|
||||||
| class PercentageToken(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["percentage"] | ||||||
| value: float | ||||||
| int_value: int | None | ||||||
| is_integer: bool | ||||||
| representation: str | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, value: float, int_value: int | None, representation: str) -> None: ... | ||||||
|
|
||||||
| class DimensionToken(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["dimension"] | ||||||
| value: float | ||||||
| int_value: int | None | ||||||
| is_integer: bool | ||||||
| representation: str | ||||||
| unit: str | ||||||
| lower_unit: str | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, value: float, int_value: int | None, representation: str, unit: str) -> None: ... | ||||||
|
|
||||||
| class ParenthesesBlock(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["()"] | ||||||
| type: Literal["() block"] | ||||||
| content: list[Node] | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, content: list[Node]) -> None: ... | ||||||
|
|
||||||
| class SquareBracketsBlock(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["[]"] | ||||||
| type: Literal["[] block"] | ||||||
| content: list[Node] | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, content: list[Node]) -> None: ... | ||||||
|
|
||||||
| class CurlyBracketsBlock(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["{}"] | ||||||
| type: Literal["{} block"] | ||||||
| content: list[Node] | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, content: list[Node]) -> None: ... | ||||||
|
|
||||||
| class FunctionBlock(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["function"] | ||||||
| name: str | ||||||
| lower_name: str | ||||||
| arguments: list[Node] | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, name: str, arguments: list[Node]) -> None: ... | ||||||
|
|
||||||
| class Declaration(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["declaration"] | ||||||
| name: str | ||||||
| lower_name: str | ||||||
| value: list[Node] | ||||||
| important: bool | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, name: str, lower_name: str, value: list[Node], important: bool) -> None: ... | ||||||
|
|
||||||
| class QualifiedRule(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["qualified-rule"] | ||||||
| prelude: list[Node] | ||||||
| content: list[Node] | ||||||
| repr_format: str | ||||||
| def __init__(self, line: int, column: int, prelude: list[Node], content: list[Node]) -> None: ... | ||||||
|
|
||||||
| class AtRule(Node): | ||||||
| __slots__ = str | Iterable[str] | ||||||
| type: Literal["at-rule"] | ||||||
| at_keyword: str | ||||||
| lower_at_keyword: str | ||||||
| prelude: list[Node] | ||||||
| content: list[Node] | None | ||||||
| repr_format: str | ||||||
| def __init__( | ||||||
| self, line: int, column: int, at_keyword: str, lower_at_keyword: str, prelude: list[Node], content: list[Node] | None | ||||||
| ) -> None: ... | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,9 +4,14 @@ from typing import Literal | |||||
| from . import color4 | ||||||
| from .ast import Node | ||||||
|
|
||||||
| COLOR_SCHEMES: set[str] | ||||||
| COLOR_SPACES: set[str] | ||||||
| D50: tuple[float, float, float] | ||||||
| D65: tuple[float, float, float] | ||||||
|
|
||||||
| class Color(color4.Color): | ||||||
| COLOR_SPACES: set[str] | ||||||
| COLOR_SPACES: set[str] | None | ||||||
|
|
||||||
| def parse_color( | ||||||
| input: str | Iterable[Node], color_schemes: Literal["normal"] | Iterable[str] = ... | ||||||
| input: str | Iterable[Node], color_schemes: Literal["normal"] | Iterable[str] | None = ... | ||||||
|
||||||
| input: str | Iterable[Node], color_schemes: Literal["normal"] | Iterable[str] | None = ... | |
| input: str | Iterable[Node], color_schemes: Literal["normal"] | Iterable[str] | None = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,11 @@ | ||
| from collections.abc import Iterable | ||
| from re import Pattern | ||
|
|
||
| from .ast import Node | ||
|
|
||
| def parse_nth(input: str | Iterable[Node]) -> tuple[int, int] | None: ... | ||
| def parse_b(tokens: Iterable[Node], a: int) -> tuple[int, int] | None: ... | ||
| def parse_signless_b(tokens: Iterable[Node], a: int, b_sign: int) -> tuple[int, int] | None: ... | ||
| def parse_end(tokens: Iterable[Node], a: int, b: int) -> tuple[int, int] | None: ... | ||
|
|
||
| N_DASH_DIGITS_RE: Pattern[str] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For
__slots__you can include the runtime values: