fix formatting

This commit is contained in:
Hubert Chathi 2019-08-14 22:42:20 -07:00
parent 049a93901c
commit a1b0cbc262
2 changed files with 24 additions and 19 deletions

View file

@ -203,10 +203,7 @@ class E2eRoomKeysHandler(object):
) )
count = yield self.store.count_e2e_room_keys(user_id, version) count = yield self.store.count_e2e_room_keys(user_id, version)
return { return {"hash": version_hash, "count": count}
"hash": version_hash,
"count": count
}
@staticmethod @staticmethod
def _should_replace_room_key(current_room_key, room_key): def _should_replace_room_key(current_room_key, room_key):

View file

@ -52,7 +52,7 @@ class EndToEndRoomKeyStore(SQLBaseStore):
"is_verified": room_key["is_verified"], "is_verified": room_key["is_verified"],
"session_data": json.dumps(room_key["session_data"]), "session_data": json.dumps(room_key["session_data"]),
}, },
desc="update_e2e_room_key" desc="update_e2e_room_key",
) )
@defer.inlineCallbacks @defer.inlineCallbacks
@ -67,7 +67,8 @@ class EndToEndRoomKeyStore(SQLBaseStore):
yield self._simple_insert_many( yield self._simple_insert_many(
table="e2e_room_keys", table="e2e_room_keys",
values=[{ values=[
{
"user_id": user_id, "user_id": user_id,
"version": version, "version": version,
"room_id": room_id, "room_id": room_id,
@ -76,8 +77,10 @@ class EndToEndRoomKeyStore(SQLBaseStore):
"forwarded_count": room_key["forwarded_count"], "forwarded_count": room_key["forwarded_count"],
"is_verified": room_key["is_verified"], "is_verified": room_key["is_verified"],
"session_data": json.dumps(room_key["session_data"]), "session_data": json.dumps(room_key["session_data"]),
} for (room_id, session_id, room_key) in room_keys], }
desc="add_e2e_room_keys" for (room_id, session_id, room_key) in room_keys
],
desc="add_e2e_room_keys",
) )
@defer.inlineCallbacks @defer.inlineCallbacks
@ -157,8 +160,11 @@ class EndToEndRoomKeyStore(SQLBaseStore):
""" """
return self.runInteraction( return self.runInteraction(
"get_e2e_room_keys_multi", self._get_e2e_room_keys_multi_txn, "get_e2e_room_keys_multi",
user_id, version, room_keys self._get_e2e_room_keys_multi_txn,
user_id,
version,
room_keys,
) )
@staticmethod @staticmethod
@ -184,7 +190,9 @@ class EndToEndRoomKeyStore(SQLBaseStore):
is_verified, session_data is_verified, session_data
FROM e2e_room_keys FROM e2e_room_keys
WHERE user_id = ? AND version = ? AND (%s) WHERE user_id = ? AND version = ? AND (%s)
""" % (" OR ".join(where_clauses)) """ % (
" OR ".join(where_clauses)
)
txn.execute(sql, params) txn.execute(sql, params)