summary refs log tree commit diff
path: root/synapse/http/server.py
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-09-26 13:30:00 +0100
committerGitHub <noreply@github.com>2022-09-26 13:30:00 +0100
commitdcdd50e458e7f6c77e1ca28afb300d9f0ab490b3 (patch)
tree6789ab3d91d88b6963f0b77465648ddd2dcc6e1b /synapse/http/server.py
parentOnly try to backfill event if we haven't tried before recently (#13635) (diff)
downloadsynapse-dcdd50e458e7f6c77e1ca28afb300d9f0ab490b3.tar.xz
Fix mypy errors with latest canonicaljson (#13905)
* Lockfile: update canonicaljson 1.6.0 -> 1.6.3

* Fix mypy errors with latest canonicaljson

The change to `_encode_json_bytes` definition wasn't sufficient:

```
synapse/http/server.py:751: error: Incompatible types in assignment (expression has type "Callable[[Arg(object, 'json_object')], bytes]", variable has type "Callable[[Arg(object, 'data')], bytes]")  [assignment]
```

Which I think is mypy warning us that the two functions accept different
sets of kwargs. Fair enough!

* Changelog
Diffstat (limited to 'synapse/http/server.py')
-rw-r--r--synapse/http/server.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/http/server.py b/synapse/http/server.py
index 6068a94b40..bcbfac2c9f 100644
--- a/synapse/http/server.py
+++ b/synapse/http/server.py
@@ -705,7 +705,7 @@ class _ByteProducer:
         self._request = None
 
 
-def _encode_json_bytes(json_object: Any) -> bytes:
+def _encode_json_bytes(json_object: object) -> bytes:
     """
     Encode an object into JSON. Returns an iterator of bytes.
     """
@@ -746,7 +746,7 @@ def respond_with_json(
         return None
 
     if canonical_json:
-        encoder = encode_canonical_json
+        encoder: Callable[[object], bytes] = encode_canonical_json
     else:
         encoder = _encode_json_bytes