chore: add some explanations and explicit check callouts to mypy ignores

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
This commit is contained in:
Ihar Hrachyshka 2025-04-01 10:08:27 -04:00
parent 6df600f014
commit d443607d65
4 changed files with 18 additions and 12 deletions

View file

@ -77,7 +77,9 @@ def typeannotation(
"""
def wrap(cls: Type[T]) -> Type[T]:
cls.__repr__ = _compact_dataclass_repr # type: ignore
# mypy fails to equate bound-y functions (first argument interpreted as
# the bound object) with class methods, hence the `ignore` directive.
cls.__repr__ = _compact_dataclass_repr # type: ignore[method-assign]
if not dataclasses.is_dataclass(cls):
cls = dataclasses.dataclass( # type: ignore[call-overload]
cls,