Skip to content

Commit e58f391

Browse files
committed
Adjusted to be campatible with python 2.7
1 parent 635c2da commit e58f391

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

python/opensky_api.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from datetime import datetime
3030
from collections import defaultdict
3131
import time
32-
from typing import Union
3332

3433
logger = logging.getLogger("opensky_api")
3534
logger.addHandler(logging.NullHandler())
@@ -155,7 +154,7 @@ class FlightData(object):
155154
"arrivalAirportCandidatesCount",
156155
]
157156

158-
def __init__(self, arr: list):
157+
def __init__(self, arr):
159158
"""
160159
Function that initializes the FlightData object.
161160
@@ -192,7 +191,7 @@ class Waypoint(object):
192191
"on_ground",
193192
]
194193

195-
def __init__(self, arr: list):
194+
def __init__(self, arr):
196195
"""
197196
Function that initializes the Waypoint object.
198197
@@ -219,7 +218,7 @@ class FlightTrack(object):
219218
220219
"""
221220

222-
def __init__(self, arr: dict):
221+
def __init__(self, arr):
223222
"""
224223
Function that initializes the FlightTrack object.
225224
@@ -366,7 +365,7 @@ def get_my_states(self, time_secs=0, icao24=None, serials=None):
366365
return OpenSkyStates(states_json)
367366
return None
368367

369-
def get_flighs_from_interval(self, begin: int, end: int) -> list[FlightData]:
368+
def get_flighs_from_interval(self, begin, end):
370369
"""
371370
Retrieves data of flights for certain time interval [begin, end].
372371
:param begin: Start of time interval to retrieve flights for as Unix time (seconds since epoch).
@@ -385,9 +384,9 @@ def get_flighs_from_interval(self, begin: int, end: int) -> list[FlightData]:
385384

386385
if states_json is not None:
387386
return [FlightData(list(entry.values())) for entry in states_json]
388-
return []
387+
return None
389388

390-
def get_flighs_by_aircraft(self, icao24: str, begin: int, end: int) -> list[FlightData]:
389+
def get_flighs_by_aircraft(self, icao24, begin, end):
391390
"""
392391
Retrievs data of flights for certain aircraft and time interval.
393392
:param icao24: Unique ICAO 24-bit address of the transponder in hex string representation.
@@ -410,9 +409,9 @@ def get_flighs_by_aircraft(self, icao24: str, begin: int, end: int) -> list[Flig
410409

411410
if states_json is not None:
412411
return [FlightData(list(entry.values())) for entry in states_json]
413-
return []
412+
return None
414413

415-
def get_arrivals_by_airport(self, airport: str, begin: int, end: int) -> list[FlightData]:
414+
def get_arrivals_by_airport(self, airport, begin, end):
416415
"""
417416
Retrieve flights for a certain airport which arrived within a given time interval [begin, end].
418417
:param airport: ICAO identier for the airport
@@ -433,9 +432,9 @@ def get_arrivals_by_airport(self, airport: str, begin: int, end: int) -> list[Fl
433432

434433
if states_json is not None:
435434
return [FlightData(list(entry.values())) for entry in states_json]
436-
return []
435+
return None
437436

438-
def get_departures_by_airport(self, airport: str, begin: int, end: int) -> list[FlightData]:
437+
def get_departures_by_airport(self, airport, begin, end):
439438
"""
440439
Retrieve flights for a certain airport which arrived within a given time interval [begin, end].
441440
:param airport: ICAO identier for the airport
@@ -458,7 +457,7 @@ def get_departures_by_airport(self, airport: str, begin: int, end: int) -> list[
458457
return [FlightData(list(entry.values())) for entry in states_json]
459458
return []
460459

461-
def get_track_by_aircraft(self, icao24: str, t: int = 0) -> Union[FlightTrack, type(None)]:
460+
def get_track_by_aircraft(self, icao24, t=0):
462461
"""
463462
Retrieve flights for a certain airport which arrived within a given time interval [begin, end].
464463
:param icao24: Unique ICAO 24-bit address of the transponder in hex string representation.

0 commit comments

Comments
 (0)