This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
This repository was 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
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-CIIssues related to CI on the Synapse repositoryIssues related to CI on the Synapse repositoryT-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Description
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]
-
synapse/app/_base.py:217
:error: Argument 1 to "format_exception" has incompatible type "Exception"; expected "Optional[Type[BaseException]]" [arg-type]
-
synapse/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.7
We'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]
-
synapse/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]
-
synapse/app/_base.py:217
:error: Argument 1 to "format_exception" has incompatible type "Exception"; expected "Optional[Type[BaseException]]" [arg-type]
-
synapse/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:
^(.*):(\d+): (.*)$
Replace:
- [ ] [`$1:$2`](https://github.com/matrix-org/synapse/blob/ba572647b291e593e70a30e45c234c9766472ff3/$1#L$2): `$3`
Metadata
Metadata
Assignees
Labels
A-CIIssues related to CI on the Synapse repositoryIssues related to CI on the Synapse repositoryT-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.