Various improvements

This commit is contained in:
Edward Betts 2023-10-13 16:50:27 +01:00
parent 474d9c6a66
commit d24744bc29
7 changed files with 71 additions and 29 deletions

0
geocode/py.typed Normal file
View file

View file

@ -153,7 +153,7 @@ def unescape_title(t: str) -> str:
return urllib.parse.unquote(t.replace("_", " "))
Hit = dict[str, str | None]
Hit = dict[str, str | int | None]
def commons_from_rows(rows: list[Row]) -> Hit | None:
@ -188,6 +188,7 @@ def build_dict(hit: Hit | None, lat: str | float, lon: str | float) -> WikidataD
"coords": coords,
"admin_level": hit.get("admin_level"),
"wikidata": hit["wikidata"],
"element": hit.get("element"),
}
if not commons_cat:
return ret