Skip to content

Commit

Permalink
Bounded type for ModeS_Decoder (#222)
Browse files Browse the repository at this point in the history
fix #221
  • Loading branch information
MichelKhalaf authored Jul 26, 2022
1 parent 7d127c3 commit 0d01284
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions traffic/data/adsb/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ class AircraftDict(Dict[str, Aircraft]):

lat0: float
lon0: float
decoder: ModeS_Decoder
decoder: Decoder

def __missing__(self, key: str) -> Aircraft:
self.decoder.on_new_aircraft(key)
Expand Down Expand Up @@ -1073,7 +1073,7 @@ def from_file(
crc_check: bool = False,
template: str = "time, longmsg",
sep: str = ",",
) -> "ModeS_Decoder":
) -> Decoder:
"""Decode raw messages dumped in a text file.
The file should contain for each line at least a timestamp and an
Expand Down Expand Up @@ -1138,7 +1138,7 @@ def from_binary(
time_0: Optional[datetime] = None,
redefine_mag: int = 10,
fh: Optional[TextIO] = None,
) -> "ModeS_Decoder":
) -> Decoder:

decoder = cls(reference)
redefine_freq = 2**redefine_mag - 1
Expand Down Expand Up @@ -1187,7 +1187,7 @@ def from_rtlsdr(
reference: Union[str, Airport, tuple[float, float]],
file_pattern: str = "~/ADSB_EHS_RAW_%Y%m%d_rtlsdr.csv",
uncertainty: bool = False,
) -> "ModeS_Decoder": # coverage: ignore
) -> Decoder: # coverage: ignore
"""Decode raw messages dumped from a RTL-SDR receiver.
:param reference: the reference location, as specified above
Expand Down Expand Up @@ -1236,7 +1236,7 @@ def from_socket(
time_0: Optional[datetime] = None,
redefine_mag: int = 7,
fh: Optional[TextIO] = None,
) -> "ModeS_Decoder": # coverage: ignore
) -> Decoder: # coverage: ignore

decoder = cls(reference)
redefine_freq = 2**redefine_mag - 1
Expand Down Expand Up @@ -1344,7 +1344,7 @@ def from_dump1090(
reference: Union[str, Airport, tuple[float, float]],
file_pattern: str = "~/ADSB_EHS_RAW_%Y%m%d_dump1090.csv",
uncertainty: bool = False,
) -> "ModeS_Decoder": # coverage: ignore
) -> Decoder: # coverage: ignore
"""Decode raw messages dumped from `dump1090
<https://github.com/MalcolmRobb/dump1090/>`_
Expand Down Expand Up @@ -1390,7 +1390,7 @@ def from_address(
time_fmt: str = "radarcape",
uncertainty: bool = False,
tcp: bool = True,
) -> "ModeS_Decoder": # coverage: ignore
) -> Decoder: # coverage: ignore
"""Decode raw messages transmitted over a TCP or UDP network.
The file should contain for each line at least a timestamp and an
Expand Down

0 comments on commit 0d01284

Please sign in to comment.