summary refs log tree commit diff
path: root/synapse/storage/database.py
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-12-12 21:25:07 +0000
committerGitHub <noreply@github.com>2022-12-12 21:25:07 +0000
commit3d87847ecc943c689c4587c5327d744e4a8f92c2 (patch)
tree376b5e4eecb94e0fe75272cf78be7235f307d54a /synapse/storage/database.py
parentFix missing cache invalidation in application service code (#14670) (diff)
downloadsynapse-3d87847ecc943c689c4587c5327d744e4a8f92c2.tar.xz
Enable `--warn-redundant-casts` option in mypy (#14671)
* Enable `--warn-redundant-casts` option in mypy

Doesn't do much but helps me sleep better at night.

* Changelog

* Fix name of the ignore

* Fix one more missed cast

Not sure why I didn't see this one locally, maybe I needed a poetry update

* Remove old comment

Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>

Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
Diffstat (limited to 'synapse/storage/database.py')
-rw-r--r--synapse/storage/database.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/storage/database.py b/synapse/storage/database.py
index 55bcb90001..0b29e67b94 100644
--- a/synapse/storage/database.py
+++ b/synapse/storage/database.py
@@ -667,7 +667,8 @@ class DatabasePool:
                 )
         # also check variables referenced in func's closure
         if inspect.isfunction(func):
-            f = cast(types.FunctionType, func)
+            # Keep the cast for now---it helps PyCharm to understand what `func` is.
+            f = cast(types.FunctionType, func)  # type: ignore[redundant-cast]
             if f.__closure__:
                 for i, cell in enumerate(f.__closure__):
                     if inspect.isgenerator(cell.cell_contents):