Type hints and docstrings.
This commit is contained in:
parent
0ed3d3c761
commit
384eb859b8
|
@ -304,7 +304,8 @@ WHERE tags ? 'wikidata'
|
||||||
return tagged
|
return tagged
|
||||||
|
|
||||||
|
|
||||||
def get_items(item_ids):
|
def get_items(item_ids: list[int]) -> list[model.Item]:
|
||||||
|
"""Get a Wikidata items with the given item IDs."""
|
||||||
items = []
|
items = []
|
||||||
for item_id in item_ids:
|
for item_id in item_ids:
|
||||||
item = model.Item.query.get(item_id)
|
item = model.Item.query.get(item_id)
|
||||||
|
@ -317,8 +318,8 @@ def get_items(item_ids):
|
||||||
return items
|
return items
|
||||||
|
|
||||||
|
|
||||||
def get_item_tags(item):
|
def get_item_tags(item: model.Item) -> dict[str, list[str]]:
|
||||||
isa_list = [v["numeric-id"] for v in item.get_isa()]
|
isa_list: list[int] = [v["numeric-id"] for v in item.get_isa()]
|
||||||
isa_items = [(isa, []) for isa in get_items(isa_list)]
|
isa_items = [(isa, []) for isa in get_items(isa_list)]
|
||||||
|
|
||||||
osm_list = defaultdict(list)
|
osm_list = defaultdict(list)
|
||||||
|
|
Loading…
Reference in a new issue