This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Resolve mypy type lints when running with Python 3.8 (minimum supported version) #15603
Closed
4 of 24 tasks
Spawning from #15602, where we should be running
mypy
with our minimum supported Python version since later versions can include overloads, etc which aren't backwards compatible.Before we can actually merge the PR which updates the CI to use Python 3.8, we have to resolve the lints that pop up first so we don't just have a broken CI after merging #15602
TODO Python 3.8
synapse/app/_base.py:217
:error: Missing positional arguments "value", "tb" in call to "format_exception" [call-arg]
traceback.format_exception(...)
usage that is compatible with Python 3.7 and 3.11 #15599synapse/app/_base.py:217
:error: Argument 1 to "format_exception" has incompatible type "Exception"; expected "Optional[Type[BaseException]]" [arg-type]
traceback.format_exception(...)
usage that is compatible with Python 3.7 and 3.11 #15599synapse/storage/controllers/stats.py:58
:error: "Counter" is not subscriptable, use "typing.Counter" instead [misc]
tests/test_state.py:267
:error: "dict" is not subscriptable, use "typing.Dict" instead [misc]
TODO Python 3.7We're no longer trying to target Python 3.7 given that EOL is weeks away (wasted effort)
docker/configure_workers_and_start.py:56
:error: Module "typing" has no attribute "SupportsIndex"; maybe "SupportsRound"? [attr-defined]
synapse/util/check_dependencies.py:33
:error: Unused "type: ignore" comment
synapse/util/check_dependencies.py:200
:error: Unused "type: ignore" comment
synapse/config/_base.pyi:2
:error: Module "typing" has no attribute "Literal" [attr-defined]
Literal
fromtyping_extensions
(compatible with Python 3.7) #15605synapse/config/_base.pyi:170
:error: Overloaded function signature 2 will never be matched: signature 1's parameter type(s) are the same or broader [misc]
synapse/app/_base.py:217
:error: Missing positional arguments "value", "tb" in call to "format_exception" [call-arg]
traceback.format_exception(...)
usage that is compatible with Python 3.7 and 3.11 #15599synapse/app/_base.py:217
:error: Argument 1 to "format_exception" has incompatible type "Exception"; expected "Optional[Type[BaseException]]" [arg-type]
traceback.format_exception(...)
usage that is compatible with Python 3.7 and 3.11 #15599synapse/storage/controllers/stats.py:58
:error: "Counter" is not subscriptable, use "typing.Counter" instead [misc]
tests/test_utils/__init__.py:39
:error: Module "sys" has no attribute "UnraisableHookArgs" [attr-defined]
tests/test_utils/__init__.py:92
:error: Module has no attribute "unraisablehook" [attr-defined]
synapse/_scripts/synapse_port_db.py:1171
:error: Name "curses.window" is not defined [name-defined]
synapse/_scripts/synapse_port_db.py:1375
:error: Name "curses.window" is not defined [name-defined]
tests/test_state.py:267
:error: "dict" is not subscriptable, use "typing.Dict" instead [misc]
tests/metrics/test_metrics.py:22
:error: Unused "type: ignore" comment
tests/http/federation/test_srv_resolver.py:90
:error: Incompatible types in assignment (expression has type "object", variable has type "List[Server]") [assignment]
tests/http/federation/test_srv_resolver.py:92
:error: Unused "type: ignore" comment
tests/http/federation/test_srv_resolver.py:119
:error: Incompatible types in assignment (expression has type "object", variable has type "List[Server]") [assignment]
tests/http/federation/test_srv_resolver.py:121
:error: Unused "type: ignore" comment
tests/http/federation/test_srv_resolver.py:154
:error: Incompatible types in assignment (expression has type "object", variable has type "List[Server]") [assignment]
tests/http/federation/test_srv_resolver.py:156
:error: Unused "type: ignore" comment
Dev notes
Find/replace from the
mypy
output to generate that list:Find:
Replace:
The text was updated successfully, but these errors were encountered: