From a1b0cbc262c5ffac82714ae59c82515bfe176750 Mon Sep 17 00:00:00 2001 From: Hubert Chathi Date: Wed, 14 Aug 2019 22:42:20 -0700 Subject: [PATCH] fix formatting --- synapse/handlers/e2e_room_keys.py | 5 +--- synapse/storage/e2e_room_keys.py | 38 +++++++++++++++++++------------ 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/synapse/handlers/e2e_room_keys.py b/synapse/handlers/e2e_room_keys.py index 1666222de8..33d71a172a 100644 --- a/synapse/handlers/e2e_room_keys.py +++ b/synapse/handlers/e2e_room_keys.py @@ -203,10 +203,7 @@ class E2eRoomKeysHandler(object): ) count = yield self.store.count_e2e_room_keys(user_id, version) - return { - "hash": version_hash, - "count": count - } + return {"hash": version_hash, "count": count} @staticmethod def _should_replace_room_key(current_room_key, room_key): diff --git a/synapse/storage/e2e_room_keys.py b/synapse/storage/e2e_room_keys.py index 47c773580b..3f0a917b43 100644 --- a/synapse/storage/e2e_room_keys.py +++ b/synapse/storage/e2e_room_keys.py @@ -52,7 +52,7 @@ class EndToEndRoomKeyStore(SQLBaseStore): "is_verified": room_key["is_verified"], "session_data": json.dumps(room_key["session_data"]), }, - desc="update_e2e_room_key" + desc="update_e2e_room_key", ) @defer.inlineCallbacks @@ -67,17 +67,20 @@ class EndToEndRoomKeyStore(SQLBaseStore): yield self._simple_insert_many( table="e2e_room_keys", - values=[{ - "user_id": user_id, - "version": version, - "room_id": room_id, - "session_id": session_id, - "first_message_index": room_key["first_message_index"], - "forwarded_count": room_key["forwarded_count"], - "is_verified": room_key["is_verified"], - "session_data": json.dumps(room_key["session_data"]), - } for (room_id, session_id, room_key) in room_keys], - desc="add_e2e_room_keys" + values=[ + { + "user_id": user_id, + "version": version, + "room_id": room_id, + "session_id": session_id, + "first_message_index": room_key["first_message_index"], + "forwarded_count": room_key["forwarded_count"], + "is_verified": room_key["is_verified"], + "session_data": json.dumps(room_key["session_data"]), + } + for (room_id, session_id, room_key) in room_keys + ], + desc="add_e2e_room_keys", ) @defer.inlineCallbacks @@ -157,8 +160,11 @@ class EndToEndRoomKeyStore(SQLBaseStore): """ return self.runInteraction( - "get_e2e_room_keys_multi", self._get_e2e_room_keys_multi_txn, - user_id, version, room_keys + "get_e2e_room_keys_multi", + self._get_e2e_room_keys_multi_txn, + user_id, + version, + room_keys, ) @staticmethod @@ -184,7 +190,9 @@ class EndToEndRoomKeyStore(SQLBaseStore): is_verified, session_data FROM e2e_room_keys WHERE user_id = ? AND version = ? AND (%s) - """ % (" OR ".join(where_clauses)) + """ % ( + " OR ".join(where_clauses) + ) txn.execute(sql, params)