The type information for very common operations remains incomplete or missing. Specifically, when iterating over table rows and when accessing paragraphs inside a table cell, the types are either unannotated or annotated in a way that does not propagate to the user-facing API.
Current Behavior
Iterating over table rows:
for row in table.rows:
for cell in row.cells: # no type hints
...
The _Row.cells property lacks return type annotation.
Iterating over paragraphs in a cell:
for para in cell.paragraphs: # no type hints
...
The _Cell.paragraphs property lacks return type annotation too.
Impact
Static analysis fails: mypy/pyright/ty cannot catch type errors. Developers do not get suggestions for attributes.
Proposed Solution
Adopt ruff's ANN (flake8-annotations) and PYI (flake8-pyi) rules to enforce complete and correct annotations.
select = [
"ANN",
"PYI",
...
The type information for very common operations remains incomplete or missing. Specifically, when iterating over table rows and when accessing paragraphs inside a table cell, the types are either unannotated or annotated in a way that does not propagate to the user-facing API.
Current Behavior
Iterating over table rows:
The
_Row.cellsproperty lacks return type annotation.Iterating over paragraphs in a cell:
The
_Cell.paragraphsproperty lacks return type annotation too.Impact
Static analysis fails: mypy/pyright/ty cannot catch type errors. Developers do not get suggestions for attributes.
Proposed Solution
Adopt ruff's ANN (flake8-annotations) and PYI (flake8-pyi) rules to enforce complete and correct annotations.