Make it a bit easier to debug when airlines= is malformed

This commit is contained in:
Calvin Ng
2021-02-09 19:23:43 -08:00
parent 67ec14d606
commit 19d4f68a8a
2 changed files with 25 additions and 21 deletions
+1
View File
@@ -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
+4 -1
View File
@@ -63,6 +63,7 @@ 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()
try:
if Airline.callsigns is not None and Airline.use_callsigns: if Airline.callsigns is not None and Airline.use_callsigns:
if '-' not in callsign: if '-' not in callsign:
self.pronunciation = Airline.callsigns[callsign] self.pronunciation = Airline.callsigns[callsign]
@@ -78,13 +79,15 @@ class Airline:
self.pronunciation = data[0].strip() self.pronunciation = data[0].strip()
data = data[1:] data = data[1:]
if gateways is not None: if gateways is not None:
directions = []
arrival_gateways = {gateway.strip() for gateway in data[0].split("/")} arrival_gateways = {gateway.strip() for gateway in data[0].split("/")}
departure_gateways = {gateway.strip() for gateway in data[1].split("/")} departure_gateways = {gateway.strip() for gateway in data[1].split("/")}
self.directions = "".join(sorted( self.directions = "".join(sorted(
{gateways[gateway] for gateway in arrival_gateways | departure_gateways})) {gateways[gateway] for gateway in arrival_gateways | departure_gateways}))
else: else:
self.directions = data[0].strip() self.directions = data[0].strip()
except Exception as e:
raise ValueError(f"Could not create airline from ({callsign}, {frequency}, {types}, {str(data)})" +
f"\nCallsign pronunciation lookup = {Airline.use_callsigns}") from e
def process_fix_list(fix_list, fixes): def process_fix_list(fix_list, fixes):