0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-16 00:23:50 +01:00

Use generators

This commit is contained in:
Erik Johnston 2017-04-10 16:55:56 +01:00
parent 40453b3f84
commit 84fbb80c8f

View file

@ -282,7 +282,7 @@ class FederationRemoteSendQueue(object):
keys = self.edus.keys() keys = self.edus.keys()
i = keys.bisect_right(from_token) i = keys.bisect_right(from_token)
j = keys.bisect_right(to_token) + 1 j = keys.bisect_right(to_token) + 1
edus = [(k, self.edus[k]) for k in keys[i:j]] edus = ((k, self.edus[k]) for k in keys[i:j])
for (pos, edu) in edus: for (pos, edu) in edus:
rows.append((pos, EduRow(edu))) rows.append((pos, EduRow(edu)))
@ -291,7 +291,7 @@ class FederationRemoteSendQueue(object):
keys = self.failures.keys() keys = self.failures.keys()
i = keys.bisect_right(from_token) i = keys.bisect_right(from_token)
j = keys.bisect_right(to_token) + 1 j = keys.bisect_right(to_token) + 1
failures = [(k, self.failures[k]) for k in keys[i:j]] failures = ((k, self.failures[k]) for k in keys[i:j])
for (pos, (destination, failure)) in failures: for (pos, (destination, failure)) in failures:
rows.append((pos, FailureRow( rows.append((pos, FailureRow(