From f39ffaab7a441091e097435cfefdb4901b4b29c1 Mon Sep 17 00:00:00 2001 From: "daniel.eades" Date: Sat, 12 Jul 2025 08:39:38 +0100 Subject: [PATCH 1/2] don't blanket ignore missing type stubs --- .mypy.ini | 16 ++++++++++++---- doorstop/core/exporter.py | 10 +++++----- doorstop/core/importer.py | 2 +- poetry.lock | 22 +++++++++++++++++----- pyproject.toml | 1 + 5 files changed, 36 insertions(+), 15 deletions(-) diff --git a/.mypy.ini b/.mypy.ini index 6f9014131..519e36950 100644 --- a/.mypy.ini +++ b/.mypy.ini @@ -1,11 +1,19 @@ [mypy] - -ignore_missing_imports = true -no_implicit_optional = true check_untyped_defs = true cache_dir = .cache/mypy/ [mypy-doorstop.*.tests.*] - ignore_errors = True + + +# Dependences with no type stubs + +[mypy-frontmatter] +ignore_missing_imports = true + +[mypy-bottle] +ignore_missing_imports = true + +[mypy-plantuml_markdown] +ignore_missing_imports = true diff --git a/doorstop/core/exporter.py b/doorstop/core/exporter.py index c70eb5ea9..7e3b6b257 100644 --- a/doorstop/core/exporter.py +++ b/doorstop/core/exporter.py @@ -271,7 +271,7 @@ def _get_xlsx(obj, auto): # Populate cells for row, data in enumerate(_tabulate(obj, auto=auto), start=1): for col_idx, value in enumerate(data, start=1): - cell = worksheet.cell(column=col_idx, row=row) + cell = worksheet.cell(column=col_idx, row=row) # type: ignore[union-attr] # wrap text in every cell alignment = openpyxl.styles.Alignment( @@ -294,7 +294,7 @@ def _get_xlsx(obj, auto): # Add filter up to the last column col_letter = openpyxl.utils.get_column_letter(len(col_widths)) - worksheet.auto_filter.ref = "A1:%s1" % col_letter + worksheet.auto_filter.ref = "A1:%s1" % col_letter # type: ignore[union-attr] # Set column width based on column contents for col in col_widths: @@ -302,11 +302,11 @@ def _get_xlsx(obj, auto): width = XLSX_MAX_WIDTH else: width = col_widths[col] + XLSX_FILTER_PADDING - col_letter = openpyxl.utils.get_column_letter(col) - worksheet.column_dimensions[col_letter].width = width + col_letter = openpyxl.utils.get_column_letter(col) # type: ignore[arg-type] + worksheet.column_dimensions[col_letter].width = width # type: ignore[union-attr] # Freeze top row - worksheet.freeze_panes = worksheet.cell(row=2, column=1) + worksheet.freeze_panes = worksheet.cell(row=2, column=1) # type: ignore[union-attr] return workbook diff --git a/doorstop/core/importer.py b/doorstop/core/importer.py index adbc470e8..f156f8854 100644 --- a/doorstop/core/importer.py +++ b/doorstop/core/importer.py @@ -197,7 +197,7 @@ def _file_xlsx(path, document, mapping=None): index = 0 # Extract header and data rows - for index, row in enumerate(worksheet.iter_rows()): + for index, row in enumerate(worksheet.iter_rows()): # type: ignore[union-attr] row2 = [] for cell in row: if index == 0: diff --git a/poetry.lock b/poetry.lock index d93af4bf4..ae8e2b73f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.3 and should not be changed by hand. [[package]] name = "altgraph" @@ -475,7 +475,7 @@ description = "Read metadata from Python packages" optional = false python-versions = ">=3.8" groups = ["main", "dev"] -markers = "python_version < \"3.10\"" +markers = "python_version == \"3.9\"" files = [ {file = "importlib_metadata-7.0.1-py3-none-any.whl", hash = "sha256:4805911c3a4ec7c3966410053e9ec6a1fecd629117df5adee56dfc9432a1081e"}, {file = "importlib_metadata-7.0.1.tar.gz", hash = "sha256:f238736bb06590ae52ac1fab06a3a9ef1d8dce2b7a35b5ab329371d6c8f5d2cc"}, @@ -541,7 +541,7 @@ description = "Fork of the standard library cgi and cgitb modules, being depreca optional = false python-versions = "<4.0,>=3.10" groups = ["dev"] -markers = "python_version >= \"3.13\"" +markers = "python_version == \"3.13\"" files = [ {file = "legacy_cgi-2.6.1-py3-none-any.whl", hash = "sha256:8eacc1522d9f76451337a4b5a0abf494158d39250754b0d1bc19a14c6512af9b"}, {file = "legacy_cgi-2.6.1.tar.gz", hash = "sha256:f2ada99c747c3d72a473a6aaff6259a61f226b06fe9f3106e495ab83fd8f7a42"}, @@ -1445,6 +1445,18 @@ files = [ {file = "types_Markdown-3.5.0.20240129-py3-none-any.whl", hash = "sha256:d6861d9d68e8268a5346d8a43d14727e6c636ebc6d49f2b8fc034c25996d35dd"}, ] +[[package]] +name = "types-openpyxl" +version = "3.1.5.20250602" +description = "Typing stubs for openpyxl" +optional = false +python-versions = ">=3.9" +groups = ["dev"] +files = [ + {file = "types_openpyxl-3.1.5.20250602-py3-none-any.whl", hash = "sha256:1f82211e086902318f6a14b5d8d865102362fda7cb82f3d63ac4dff47a1f164b"}, + {file = "types_openpyxl-3.1.5.20250602.tar.gz", hash = "sha256:d19831482022fc933780d6e9d6990464c18c2ec5f14786fea862f72c876980b5"}, +] + [[package]] name = "types-pyyaml" version = "6.0.12.12" @@ -1631,7 +1643,7 @@ description = "Backport of pathlib-compatible object wrapper for zip files" optional = false python-versions = ">=3.8" groups = ["main", "dev"] -markers = "python_version < \"3.10\"" +markers = "python_version == \"3.9\"" files = [ {file = "zipp-3.17.0-py3-none-any.whl", hash = "sha256:0e923e726174922dce09c53c59ad483ff7bbb8e572e00c7f7c46b88556409f31"}, {file = "zipp-3.17.0.tar.gz", hash = "sha256:84e64a1c28cf7e91ed2078bb8cc8c259cb19b76942096c8d7b84947690cabaf0"}, @@ -1644,4 +1656,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.1" python-versions = "<3.14,>=3.9" -content-hash = "a8350d05a7474404b18368987c300ca1b29c64a8bf9d1af160588ae5f004bf34" +content-hash = "bb6e27e013b76742dfbcb1cea390396240547019ba950ee18efd4a16e20fd6d7" diff --git a/pyproject.toml b/pyproject.toml index a485a1f89..c6805b80c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,6 +68,7 @@ mypy = ">=1.1.1" pydocstyle = "*" pylint = "~3.2.0" types-markdown = "*" +types-openpyxl = "*" types-pyyaml = "*" types-requests = "*" types-setuptools = "*" From abbb2ea982225e285f276345dc25e523a95f15c9 Mon Sep 17 00:00:00 2001 From: "daniel.eades" Date: Sat, 12 Jul 2025 10:19:35 +0100 Subject: [PATCH 2/2] fixup --- poetry.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index ae8e2b73f..5f301401f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1656,4 +1656,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.1" python-versions = "<3.14,>=3.9" -content-hash = "bb6e27e013b76742dfbcb1cea390396240547019ba950ee18efd4a16e20fd6d7" +content-hash = "7e6de963375622c296c865d207bb12357fd348a6270baa695c162ec7f146f833"