From 88b03689b66e1438ce7ad36709531da068674703 Mon Sep 17 00:00:00 2001 From: Martin Thoma Date: Thu, 19 May 2022 15:22:24 +0200 Subject: [PATCH] Fix mypy types --- PyPDF2/_page.py | 10 +++++----- PyPDF2/utils.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/PyPDF2/_page.py b/PyPDF2/_page.py index 3a4f629d0e..d572fb0037 100644 --- a/PyPDF2/_page.py +++ b/PyPDF2/_page.py @@ -458,7 +458,7 @@ def mergeScaledPage( dimensions of the page to be merged. """ # CTM to scale : [ sx 0 0 sy 0 0 ] - self.mergeTransformedPage(page2, [scale, 0, 0, scale, 0, 0], expand) + self.mergeTransformedPage(page2, (scale, 0, 0, scale, 0, 0), expand) def mergeRotatedPage( self, page2: "PageObject", rotation: float, expand: bool = False @@ -476,14 +476,14 @@ def mergeRotatedPage( rotation = math.radians(rotation) self.mergeTransformedPage( page2, - [ + ( math.cos(rotation), math.sin(rotation), -math.sin(rotation), math.cos(rotation), 0, 0, - ], + ), expand, ) @@ -501,7 +501,7 @@ def mergeTranslatedPage( :param bool expand: Whether the page should be expanded to fit the dimensions of the page to be merged. """ - self.mergeTransformedPage(page2, [1, 0, 0, 1, tx, ty], expand) + self.mergeTransformedPage(page2, (1, 0, 0, 1, tx, ty), expand) def mergeRotatedTranslatedPage( self, @@ -615,7 +615,7 @@ def scale(self, sx: float, sy: float) -> None: :param float sx: The scaling factor on horizontal axis. :param float sy: The scaling factor on vertical axis. """ - self.addTransformation([sx, 0, 0, sy, 0, 0]) + self.addTransformation((sx, 0, 0, sy, 0, 0)) self.mediaBox = RectangleObject( ( float(self.mediaBox.getLowerLeft_x()) * sx, diff --git a/PyPDF2/utils.py b/PyPDF2/utils.py index cae2025cb1..7a247c2425 100644 --- a/PyPDF2/utils.py +++ b/PyPDF2/utils.py @@ -147,7 +147,7 @@ def RC4_encrypt(key: Union[str, bytes], plaintext: bytes) -> bytes: def matrixMultiply( a: TransformationMatrixType, b: TransformationMatrixType ) -> TransformationMatrixType: - return tuple( + return tuple( # type: ignore[return-value] tuple(sum(float(i) * float(j) for i, j in zip(row, col)) for col in zip(*b)) for row in a )