Refactor.

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

9
app.py
View file

@ -515,11 +515,10 @@ 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, []):
continue if 'datavalue' not in claim['mainsnak']:
for claim in entity['claims'][key]: continue
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
def get_other(entity): def get_other(entity):