Skip to content

Commit ef51fd6

Browse files
committed
Annotate several collections
1 parent 7fa626e commit ef51fd6

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

stubs/weasyprint/weasyprint/layout/__init__.pyi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
from _typeshed import Incomplete
22
from collections.abc import Generator
3+
from typing import TypeVar
4+
5+
_T = TypeVar("_T")
36

47
def initialize_page_maker(context, root_box) -> None: ...
58
def layout_fixed_boxes(context, pages, containing_page) -> Generator[Incomplete]: ...
69
def layout_document(html, root_box, context, max_loops: int = 8) -> Generator[Incomplete]: ...
710

8-
class FakeList(list):
9-
def append(self, item) -> None: ...
11+
class FakeList(list[_T]):
12+
def append(self, item: _T) -> None: ...
1013

1114
class LayoutContext:
1215
style_for: Incomplete
@@ -32,12 +35,10 @@ class LayoutContext:
3235
def overflows_page(self, bottom_space, position_y): ...
3336
@staticmethod
3437
def overflows(bottom, position_y): ...
35-
3638
@property
3739
def excluded_shapes(self): ...
3840
@excluded_shapes.setter
3941
def excluded_shapes(self, excluded_shapes) -> None: ...
40-
4142
def create_block_formatting_context(self, root_box=None, new_list=None) -> None: ...
4243
def finish_block_formatting_context(self, root_box=None) -> None: ...
4344
def create_flex_formatting_context(self, root_box) -> None: ...

stubs/weasyprint/weasyprint/layout/flex.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
class FlexLine(list): ...
1+
from _typeshed import Incomplete
2+
3+
class FlexLine(list[Incomplete]): ...
24

35
def flex_layout(
46
context, box, bottom_space, skip_stack, containing_block, page_is_empty, absolute_boxes, fixed_boxes, discard

stubs/weasyprint/weasyprint/matrix.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class Matrix(list):
1+
class Matrix(list[list[int | float]]):
22
def __init__(self, a: int = 1, b: int = 0, c: int = 0, d: int = 1, e: int = 0, f: int = 0, matrix=None) -> None: ...
33
def __matmul__(self, other): ...
44
@property

stubs/weasyprint/weasyprint/svg/text.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ class TextBox:
77
@property
88
def text(self): ...
99

10-
class Style(dict): ...
10+
class Style(dict[str, int | str]): ...
1111

1212
def text(svg, node, font_size) -> None: ...

0 commit comments

Comments
 (0)