estimate_from helper, via_home estimator, all.py

This commit is contained in:
Sean Breckenridge 2023-02-15 21:25:25 -08:00
parent 52b6acbcbf
commit 9769748939
3 changed files with 98 additions and 5 deletions

View file

@ -0,0 +1,19 @@
# TODO: add config here which passes kwargs to estimate_from (under_accuracy)
# overwritable by passing the kwarg name here to the top-level estimate_location
from typing import Union
from datetime import datetime
from my.location.fallback.common import estimate_from, FallbackLocation
def estimate_location(dt: Union[datetime, float, int]) -> FallbackLocation:
from my.location.fallback.via_home import estimate_location as via_home
loc = estimate_from(
dt,
estimators=(via_home,)
)
if loc is None:
raise ValueError("Could not estimate location")
return loc