Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Create a mypy plugin for replication class methods #8828

Open

Description

@anoadragon453

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:

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:

@staticmethod
async def _serialize_payload( # type: ignore
requester: Requester,
room_id: str,
user_id: str,
remote_room_hosts: List[str],
content: JsonDict,
) -> JsonDict:

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)

Activity

  1. added
    Z-Help-WantedWe know exactly how to fix this issue, and would be grateful for any contribution
    z-p3(Deprecated Label)
    on Nov 26, 2020
  2. added
    T-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
    on Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.Z-Help-WantedWe know exactly how to fix this issue, and would be grateful for any contributionz-p3(Deprecated Label)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions