This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Create a mypy plugin for replication class methods #8828
Labels
T-Task
Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Z-Help-Wanted
We know exactly how to fix this issue, and would be grateful for any contribution
z-p3
(Deprecated Label)
Replication servlet classes, such as
ReplicationRemoteJoinRestServlet
,ReplicationUserDevicesResyncRestServlet
etc. each have_serialize_payload
and_handle_request
methods. Traditionally we haven't added typing to these methods as it breaks mypy for two reasons:ReplicationEndpoint
.send_request
, which is what is returned bymake_client
and what is run when making a replication request.If types are added to any instance of
_serialize_payload
or_handle_request
,mypy
will complain about this discrepancy, and thus an# type: ignore
has typically been put on the method signature in order to avoid this:synapse/synapse/replication/http/membership.py
Lines 55 to 62 in 377673d
A better solution is to write a mypy plugin, much like we already have for cache functions to properly check the types and remove the need to ignore them.
Note that this issue grew out of a discussion here: #8809 (comment)
The text was updated successfully, but these errors were encountered: