From 34918f383d22597b0d97a942b33af2b39847cd39 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 8 Dec 2024 12:48:56 +0000 Subject: [PATCH 1/2] chore(deps-dev): Bump types-openpyxl Bumps [types-openpyxl](https://github.com/python/typeshed) from 3.1.5.20241114 to 3.1.5.20241126. - [Commits](https://github.com/python/typeshed/commits) --- updated-dependencies: - dependency-name: types-openpyxl dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 357a07c..4f09c6e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1563,13 +1563,13 @@ telegram = ["requests"] [[package]] name = "types-openpyxl" -version = "3.1.5.20241114" +version = "3.1.5.20241126" description = "Typing stubs for openpyxl" optional = false python-versions = ">=3.8" files = [ - {file = "types-openpyxl-3.1.5.20241114.tar.gz", hash = "sha256:caeb9aafed8a5ffabdc74f880b148d90375364a1cfe7915d5065c5d79f3fe6a2"}, - {file = "types_openpyxl-3.1.5.20241114-py3-none-any.whl", hash = "sha256:f2925f595b08f5aef1baa725c9ee40baaf51beb05d98ac150593d3bdd37b1029"}, + {file = "types_openpyxl-3.1.5.20241126-py3-none-any.whl", hash = "sha256:e50ad5c2dec2c92cca521abed5c039975226e8e76389f17ab0ef813595593fbe"}, + {file = "types_openpyxl-3.1.5.20241126.tar.gz", hash = "sha256:f599afab19f87aa11672ee675346401d82a0dac71988df9a5411cdb1e7477377"}, ] [[package]] From 4424d4004852a1283e798a5631845cbd49d146e2 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sun, 8 Dec 2024 13:50:09 +0100 Subject: [PATCH 2/2] chore: type safety --- suisa_sendemeldung/suisa_sendemeldung.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/suisa_sendemeldung/suisa_sendemeldung.py b/suisa_sendemeldung/suisa_sendemeldung.py index 831dbe8..e81fe2f 100644 --- a/suisa_sendemeldung/suisa_sendemeldung.py +++ b/suisa_sendemeldung/suisa_sendemeldung.py @@ -28,6 +28,7 @@ from dateutil.relativedelta import relativedelta from iso3901 import ISRC from openpyxl import Workbook +from openpyxl.cell.cell import Cell, MergedCell from openpyxl.styles import Border, Font, PatternFill, Side from tqdm import tqdm @@ -693,9 +694,10 @@ def get_xlsx(data: Any, args: ArgparseNamespace) -> BytesIO: # noqa: ANN401 # Try to approximate the required width by finding the longest values per column dims: dict[str, int] = {} - for row in worksheet.rows: # type: ignore[assignment] - for cell in row: # type: ignore[assignment] - if cell.value: + calc_row: tuple[Cell | MergedCell, ...] + for calc_row in worksheet.rows: + for cell in calc_row: + if isinstance(cell, Cell) and cell.value: dims[cell.column_letter] = max( (dims.get(cell.column_letter, 0), len(str(cell.value))), )