summary refs log tree commit diff
path: root/changelog.d
diff options
context:
space:
mode:
authorSean Quah <8349537+squahtx@users.noreply.github.com>2021-11-25 16:14:23 +0000
committerGitHub <noreply@github.com>2021-11-25 16:14:23 +0000
commit7862f821de30b17ed035a3355e552d027429dc6b (patch)
tree330dfa6675379825f0663ec3aca636f9465b1833 /changelog.d
parentImprove performance of `remove_{hidden,deleted}_devices_from_device_inbox` (#... (diff)
downloadsynapse-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.misc1
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.