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
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
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()