01234567890123456789012345678901234567890123456789012345678901234567890123456789
416417418419420421422423424425426427428429430431432433434435 436437438439440441442443444445 446447448449450451452453454455456457458459460461462463464465 29252926292729282929293029312932293329342935293629372938293929402941294229432944 29452946294729482949295029512952295329542955295629572958295929602961296229632964 | <----SKIPPED LINES----> AIRCRAFT_LENGTH['Cessna Citation Mustang (twin-jet)'] = 12.37 AIRCRAFT_LENGTH['Cessna Citation Sovereign (twin-jet)'] = 19.35 AIRCRAFT_LENGTH['Cessna Citation V (twin-jet)'] = 14.91 AIRCRAFT_LENGTH['Cessna Citation X (twin-jet)'] = 22.04 AIRCRAFT_LENGTH['Cessna Conquest 2 (twin-turboprop)'] = 11.89 AIRCRAFT_LENGTH['Cessna Skyhawk (piston-single)'] = 8.28 AIRCRAFT_LENGTH['Cessna Skylane (piston-single)'] = 8.84 AIRCRAFT_LENGTH['Cessna T206 Turbo Stationair (piston-single)'] = 8.61 AIRCRAFT_LENGTH['Cirrus SR-20 (piston-single)'] = 7.92 AIRCRAFT_LENGTH['Cirrus SR-22 (piston-single)'] = 7.92 AIRCRAFT_LENGTH['Daher-Socata TBM-900 (single-turboprop)'] = 10.72 AIRCRAFT_LENGTH['Dassault Falcon 2000 (twin-jet)'] = 20.23 AIRCRAFT_LENGTH['Dassault Falcon 900 (tri-jet)'] = 20.21 AIRCRAFT_LENGTH['Embraer 170/175 (twin-jet)'] = (29.90 + 31.68) / 2 AIRCRAFT_LENGTH['EMBRAER 175 (long wing) (twin-jet)'] = 31.68 AIRCRAFT_LENGTH['Embraer ERJ-135 (twin-jet)'] = 26.33 AIRCRAFT_LENGTH['Embraer ERJ-145 (twin-jet)'] = 29.87 AIRCRAFT_LENGTH['Embraer ERJ 175 (twin-jet)'] = 31.68 AIRCRAFT_LENGTH['Embraer Legacy 450 (twin-jet)'] = 19.69 AIRCRAFT_LENGTH['Embraer Legacy 550 (twin-jet)'] = 20.74 AIRCRAFT_LENGTH['Embraer Phenom 300 (twin-jet)'] = 15.9 AIRCRAFT_LENGTH['Eurocopter EC-635 (twin-turboshaft)'] = 10.21 AIRCRAFT_LENGTH['Gulfstream Aerospace Gulfstream 3 (twin-jet)'] = 25.32 AIRCRAFT_LENGTH['Gulfstream Aerospace Gulfstream G450 (twin-jet)'] = 27.23 AIRCRAFT_LENGTH['Gulfstream Aerospace Gulfstream G550 (twin-jet)'] = 29.39 AIRCRAFT_LENGTH['Gulfstream Aerospace Gulfstream IV (twin-jet)'] = 26.92 AIRCRAFT_LENGTH['Gulfstream Aerospace Gulfstream V (twin-jet)'] = 29.4 AIRCRAFT_LENGTH['Hawker Beechcraft 4000 (twin-jet)'] = 21.08 AIRCRAFT_LENGTH['Honda HondaJet (twin-jet)'] = 12.99 AIRCRAFT_LENGTH['IAI Gulfstream G100 (twin-jet)'] = 16.94 AIRCRAFT_LENGTH['IAI Gulfstream G280 (twin-jet)'] = 20.3 AIRCRAFT_LENGTH['Learjet 35 (twin-jet)'] = 14.83 AIRCRAFT_LENGTH['Learjet 45 (twin-jet)'] = 17.68 AIRCRAFT_LENGTH['Learjet 60 (twin-jet)'] = 17.88 AIRCRAFT_LENGTH['McDonnell Douglas MD-11 (tri-jet)'] = 61.6 AIRCRAFT_LENGTH['Pilatus PC-12 (single-turboprop)'] = 14.4 AIRCRAFT_LENGTH['Raytheon Hawker 800XP (twin-jet)'] = 15.60 AIRCRAFT_LENGTH['Rockwell Turbo Commander 690 (twin-turboprop)'] = 11.22 for mixed_case_plane in list(AIRCRAFT_LENGTH.keys()): # pylint: disable=C0201 AIRCRAFT_LENGTH[mixed_case_plane.upper()] = AIRCRAFT_LENGTH[mixed_case_plane] AIRCRAFT_LENGTH.pop(mixed_case_plane) def Log(message, file=None, rolling=None): """Write a message to a logfile along with a timestamp. Args: message: string message to write file: string representing file name and, if needed, path to the file to write to <----SKIPPED LINES----> min value. insight_max: boolean indicating whether to generate an insight about the max value. hours: the time horizon over which to look for superlative flights. Returns: Printable string message; if no message or insights to generate, then an empty string. """ message = '' this_flight = flights[-1] this_flight_number = this_flight.get('flight_number', 'The last flight') first_timestamp = flights[0]['now'] last_timestamp = flights[-1]['now'] included_seconds = last_timestamp - first_timestamp if included_seconds > SECONDS_IN_HOUR * hours: relevant_flights = [ f for f in flights[:-1] if last_timestamp - f['now'] < SECONDS_IN_HOUR * hours] value_min = min([ f.get(key) for f in relevant_flights if isinstance(f.get(key), numbers.Number)]) value_max = max([ f.get(key) for f in relevant_flights if isinstance(f.get(key), numbers.Number)]) values_other = len( [1 for f in relevant_flights if isinstance(f.get(key), numbers.Number)]) this_value = this_flight.get(key) if this_value and values_other: superlative = True if ( isinstance(this_value, numbers.Number) and isinstance(value_max, numbers.Number) and this_value > value_max and insight_max): absolute_string = absolute_list[1] <----SKIPPED LINES----> |
01234567890123456789012345678901234567890123456789012345678901234567890123456789
416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467 292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968 | <----SKIPPED LINES----> AIRCRAFT_LENGTH['Cessna Citation Mustang (twin-jet)'] = 12.37 AIRCRAFT_LENGTH['Cessna Citation Sovereign (twin-jet)'] = 19.35 AIRCRAFT_LENGTH['Cessna Citation V (twin-jet)'] = 14.91 AIRCRAFT_LENGTH['Cessna Citation X (twin-jet)'] = 22.04 AIRCRAFT_LENGTH['Cessna Conquest 2 (twin-turboprop)'] = 11.89 AIRCRAFT_LENGTH['Cessna Skyhawk (piston-single)'] = 8.28 AIRCRAFT_LENGTH['Cessna Skylane (piston-single)'] = 8.84 AIRCRAFT_LENGTH['Cessna T206 Turbo Stationair (piston-single)'] = 8.61 AIRCRAFT_LENGTH['Cirrus SR-20 (piston-single)'] = 7.92 AIRCRAFT_LENGTH['Cirrus SR-22 (piston-single)'] = 7.92 AIRCRAFT_LENGTH['Daher-Socata TBM-900 (single-turboprop)'] = 10.72 AIRCRAFT_LENGTH['Dassault Falcon 2000 (twin-jet)'] = 20.23 AIRCRAFT_LENGTH['Dassault Falcon 900 (tri-jet)'] = 20.21 AIRCRAFT_LENGTH['Embraer 170/175 (twin-jet)'] = (29.90 + 31.68) / 2 AIRCRAFT_LENGTH['EMBRAER 175 (long wing) (twin-jet)'] = 31.68 AIRCRAFT_LENGTH['Embraer ERJ-135 (twin-jet)'] = 26.33 AIRCRAFT_LENGTH['Embraer ERJ-145 (twin-jet)'] = 29.87 AIRCRAFT_LENGTH['Embraer ERJ 175 (twin-jet)'] = 31.68 AIRCRAFT_LENGTH['Embraer Legacy 450 (twin-jet)'] = 19.69 AIRCRAFT_LENGTH['Embraer Legacy 550 (twin-jet)'] = 20.74 AIRCRAFT_LENGTH['Embraer Legacy 600/650 (twin-jet)'] = 26.33 AIRCRAFT_LENGTH['Embraer Phenom 300 (twin-jet)'] = 15.9 AIRCRAFT_LENGTH['Eurocopter EC-635 (twin-turboshaft)'] = 10.21 AIRCRAFT_LENGTH['Gulfstream Aerospace Gulfstream 3 (twin-jet)'] = 25.32 AIRCRAFT_LENGTH['Gulfstream Aerospace Gulfstream G450 (twin-jet)'] = 27.23 AIRCRAFT_LENGTH['Gulfstream Aerospace Gulfstream G550 (twin-jet)'] = 29.39 AIRCRAFT_LENGTH['Gulfstream Aerospace Gulfstream IV (twin-jet)'] = 26.92 AIRCRAFT_LENGTH['Gulfstream Aerospace Gulfstream V (twin-jet)'] = 29.4 AIRCRAFT_LENGTH['Hawker Beechcraft 4000 (twin-jet)'] = 21.08 AIRCRAFT_LENGTH['Honda HondaJet (twin-jet)'] = 12.99 AIRCRAFT_LENGTH['IAI Gulfstream G100 (twin-jet)'] = 16.94 AIRCRAFT_LENGTH['IAI Gulfstream G200 (twin-jet)'] = 18.97 AIRCRAFT_LENGTH['IAI Gulfstream G280 (twin-jet)'] = 20.3 AIRCRAFT_LENGTH['Learjet 35 (twin-jet)'] = 14.83 AIRCRAFT_LENGTH['Learjet 45 (twin-jet)'] = 17.68 AIRCRAFT_LENGTH['Learjet 60 (twin-jet)'] = 17.88 AIRCRAFT_LENGTH['McDonnell Douglas MD-11 (tri-jet)'] = 61.6 AIRCRAFT_LENGTH['Pilatus PC-12 (single-turboprop)'] = 14.4 AIRCRAFT_LENGTH['Raytheon Hawker 800XP (twin-jet)'] = 15.60 AIRCRAFT_LENGTH['Rockwell Turbo Commander 690 (twin-turboprop)'] = 11.22 for mixed_case_plane in list(AIRCRAFT_LENGTH.keys()): # pylint: disable=C0201 AIRCRAFT_LENGTH[mixed_case_plane.upper()] = AIRCRAFT_LENGTH[mixed_case_plane] AIRCRAFT_LENGTH.pop(mixed_case_plane) def Log(message, file=None, rolling=None): """Write a message to a logfile along with a timestamp. Args: message: string message to write file: string representing file name and, if needed, path to the file to write to <----SKIPPED LINES----> min value. insight_max: boolean indicating whether to generate an insight about the max value. hours: the time horizon over which to look for superlative flights. Returns: Printable string message; if no message or insights to generate, then an empty string. """ message = '' this_flight = flights[-1] this_flight_number = this_flight.get('flight_number', 'The last flight') first_timestamp = flights[0]['now'] last_timestamp = flights[-1]['now'] included_seconds = last_timestamp - first_timestamp if included_seconds > SECONDS_IN_HOUR * hours: relevant_flights = [ f for f in flights[:-1] if last_timestamp - f['now'] < SECONDS_IN_HOUR * hours] if not relevant_flights: return message value_min = min([ f.get(key) for f in relevant_flights if isinstance(f.get(key), numbers.Number)]) value_max = max([ f.get(key) for f in relevant_flights if isinstance(f.get(key), numbers.Number)]) values_other = len( [1 for f in relevant_flights if isinstance(f.get(key), numbers.Number)]) this_value = this_flight.get(key) if this_value and values_other: superlative = True if ( isinstance(this_value, numbers.Number) and isinstance(value_max, numbers.Number) and this_value > value_max and insight_max): absolute_string = absolute_list[1] <----SKIPPED LINES----> |