Skip to content

tox: Bump mypy to 1.8.0

Antoine Lambert requested to merge anlambert/swh-storage:mypy-18-upgrade into master

Without the new type: ignore comments, the following errors are reported:

swh/storage/cassandra/model.py:62: error: Argument 1 to "fields" has incompatible type "type[BaseRow]"; expected "DataclassInstance | type[DataclassInstance]"  [arg-type]
swh/storage/cassandra/model.py:65: error: No overload variant of "asdict" matches argument type "BaseRow"  [call-overload]
swh/storage/cassandra/model.py:65: note: Possible overload variants:
swh/storage/cassandra/model.py:65: note:     def asdict(obj: DataclassInstance) -> dict[str, Any]
swh/storage/cassandra/model.py:65: note:     def [_T] asdict(obj: DataclassInstance, *, dict_factory: Callable[[list[tuple[str, Any]]], _T]) -> _T
swh/storage/cassandra/cql.py:418: error: No overload variant of "astuple" matches argument type "BaseRow"  [call-overload]
swh/storage/cassandra/cql.py:418: note: Possible overload variants:
swh/storage/cassandra/cql.py:418: note:     def astuple(obj: DataclassInstance) -> tuple[Any, ...]
swh/storage/cassandra/cql.py:418: note:     def [_T] astuple(obj: DataclassInstance, *, tuple_factory: Callable[[list[Any]], _T]) -> _T
swh/storage/cassandra/cql.py:423: error: Argument 1 to "map" has incompatible type overloaded function; expected "Callable[[BaseRow], tuple[Any, ...]]"  [arg-type]
swh/storage/cassandra/cql.py:536: error: Unused "type: ignore" comment  [unused-ignore]
swh/storage/proxies/validate.py:32: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
swh/storage/proxies/retry.py:93: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
swh/storage/proxies/filter.py:40: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
swh/storage/proxies/counter.py:51: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
swh/storage/proxies/counter.py:52: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
swh/storage/postgresql/storage.py:277: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
swh/storage/cassandra/storage.py:240: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
swh/storage/cli.py:294: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
swh/storage/tests/test_replay.py:189: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
swh/storage/tests/test_cassandra.py:358: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
Found 5 errors in 2 files (checked 94 source files)

Any idea for proper fixes ?

Related to swh/meta#5075 (closed).

Edited by Antoine Lambert

Merge request reports