Make it a bit easier to debug when airlines= is malformed
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
[meta]
|
[meta]
|
||||||
header = VHHH TMA 1.0.0
|
header = VHHH TMA 1.0.0
|
||||||
See VHHH_PC_readme.md
|
See VHHH_PC_readme.md
|
||||||
|
callsigns = True
|
||||||
|
|
||||||
[airspace]
|
[airspace]
|
||||||
radius = 100
|
radius = 100
|
||||||
|
|||||||
+24
-21
@@ -63,28 +63,31 @@ class Airline:
|
|||||||
self.frequency = int(frequency.strip())
|
self.frequency = int(frequency.strip())
|
||||||
self.types = types.strip()
|
self.types = types.strip()
|
||||||
self.callsign = callsign.strip()
|
self.callsign = callsign.strip()
|
||||||
if Airline.callsigns is not None and Airline.use_callsigns:
|
try:
|
||||||
if '-' not in callsign:
|
if Airline.callsigns is not None and Airline.use_callsigns:
|
||||||
self.pronunciation = Airline.callsigns[callsign]
|
if '-' not in callsign:
|
||||||
|
self.pronunciation = Airline.callsigns[callsign]
|
||||||
|
else:
|
||||||
|
# if length of key is more than 3, assume it is not registration
|
||||||
|
key = callsign[:callsign.index('-')]
|
||||||
|
self.callsign = callsign.strip('_')
|
||||||
|
# if key length is longer than 3 and key doesn't have match,
|
||||||
|
# we strip '_' to allow for mil callsigns with length <= 3
|
||||||
|
self.pronunciation = Airline.callsigns.get(key, key.strip('_')) if len(key) > 3 \
|
||||||
|
else Airline.callsigns.get(key, '0')
|
||||||
else:
|
else:
|
||||||
# if length of key is more than 3, assume it is not registration
|
self.pronunciation = data[0].strip()
|
||||||
key = callsign[:callsign.index('-')]
|
data = data[1:]
|
||||||
self.callsign = callsign.strip('_')
|
if gateways is not None:
|
||||||
# if key length is longer than 3 and key doesn't have match,
|
arrival_gateways = {gateway.strip() for gateway in data[0].split("/")}
|
||||||
# we strip '_' to allow for mil callsigns with length <= 3
|
departure_gateways = {gateway.strip() for gateway in data[1].split("/")}
|
||||||
self.pronunciation = Airline.callsigns.get(key, key.strip('_')) if len(key) > 3 \
|
self.directions = "".join(sorted(
|
||||||
else Airline.callsigns.get(key, '0')
|
{gateways[gateway] for gateway in arrival_gateways | departure_gateways}))
|
||||||
else:
|
else:
|
||||||
self.pronunciation = data[0].strip()
|
self.directions = data[0].strip()
|
||||||
data = data[1:]
|
except Exception as e:
|
||||||
if gateways is not None:
|
raise ValueError(f"Could not create airline from ({callsign}, {frequency}, {types}, {str(data)})" +
|
||||||
directions = []
|
f"\nCallsign pronunciation lookup = {Airline.use_callsigns}") from e
|
||||||
arrival_gateways = {gateway.strip() for gateway in data[0].split("/")}
|
|
||||||
departure_gateways = {gateway.strip() for gateway in data[1].split("/")}
|
|
||||||
self.directions = "".join(sorted(
|
|
||||||
{gateways[gateway] for gateway in arrival_gateways | departure_gateways}))
|
|
||||||
else:
|
|
||||||
self.directions = data[0].strip()
|
|
||||||
|
|
||||||
|
|
||||||
def process_fix_list(fix_list, fixes):
|
def process_fix_list(fix_list, fixes):
|
||||||
|
|||||||
Reference in New Issue
Block a user