engine: add stubs
This commit is contained in:
parent
dea24c7453
commit
feb6fc1e19
1 changed files with 18 additions and 0 deletions
18
engine.py
18
engine.py
|
|
@ -7,8 +7,11 @@ BRANDS: dict[str, str] = {
|
||||||
"greggs": "[\"brand:wikidata\"=\"Q3403981\"]",
|
"greggs": "[\"brand:wikidata\"=\"Q3403981\"]",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EncodedLocation = list[float, list[float]]
|
||||||
|
|
||||||
|
|
||||||
def fetch_data(brand: str) -> list[tuple[float | None, float | None]]:
|
def fetch_data(brand: str) -> list[tuple[float | None, float | None]]:
|
||||||
|
"""Fetch a list of locations from OSM."""
|
||||||
api = overpy.Overpass()
|
api = overpy.Overpass()
|
||||||
|
|
||||||
filters = BRANDS[brand]
|
filters = BRANDS[brand]
|
||||||
|
|
@ -29,7 +32,22 @@ def fetch_data(brand: str) -> list[tuple[float | None, float | None]]:
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def encode(location: tuple[float, float]) -> EncodedLocation:
|
||||||
|
"""Encode a location."""
|
||||||
|
|
||||||
|
# Stub
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def decode(location: EncodedLocation) -> tuple[float, float]:
|
||||||
|
"""Decode into a location."""
|
||||||
|
|
||||||
|
# Stub
|
||||||
|
return (0.091659, 52.210796)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
"""Testing."""
|
||||||
print("Running query...")
|
print("Running query...")
|
||||||
greggs = fetch_data("greggs")
|
greggs = fetch_data("greggs")
|
||||||
print(f"Query done - got {len(greggs)} Greggs!")
|
print(f"Query done - got {len(greggs)} Greggs!")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue