From: Eugene Crosser Date: Sat, 28 May 2022 11:20:50 +0000 (+0200) Subject: typchecking: annotate googlemaps.py X-Git-Tag: 0.96~13 X-Git-Url: http://www.average.org/gitweb/?p=loctrkd.git;a=commitdiff_plain;h=2e281d58e06f74eadd0891410b3c55d60ee0eefc typchecking: annotate googlemaps.py --- diff --git a/gps303/googlemaps.py b/gps303/googlemaps.py index bb19a64..2ea0103 100644 --- a/gps303/googlemaps.py +++ b/gps303/googlemaps.py @@ -1,17 +1,23 @@ import googlemaps as gmaps -from sqlite3 import connect +from typing import Any, Dict, List, Tuple gclient = None -def init(conf): +def init(conf: Dict[str, Any]) -> None: global gclient with open(conf["googlemaps"]["accesstoken"], encoding="ascii") as fl: token = fl.read().rstrip() gclient = gmaps.Client(key=token) -def lookup(mcc, mnc, gsm_cells, wifi_aps): +def lookup( + mcc: int, + mnc: int, + gsm_cells: List[Tuple[int, int, int]], + wifi_aps: List[Tuple[str, int]], +) -> Tuple[float, float]: + assert gclient is not None kwargs = { "home_mobile_country_code": mcc, "home_mobile_network_code": mnc, @@ -39,6 +45,7 @@ def lookup(mcc, mnc, gsm_cells, wifi_aps): if __name__.endswith("__main__"): from datetime import datetime, timezone + from sqlite3 import connect import sys from .gps303proto import *