minor bug fix
This commit is contained in:
parent
c9d2c4c6bc
commit
7348a10f1b
@ -295,7 +295,7 @@ cpdef int altcode(str msg):
|
|||||||
@cython.wraparound(False)
|
@cython.wraparound(False)
|
||||||
cpdef int altitude(str binstr):
|
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")
|
raise RuntimeError("Input must be 13 bits binary string")
|
||||||
|
|
||||||
cdef bytearray _mbin = bytearray(binstr.encode())
|
cdef bytearray _mbin = bytearray(binstr.encode())
|
||||||
|
@ -234,7 +234,7 @@ def squawk(binstr: str) -> str:
|
|||||||
int: altitude in ft
|
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")
|
raise RuntimeError("Input must be 13 bits binary string")
|
||||||
|
|
||||||
C1 = binstr[0]
|
C1 = binstr[0]
|
||||||
@ -296,7 +296,7 @@ def altitude(binstr: str) -> Optional[int]:
|
|||||||
"""
|
"""
|
||||||
alt: 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")
|
raise RuntimeError("Input must be 13 bits binary string")
|
||||||
|
|
||||||
Mbit = binstr[6]
|
Mbit = binstr[6]
|
||||||
|
Loading…
Reference in New Issue
Block a user