From 2a4fb364f98cdc25cc1baeb1eca53a4be11561d5 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Mon, 22 Sep 2025 12:37:41 +0200 Subject: [PATCH 1/8] [reportlab] Update to ~= 4.4.4 --- stubs/reportlab/METADATA.toml | 2 +- .../reportlab/graphics/charts/textlabels.pyi | 14 ++++++++++---- stubs/reportlab/reportlab/platypus/tables.pyi | 10 +++++++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/stubs/reportlab/METADATA.toml b/stubs/reportlab/METADATA.toml index e05df1b21d12..192440947c2c 100644 --- a/stubs/reportlab/METADATA.toml +++ b/stubs/reportlab/METADATA.toml @@ -1,4 +1,4 @@ -version = "~= 4.4.1" +version = "~= 4.4.4" # GitHub mirror of https://hg.reportlab.com/hg-public/reportlab/file upstream_repository = "https://github.com/MrBitBucket/reportlab-mirror" diff --git a/stubs/reportlab/reportlab/graphics/charts/textlabels.pyi b/stubs/reportlab/reportlab/graphics/charts/textlabels.pyi index bcd2d2c33533..1c6d32a18292 100644 --- a/stubs/reportlab/reportlab/graphics/charts/textlabels.pyi +++ b/stubs/reportlab/reportlab/graphics/charts/textlabels.pyi @@ -2,20 +2,26 @@ from _typeshed import Incomplete from typing import Final from reportlab.graphics.charts.utils import CustomDrawChanger +from reportlab.graphics.shapes import Drawing, Group from reportlab.graphics.widgetbase import PropHolder, Widget from reportlab.lib.attrmap import * __version__: Final[str] class Label(Widget): - def __init__(self, **kw) -> None: ... - def setText(self, text) -> None: ... + # TODO: This has more attributes. x: Incomplete y: Incomplete + def __init__(self, **kw) -> None: ... + @property + def padding(self): ... + @padding.setter + def padding(self, p) -> None: ... + def setText(self, text) -> None: ... def setOrigin(self, x, y) -> None: ... - def demo(self): ... + def demo(self) -> Drawing: ... def computeSize(self) -> None: ... - def draw(self): ... + def draw(self) -> Group: ... class LabelDecorator: textAnchor: str diff --git a/stubs/reportlab/reportlab/platypus/tables.pyi b/stubs/reportlab/reportlab/platypus/tables.pyi index 617c86634b3f..6d5d4b13fe61 100644 --- a/stubs/reportlab/reportlab/platypus/tables.pyi +++ b/stubs/reportlab/reportlab/platypus/tables.pyi @@ -1,7 +1,7 @@ from _typeshed import Incomplete from abc import abstractmethod from collections.abc import Collection, Iterable, Sequence -from typing import Any, Literal, overload +from typing import Any, Literal, NamedTuple, overload from typing_extensions import TypeAlias, Unpack from reportlab.lib.colors import Color @@ -55,6 +55,13 @@ class TableStyle: def add(self, *cmd: Unpack[_RoundedCornersTableCommand]) -> None: ... def getCommands(self) -> list[_TableCommand]: ... +class ShadowStyle(NamedTuple): + dx: int + dy: int + color0: _Color + color1: _Corner + nshades: int + class Table(Flowable): ident: str | None repeatRows: int @@ -89,6 +96,7 @@ class Table(Flowable): minRowHeights: Sequence[float] | None = None, cornerRadii: _CornerRadii | _UNSET_ | None = ..., renderCB: TableRenderCB | None = None, + shadow: ShadowStyle | None = None, ) -> None: ... def identity(self, maxLen: int | None = 30) -> str: ... def normalizeData(self, data: Iterable[Iterable[Any]]) -> list[list[Any]]: ... From 79392f8ab805875771375e6ab7e9619b5073d690 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Mon, 22 Sep 2025 12:40:53 +0200 Subject: [PATCH 2/8] Fix typo --- stubs/reportlab/reportlab/platypus/tables.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/reportlab/reportlab/platypus/tables.pyi b/stubs/reportlab/reportlab/platypus/tables.pyi index 6d5d4b13fe61..e9cb71fee190 100644 --- a/stubs/reportlab/reportlab/platypus/tables.pyi +++ b/stubs/reportlab/reportlab/platypus/tables.pyi @@ -59,7 +59,7 @@ class ShadowStyle(NamedTuple): dx: int dy: int color0: _Color - color1: _Corner + color1: _Color nshades: int class Table(Flowable): From 08a4548aa5d3bd889634adc6fd37b4dc8c369922 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Mon, 22 Sep 2025 12:49:55 +0200 Subject: [PATCH 3/8] Fix Widget.{draw,demo} --- stubs/reportlab/reportlab/graphics/widgetbase.pyi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stubs/reportlab/reportlab/graphics/widgetbase.pyi b/stubs/reportlab/reportlab/graphics/widgetbase.pyi index e02d3857b65e..488c21d001e9 100644 --- a/stubs/reportlab/reportlab/graphics/widgetbase.pyi +++ b/stubs/reportlab/reportlab/graphics/widgetbase.pyi @@ -1,4 +1,5 @@ from _typeshed import Incomplete +from abc import abstractmethod from typing import Final from reportlab.graphics import shapes @@ -15,9 +16,10 @@ class PropHolder: def dumpProperties(self, prefix: str = "") -> None: ... class Widget(PropHolder, shapes.UserNode): - # TODO: draw should probably be marked abstract - def draw(self) -> None: ... - def demo(self) -> None: ... + @abstractmethod + def draw(self): ... + @abstractmethod + def demo(self): ... def provideNode(self) -> shapes.Shape: ... def getBounds(self) -> tuple[float, float, float, float]: ... From d97191edd79f7db2f1ec4d581b59fbcd5fdcd391 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Mon, 22 Sep 2025 12:55:03 +0200 Subject: [PATCH 4/8] Remove @abstractmethod marker --- stubs/reportlab/reportlab/graphics/widgetbase.pyi | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/stubs/reportlab/reportlab/graphics/widgetbase.pyi b/stubs/reportlab/reportlab/graphics/widgetbase.pyi index 488c21d001e9..b937f01cc9e7 100644 --- a/stubs/reportlab/reportlab/graphics/widgetbase.pyi +++ b/stubs/reportlab/reportlab/graphics/widgetbase.pyi @@ -1,5 +1,4 @@ from _typeshed import Incomplete -from abc import abstractmethod from typing import Final from reportlab.graphics import shapes @@ -16,10 +15,8 @@ class PropHolder: def dumpProperties(self, prefix: str = "") -> None: ... class Widget(PropHolder, shapes.UserNode): - @abstractmethod - def draw(self): ... - @abstractmethod - def demo(self): ... + def draw(self): ... # abstract, but not marked as @abstractmethod + def demo(self): ... # abstract, but not marked as @abstractmethod def provideNode(self) -> shapes.Shape: ... def getBounds(self) -> tuple[float, float, float, float]: ... From 4fa6b7929360a86071a89a71a0320d6f2aae27d3 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Mon, 22 Sep 2025 13:02:13 +0200 Subject: [PATCH 5/8] Add ShadowStyle defaults --- stubs/reportlab/reportlab/platypus/tables.pyi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stubs/reportlab/reportlab/platypus/tables.pyi b/stubs/reportlab/reportlab/platypus/tables.pyi index e9cb71fee190..36b26796bd20 100644 --- a/stubs/reportlab/reportlab/platypus/tables.pyi +++ b/stubs/reportlab/reportlab/platypus/tables.pyi @@ -56,11 +56,11 @@ class TableStyle: def getCommands(self) -> list[_TableCommand]: ... class ShadowStyle(NamedTuple): - dx: int - dy: int - color0: _Color - color1: _Color - nshades: int + dx: int = 10 + dy: int = -10 + color0: _Color = "grey" + color1: _Color = "white" + nshades: int = 30 class Table(Flowable): ident: str | None From 0e47a1f11197f8329258b4ab12759eb6a13e812f Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Mon, 22 Sep 2025 13:55:31 +0200 Subject: [PATCH 6/8] Pin to a fixed version --- stubs/reportlab/METADATA.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/reportlab/METADATA.toml b/stubs/reportlab/METADATA.toml index 192440947c2c..e4f6253d99e5 100644 --- a/stubs/reportlab/METADATA.toml +++ b/stubs/reportlab/METADATA.toml @@ -1,4 +1,4 @@ -version = "~= 4.4.4" +version = "4.4.4" # GitHub mirror of https://hg.reportlab.com/hg-public/reportlab/file upstream_repository = "https://github.com/MrBitBucket/reportlab-mirror" From 0062db87c59ff9268fad30d52fb0076b740d2ebc Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Mon, 22 Sep 2025 13:56:19 +0200 Subject: [PATCH 7/8] Use `Incomplete` --- stubs/reportlab/reportlab/platypus/tables.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/reportlab/reportlab/platypus/tables.pyi b/stubs/reportlab/reportlab/platypus/tables.pyi index 36b26796bd20..46101839e1d9 100644 --- a/stubs/reportlab/reportlab/platypus/tables.pyi +++ b/stubs/reportlab/reportlab/platypus/tables.pyi @@ -56,8 +56,8 @@ class TableStyle: def getCommands(self) -> list[_TableCommand]: ... class ShadowStyle(NamedTuple): - dx: int = 10 - dy: int = -10 + dx: Incomplete = 10 + dy: Incomplete = -10 color0: _Color = "grey" color1: _Color = "white" nshades: int = 30 From 632a9ad06b2b0c6e2066e66c984010e9f6544a0e Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Mon, 22 Sep 2025 14:02:21 +0200 Subject: [PATCH 8/8] int | Incomplete --- stubs/reportlab/reportlab/platypus/tables.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/reportlab/reportlab/platypus/tables.pyi b/stubs/reportlab/reportlab/platypus/tables.pyi index 46101839e1d9..905b2fd8180c 100644 --- a/stubs/reportlab/reportlab/platypus/tables.pyi +++ b/stubs/reportlab/reportlab/platypus/tables.pyi @@ -56,8 +56,8 @@ class TableStyle: def getCommands(self) -> list[_TableCommand]: ... class ShadowStyle(NamedTuple): - dx: Incomplete = 10 - dy: Incomplete = -10 + dx: int | Incomplete = 10 # TODO: is either `int` or `float` + dy: int | Incomplete = -10 # TODO: is either `int` or `float` color0: _Color = "grey" color1: _Color = "white" nshades: int = 30