diff options
author | Sean Quah <8349537+squahtx@users.noreply.github.com> | 2021-11-25 16:14:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-25 16:14:23 +0000 |
commit | 7862f821de30b17ed035a3355e552d027429dc6b (patch) | |
tree | 330dfa6675379825f0663ec3aca636f9465b1833 /changelog.d | |
parent | Improve performance of `remove_{hidden,deleted}_devices_from_device_inbox` (#... (diff) | |
download | synapse-7862f821de30b17ed035a3355e552d027429dc6b.tar.xz |
Annotate string constants in `synapse.api.constants` with `Final` (#11356)
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, ...) ```
Diffstat (limited to 'changelog.d')
-rw-r--r-- | changelog.d/11356.misc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/changelog.d/11356.misc b/changelog.d/11356.misc new file mode 100644 index 0000000000..01ce6a306c --- /dev/null +++ b/changelog.d/11356.misc @@ -0,0 +1 @@ +Add `Final` annotation to string constants in `synapse.api.constants` so that they get typed as `Literal`s. |