No need to enumerate chunks.

This commit is contained in:
Edward Betts 2020-03-04 09:05:56 +00:00
parent 3999817cc9
commit 5c51341e7f

2
app.py
View file

@ -469,7 +469,7 @@ def get_labels(keys, name=None):
if isinstance(from_cache, dict) and from_cache.get('keys') == keys: if isinstance(from_cache, dict) and from_cache.get('keys') == keys:
labels = from_cache['labels'] labels = from_cache['labels']
if not labels: if not labels:
for num, cur in enumerate(utils.chunk(keys, 50)): for cur in utils.chunk(keys, 50):
labels += mediawiki.get_entities(cur, props='labels') labels += mediawiki.get_entities(cur, props='labels')
json.dump({'keys': keys, 'labels': labels}, json.dump({'keys': keys, 'labels': labels},