source: src/mlx/airports.py@ 1086:54924f6e0818

python3
Last change on this file since 1086:54924f6e0818 was 919:2ce8ca39525b, checked in by István Váradi <ivaradi@…>, 6 years ago

Ran 2to3

File size: 3.3 KB
Line 
1# -*- coding: utf-8 -*-
2
3import sys
4
5#-----------------------------------------------------------------------------
6
7## @package mlx.airports
8#
9# The mapping of ICAO codes to airport names.
10#
11# This module contains the mapping of ICAO codes to airport cities and names,
12# as well as a \ref getWelcomeMessage "function" to produce a welcome message
13# for a certain airport.
14
15#-----------------------------------------------------------------------------
16
17## The mapping of the ICAO codes
18airportNames = {
19 "VTBS" : ("Bangkok", "Suvarnabhumi"),
20 "KJFK" : ("New York", "J. F. Kennedy"),
21 "CYYZ" : ("Toronto", "Lester B. Pearson"),
22 "UUEE" : ("Moscow", "Sheremetevo"),
23 "UKBB" : ("Kiev", "Borispol"),
24 "UKOO" : ("Odessa", None),
25 "USSS" : ("Yekaterinburg", "Koltsovo"),
26 "LTBA" : ("Istanbul", "Atatürk"),
27 "LLBG" : ("Tel-Aviv", "Ben Gurion"),
28 "HECA" : ("Cairo", None),
29 "LCLK" : ("Larnaca", None),
30 "LGAV" : ("Athens", "Eleftherios Venizelos"),
31 "OLBA" : ("Beirut", "Rafic Hariri"),
32 "OSDI" : ("Damascus", None),
33 "LGTS" : ("Thessaloniki", "Makedonia"),
34 "LIRF" : ("Rome", "Fiumicino"),
35 "LIPZ" : ("Venezia", "Tessera"),
36 "LATI" : ("Tirana", "Rinas"),
37 "LWSK" : ("Skopje", None),
38 "LQSA" : ("Sarajevo", "Butmir"),
39 "BKPR" : ("Pristina", None),
40 "LDZA" : ("Zagreb", "Pleso"),
41 "LDSP" : ("Split", "Kastela"),
42 "LDDU" : ("Dubrovnik", "Cilipi"),
43 "LYPG" : ("Podgorica", "Titograd"),
44 "EDDS" : ("Stuttgart Echterdingen", None),
45 "EDDF" : ("Frankfurt", "Main"),
46 "EDDM" : ("Munich", "Franz-Josef Strauss"),
47 "EDDH" : ("Hamburg", None),
48 "LFPG" : ("Paris", "Charles de Gaulle"),
49 "LFLL" : ("Lyon", "Satolas"),
50 "LSGG" : ("Geneva", "Cointrin"),
51 "LEMD" : ("Madrid", "Barajas"),
52 "EBBR" : ("Brussels", "Zaventem"),
53 "EGKK" : ("London", "Gatwick"),
54 "EIDW" : ("Dublin", "Collinstown"),
55 "EICK" : ("Cork", None),
56 "EHAM" : ("Amsterdam", "Schiphol"),
57 "EDDT" : ("Berlin", "Tegel"),
58 "EFHK" : ("Helsinki", "Vantaa"),
59 "EKCH" : ("Copenhagen", "Kastrup"),
60 "ESSA" : ("Stockholm", "Arlanda"),
61 "ESGG" : ("Gothenburg", None),
62 "LKPR" : ("Prague", "Ruznye"),
63 "LBSF" : ("Sofia", "Vrhazdebna"),
64 "EPWA" : ("Warsaw", "Okecie"),
65 "LROP" : ("Bucharest", "Otopeni"),
66 "LRTR" : ("Timisoara", None),
67 "LRCK" : ("Constanta", None),
68 "LRTM" : ("Tirgu Mures", "Vidrasau"),
69 "LHBP" : ("Budapest", "Ferihegy"),
70 "LHDC" : ("Debrecen", None)
71}
72
73#-----------------------------------------------------------------------------
74
75def getWelcomeMessage(icao):
76 """Get the welcome message for the airport with the given ICAO code."""
77 message = "Welcome to "
78 if icao in airportNames:
79 (town, airportName) = airportNames[icao]
80 message += town if airportName is None \
81 else (town + " " + airportName + " Airport")
82 else:
83 message += icao
84 message += "."
85 return message
86
87#-----------------------------------------------------------------------------
88
89if __name__ == "__main__":
90 for (town, airport) in airportNames.values():
91 print(town, airport)
92 print(getWelcomeMessage("LIRF"))
93 print(getWelcomeMessage("LHDC"))
94 print(getWelcomeMessage("LIRN"))
95 print(getWelcomeMessage("LHBP"))
96 print(getWelcomeMessage("EDDF"))
97
98#-----------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.