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

Annotate string constants in synapse.api.constants with Final #11356

Merged
merged 1 commit into from
Nov 25, 2021

Commits on Nov 16, 2021

  1. Annotate string constants in synapse.api.constants with Final

    This change makes mypy complain if the constants are ever reassigned,
    and, more usefully, makes mypy type them as `Literal`s instead of `str`s,
    allowing code of the following form to pass mypy:
    ```py
    def do_something(membership: Literal["join", "leave"], ...): ...
    
    do_something(Membership.JOIN, ...)
    ```
    Sean Quah committed Nov 16, 2021
    Configuration menu
    Copy the full SHA
    17bc616 View commit details
    Browse the repository at this point in the history