forked from edward/owl-map
Type hints and docstrings.
This commit is contained in:
parent
cc3dc87d68
commit
26b47a5dd3
|
@ -413,12 +413,15 @@ class ItemLocation(Base):
|
||||||
return loc
|
return loc
|
||||||
|
|
||||||
|
|
||||||
def location_objects(coords):
|
def location_objects(
|
||||||
locations = []
|
coords_dict: dict[str, list[wikidata.Coords]]
|
||||||
for pid, coord_list in coords.items():
|
) -> list[ItemLocation]:
|
||||||
|
"""Create location objects with the given coordinates."""
|
||||||
|
locations: list[ItemLocation] = []
|
||||||
|
for pid, coord_list in coords_dict.items():
|
||||||
for num, coords in enumerate(coord_list):
|
for num, coords in enumerate(coord_list):
|
||||||
point = f"POINT({coords['longitude']} {coords['latitude']})"
|
point = f"POINT({coords['longitude']} {coords['latitude']})"
|
||||||
loc = ItemLocation(
|
loc: ItemLocation = ItemLocation(
|
||||||
property_id=int(pid[1:]), statement_order=num, location=point
|
property_id=int(pid[1:]), statement_order=num, location=point
|
||||||
)
|
)
|
||||||
locations.append(loc)
|
locations.append(loc)
|
||||||
|
|
Loading…
Reference in a new issue