Python: Replace more lists with generators (#23116)

* Replace lists with generators v2

* Replace set with {}

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* Replace more set() with {}

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 6951b3271d1770297cb6bd53878463035ec0bf43
This commit is contained in:
grekiki
2021-12-04 07:57:19 +01:00
committed by GitHub
parent 21bad1adc6
commit 9e4cc1f7ff
17 changed files with 23 additions and 23 deletions
+1 -1
View File
@@ -119,5 +119,5 @@ if __name__ == "__main__":
for x in l:
print(x[2])
print('avg sum: {0:.2%} over {1} samples {2} seconds\n'.format(
sum([stat['avg']['total'] for k, stat in stats.items()]), i, i * SLEEP_INTERVAL
sum(stat['avg']['total'] for k, stat in stats.items()), i, i * SLEEP_INTERVAL
))
+1 -1
View File
@@ -25,7 +25,7 @@ def make_pie(msgs, typ):
print()
sizes_large = [(k, sz) for (k, sz) in sizes if sz >= total * MIN_SIZE / 100]
sizes_large += [('other', sum([sz for (_, sz) in sizes if sz < total * MIN_SIZE / 100]))]
sizes_large += [('other', sum(sz for (_, sz) in sizes if sz < total * MIN_SIZE / 100))]
labels, sizes = zip(*sizes_large)