Refactor.

This commit is contained in:
Edward Betts 2020-03-04 09:06:54 +00:00
parent 5c51341e7f
commit 5868810ddc

5
app.py
View file

@ -515,10 +515,9 @@ def get_labels_db(keys):
def build_other_set(entity): def build_other_set(entity):
other_items = set() other_items = set()
for key in find_more_props.keys(): for key in find_more_props.keys():
if key not in entity['claims']: for claim in entity['claims'].get(key, []):
if 'datavalue' not in claim['mainsnak']:
continue continue
for claim in entity['claims'][key]:
if 'datavalue' in claim['mainsnak']:
other_items.add(claim['mainsnak']['datavalue']['value']['id']) other_items.add(claim['mainsnak']['datavalue']['value']['id'])
return other_items return other_items