From: Eugene Crosser Date: Tue, 31 May 2022 20:52:49 +0000 (+0200) Subject: fix l3str/l3int breakage provoked by typeckeck X-Git-Tag: 0.98~7 X-Git-Url: http://www.average.org/gitweb/?p=loctrkd.git;a=commitdiff_plain;h=bd031f87f4d3f640ce8862271aa69107f31a06d5 fix l3str/l3int breakage provoked by typeckeck --- diff --git a/gps303/gps303proto.py b/gps303/gps303proto.py index c96a6dc..ab03c68 100755 --- a/gps303/gps303proto.py +++ b/gps303/gps303proto.py @@ -105,6 +105,8 @@ def hhmm(x: str) -> str: def l3str(x: Union[str, List[str]]) -> List[str]: if isinstance(x, str): lx = x.split(",") + else: + lx = x if len(lx) != 3 or not all(isinstance(el, str) for el in x): raise ValueError(str(lx) + " is not a list of three strings") return lx @@ -113,6 +115,8 @@ def l3str(x: Union[str, List[str]]) -> List[str]: def l3int(x: Union[str, List[int]]) -> List[int]: if isinstance(x, str): lx = [int(el) for el in x.split(",")] + else: + lx = x if len(lx) != 3 or not all(isinstance(el, int) for el in lx): raise ValueError(str(lx) + " is not a list of three integers") return lx