summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/end_to_end_keys.py24
1 files changed, 9 insertions, 15 deletions
diff --git a/synapse/storage/end_to_end_keys.py b/synapse/storage/end_to_end_keys.py
index e68ce318af..258e8dcb47 100644
--- a/synapse/storage/end_to_end_keys.py
+++ b/synapse/storage/end_to_end_keys.py
@@ -62,9 +62,9 @@ class EndToEndKeyWorkerStore(SQLBaseStore):
                 # add cross-signing signatures to the keys
                 if "signatures" in device_info:
                     for sig_user_id, sigs in device_info["signatures"].items():
-                        device_info["keys"].setdefault("signatures", {}) \
-                                           .setdefault(sig_user_id, {}) \
-                                           .update(sigs)
+                        device_info["keys"].setdefault("signatures", {}).setdefault(
+                            sig_user_id, {}
+                        ).update(sigs)
 
         return results
 
@@ -131,12 +131,8 @@ class EndToEndKeyWorkerStore(SQLBaseStore):
 
         # get signatures on the device
         signature_sql = (
-            "SELECT * "
-            "  FROM e2e_cross_signing_signatures "
-            " WHERE %s"
-        ) % (
-            " OR ".join("(" + q + ")" for q in signature_query_clauses)
-        )
+            "SELECT * " "  FROM e2e_cross_signing_signatures " " WHERE %s"
+        ) % (" OR ".join("(" + q + ")" for q in signature_query_clauses))
 
         txn.execute(signature_sql, signature_query_params)
         rows = self.cursor_to_dict(txn)
@@ -144,12 +140,10 @@ class EndToEndKeyWorkerStore(SQLBaseStore):
         for row in rows:
             target_user_id = row["target_user_id"]
             target_device_id = row["target_device_id"]
-            if target_user_id in result \
-               and target_device_id in result[target_user_id]:
-                result[target_user_id][target_device_id] \
-                    .setdefault("signatures", {}) \
-                    .setdefault(row["user_id"], {})[row["key_id"]] \
-                    = row["signature"]
+            if target_user_id in result and target_device_id in result[target_user_id]:
+                result[target_user_id][target_device_id].setdefault(
+                    "signatures", {}
+                ).setdefault(row["user_id"], {})[row["key_id"]] = row["signature"]
 
         log_kv(result)
         return result