From f1c419e816e101dfacf8cd9cbc808f4839b32dda Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 3 May 2023 17:52:43 +0200 Subject: [PATCH] [fpdf2] Update stubs for fpdf 2.7.4 (#10136) Co-authored-by: Alex Waygood --- stubs/fpdf2/METADATA.toml | 2 +- stubs/fpdf2/fpdf/enums.pyi | 5 +++++ stubs/fpdf2/fpdf/fpdf.pyi | 3 +++ stubs/fpdf2/fpdf/html.pyi | 11 ++++++----- stubs/fpdf2/fpdf/table.pyi | 5 +++++ 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/stubs/fpdf2/METADATA.toml b/stubs/fpdf2/METADATA.toml index 5c4e24e32..78c0762f0 100644 --- a/stubs/fpdf2/METADATA.toml +++ b/stubs/fpdf2/METADATA.toml @@ -1,4 +1,4 @@ -version = "2.7.1" +version = "2.7.4" requires = ["types-Pillow>=9.2.0"] [tool.stubtest] diff --git a/stubs/fpdf2/fpdf/enums.pyi b/stubs/fpdf2/fpdf/enums.pyi index 191129fee..112de3d17 100644 --- a/stubs/fpdf2/fpdf/enums.pyi +++ b/stubs/fpdf2/fpdf/enums.pyi @@ -45,6 +45,11 @@ class TextEmphasis(CoerciveIntFlag): @property def style(self) -> str: ... +class MethodReturnValue(CoerciveIntFlag): + PAGE_BREAK: int + LINES: int + HEIGHT: int + class TableBordersLayout(CoerciveEnum): ALL: str NONE: str diff --git a/stubs/fpdf2/fpdf/fpdf.pyi b/stubs/fpdf2/fpdf/fpdf.pyi index 0fa22a4f2..da49d9599 100644 --- a/stubs/fpdf2/fpdf/fpdf.pyi +++ b/stubs/fpdf2/fpdf/fpdf.pyi @@ -19,6 +19,7 @@ from .enums import ( AnnotationName, Corner, FileAttachmentAnnotationName, + MethodReturnValue, PageLayout, PathPaintRule, RenderStyle, @@ -450,6 +451,8 @@ class FPDF(GraphicsStateMixin): new_x: XPos | str = ..., new_y: YPos | str = ..., wrapmode: WrapMode = ..., + dry_run: bool = False, + output: MethodReturnValue | str | int = ..., ): ... def write( self, h: float | None = None, txt: str = "", link: str = "", print_sh: bool = False, wrapmode: WrapMode = ... diff --git a/stubs/fpdf2/fpdf/html.pyi b/stubs/fpdf2/fpdf/html.pyi index 70186a8b8..08516948d 100644 --- a/stubs/fpdf2/fpdf/html.pyi +++ b/stubs/fpdf2/fpdf/html.pyi @@ -1,5 +1,5 @@ -from _typeshed import Incomplete, Unused -from collections.abc import Callable +from _typeshed import Incomplete, SupportsKeysAndGetItem, Unused +from collections.abc import Callable, Iterable from html.parser import HTMLParser from logging import Logger from re import Match, Pattern @@ -10,7 +10,6 @@ from fpdf import FPDF __author__: Final[str] __copyright__: Final[str] -__license__: Final[str] LOGGER: Logger BULLET_WIN1252: Final[str] @@ -55,9 +54,10 @@ class HTML2FPDF(HTMLParser): theader_out: bool table_row_height: int heading_level: Incomplete - heading_sizes: Incomplete + heading_sizes: dict[str, int] heading_above: float heading_below: float + pre_code_font: str warn_on_tags_not_matching: bool # Not initialized in __init__: @@ -72,7 +72,8 @@ class HTML2FPDF(HTMLParser): dd_tag_indent: int = 10, table_line_separators: bool = False, ul_bullet_char: str = "\x95", - heading_sizes: Incomplete | None = None, + heading_sizes: SupportsKeysAndGetItem[str, int] | Iterable[tuple[str, int]] | None = None, + pre_code_font: str = "courier", warn_on_tags_not_matching: bool = True, **_: Unused, ): ... diff --git a/stubs/fpdf2/fpdf/table.pyi b/stubs/fpdf2/fpdf/table.pyi index 013176f33..4586a178d 100644 --- a/stubs/fpdf2/fpdf/table.pyi +++ b/stubs/fpdf2/fpdf/table.pyi @@ -13,6 +13,11 @@ from .fpdf import FPDF DEFAULT_HEADINGS_STYLE: FontFace +@dataclass(frozen=True) +class RowLayoutInfo: + height: int + triggers_page_jump: bool + class Table: rows: list[Row]