minor bug fix

This commit is contained in:
Junzi Sun 2020-06-10 00:07:26 +02:00
parent c9d2c4c6bc
commit 7348a10f1b
2 changed files with 3 additions and 3 deletions

View File

@ -295,7 +295,7 @@ cpdef int altcode(str msg):
@cython.wraparound(False)
cpdef int altitude(str binstr):
if len(binstr) != 13 or set(binstr) != set('01'):
if len(binstr) != 13 or not set(binstr).issubset(set("01")):
raise RuntimeError("Input must be 13 bits binary string")
cdef bytearray _mbin = bytearray(binstr.encode())

View File

@ -234,7 +234,7 @@ def squawk(binstr: str) -> str:
int: altitude in ft
"""
if len(binstr) != 13 or set(binstr) != set("01"):
if len(binstr) != 13 or not set(binstr).issubset(set("01")):
raise RuntimeError("Input must be 13 bits binary string")
C1 = binstr[0]
@ -296,7 +296,7 @@ def altitude(binstr: str) -> Optional[int]:
"""
alt: Optional[int]
if len(binstr) != 13 or set(binstr) != set("01"):
if len(binstr) != 13 or not set(binstr).issubset(set("01")):
raise RuntimeError("Input must be 13 bits binary string")
Mbit = binstr[6]