Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions doorstop/core/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -294,19 +294,19 @@ 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:
if col_widths[col] > XLSX_MAX_WIDTH:
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

Expand Down
2 changes: 1 addition & 1 deletion doorstop/core/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
22 changes: 17 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ mypy = ">=1.1.1"
pydocstyle = "*"
pylint = "~3.2.0"
types-markdown = "*"
types-openpyxl = "*"
types-pyyaml = "*"
types-requests = "*"
types-setuptools = "*"
Expand Down