]> www.average.org Git - loctrkd.git/commitdiff
typeckeck: annotate __main__ and fix gps303proto
authorEugene Crosser <crosser@average.org>
Mon, 30 May 2022 21:25:17 +0000 (23:25 +0200)
committerEugene Crosser <crosser@average.org>
Mon, 30 May 2022 21:25:17 +0000 (23:25 +0200)
gps303/__main__.py
gps303/gps303proto.py

index 15832804c130e0ffebe249d7926ab3d84a9a500e..2ad2ecfea0aaacab36aeae9cf526ad8067f58734 100644 (file)
@@ -1,10 +1,12 @@
 """ Command line tool for sending requests to the terminal """
 
 """ Command line tool for sending requests to the terminal """
 
+from configparser import ConfigParser
 from datetime import datetime, timezone
 from getopt import getopt
 from logging import getLogger
 from sys import argv
 from time import time
 from datetime import datetime, timezone
 from getopt import getopt
 from logging import getLogger
 from sys import argv
 from time import time
+from typing import List, Tuple
 import zmq
 
 from . import common
 import zmq
 
 from . import common
@@ -14,9 +16,12 @@ from .zmsg import Bcast, Resp
 log = getLogger("gps303")
 
 
 log = getLogger("gps303")
 
 
-def main(conf, opts, args):
-    zctx = zmq.Context()
-    zpush = zctx.socket(zmq.PUSH)
+def main(
+    conf: ConfigParser, opts: List[Tuple[str, str]], args: List[str]
+) -> None:
+    # Is this https://github.com/zeromq/pyzmq/issues/1627 still not fixed?!
+    zctx = zmq.Context()  # type: ignore
+    zpush = zctx.socket(zmq.PUSH)  # type: ignore
     zpush.connect(conf.get("collector", "listenurl"))
 
     if len(args) < 2:
     zpush.connect(conf.get("collector", "listenurl"))
 
     if len(args) < 2:
index cee1bfaf512fb90321ab85083dc5e985fdb8657c..c96a6dc945312ef4b0f9df46239afa06c73f6370 100755 (executable)
@@ -665,7 +665,9 @@ if True:  # just to indent the code, sorry!
             PROTOS[cls.__name__] = cls.PROTO
 
 
             PROTOS[cls.__name__] = cls.PROTO
 
 
-def class_by_prefix(prefix: str) -> Union[type, List[Tuple[str, int]]]:
+def class_by_prefix(
+    prefix: str,
+) -> Union[Type[GPS303Pkt], List[Tuple[str, int]]]:
     lst = [
         (name, proto)
         for name, proto in PROTOS.items()
     lst = [
         (name, proto)
         for name, proto in PROTOS.items()