01234567890123456789012345678901234567890123456789012345678901234567890123456789
1213141516171819202122232425262728293031 32 3334353637383940414243444546474849505152 451452453454455456457458459460461462463464465466467468469470 471472473 474475476477478479480481482483484485486487488489490491492493 6314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356 | <----SKIPPED LINES----> import re import shutil import signal import statistics import sys import textwrap import time import bs4 import dateutils import numpy import matplotlib import matplotlib.pyplot import psutil import pycurl import pytz import requests import tzlocal import unidecode from constants import RASPBERRY_PI, MESSAGEBOARD_PATH, WEBSERVER_PATH import arduino if RASPBERRY_PI: import gpiozero # pylint: disable=E0401 import RPi.GPIO # pylint: disable=E0401 VERBOSE = False # additional messages logged SHUTDOWN_SIGNAL = '' REBOOT_SIGNAL = False SIMULATION = False SIMULATION_COUNTER = 0 SIMULATION_PREFIX = 'SIM_' PICKLE_DUMP_JSON_FILE = 'pickle/dump_json.pk' PICKLE_FA_JSON_FILE = 'pickle/fa_json.pk' DUMP_JSONS = None # loaded only if in simulation mode FA_JSONS = None # loaded only if in simulation mode <----SKIPPED LINES----> 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['Fairchild Dornier 328JET (twin-jet)'] = 21.11 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 G650 (twin-jet)'] = 30.41 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 G150 (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 40 (twin-jet)'] = 16.92 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['McDonnell Douglas MD-83 (twin-jet)'] = 45.06 AIRCRAFT_LENGTH['Mooney M-20 (piston-single)'] = 8.13 AIRCRAFT_LENGTH['North American Navion (piston-single)'] = 8.38 AIRCRAFT_LENGTH['Pilatus PC-12 (single-turboprop)'] = 14.4 AIRCRAFT_LENGTH['Pilatus PC-24 (twin-jet)'] = 16.85 AIRCRAFT_LENGTH['Piper Cherokee (piston-single)'] = 7.10 AIRCRAFT_LENGTH['Raytheon Hawker 800 (twin-jet)'] = 15.60 AIRCRAFT_LENGTH['Raytheon Hawker 800XP (twin-jet)'] = 15.60 AIRCRAFT_LENGTH['Raytheon Hawker 850XP (twin-jet)'] = 15.60 AIRCRAFT_LENGTH['Raytheon Hawker 900XP (twin-jet)'] = 15.60 AIRCRAFT_LENGTH['Raytheon Hawker 1000 (twin-jet)'] = 16.08 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) # pylint: disable=line-too-long SHORTER_AIRCRAFT_NAME = {} <----SKIPPED LINES----> if missing_characters: for unused_n in range(missing_characters): message_array.append(0) extra_characters = max(0, len(message_array) - expected_characters) if extra_characters: Log('Message "%s" is too long at %d characters (max %d characters)' % (s, len(message_array), expected_characters)) message_array = message_array[:expected_characters] message_2d_array = [] for line_num in range(SPLITFLAP_LINE_COUNT): message_2d_array.append(message_array[ line_num * SPLITFLAP_CHARS_PER_LINE : (line_num + 1)*SPLITFLAP_CHARS_PER_LINE]) return message_2d_array def PublishMessage( s, subscription_id='12fd73cd-75ef-4cae-bbbf-29b2678692c1', key='c5f62d44-e30d-4c43-a43e-d4f65f4eb399', secret='b00aeb24-72f3-467c-aad2-82ba5e5266ca', timeout=5): """Publishes a text string to a Vestaboard. The message is pushed to the vestaboard splitflap display by way of its web services; see https://docs.vestaboard.com/introduction for more details. Args: s: String to publish. subscription_id: string subscription id from Vestaboard. key: string key from Vestaboard. secret: string secret from Vestaboard. timeout: Max duration in seconds that we should wait to establish a connection. """ error_code = False curl = pycurl.Curl() # See https://stackoverflow.com/questions/31826814/ # curl-post-request-into-pycurl-code # Set URL value <----SKIPPED LINES----> |
01234567890123456789012345678901234567890123456789012345678901234567890123456789
12131415161718192021222324252627282930313233343536373839404142434445464748495051525354 453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497 6318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360 | <----SKIPPED LINES----> import re import shutil import signal import statistics import sys import textwrap import time import bs4 import dateutils import numpy import matplotlib import matplotlib.pyplot import psutil import pycurl import pytz import requests import tzlocal import unidecode # pylint: disable=line-too-long from constants import RASPBERRY_PI, MESSAGEBOARD_PATH, WEBSERVER_PATH, KEY, SECRET, SUBSCRIPTION_ID # pylint: enable=line-too-long import arduino if RASPBERRY_PI: import gpiozero # pylint: disable=E0401 import RPi.GPIO # pylint: disable=E0401 VERBOSE = False # additional messages logged SHUTDOWN_SIGNAL = '' REBOOT_SIGNAL = False SIMULATION = False SIMULATION_COUNTER = 0 SIMULATION_PREFIX = 'SIM_' PICKLE_DUMP_JSON_FILE = 'pickle/dump_json.pk' PICKLE_FA_JSON_FILE = 'pickle/fa_json.pk' DUMP_JSONS = None # loaded only if in simulation mode FA_JSONS = None # loaded only if in simulation mode <----SKIPPED LINES----> 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['Fairchild Dornier 328JET (twin-jet)'] = 21.11 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 G650 (twin-jet)'] = 30.41 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 G150 (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 31 (twin-jet)'] = 14.83 AIRCRAFT_LENGTH['Learjet 35 (twin-jet)'] = 14.83 AIRCRAFT_LENGTH['Learjet 40 (twin-jet)'] = 16.92 AIRCRAFT_LENGTH['Learjet 45 (twin-jet)'] = 17.68 AIRCRAFT_LENGTH['Learjet 55 (twin-jet)'] = 16.79 AIRCRAFT_LENGTH['Learjet 60 (twin-jet)'] = 17.88 AIRCRAFT_LENGTH['McDonnell Douglas MD-11 (tri-jet)'] = 61.6 AIRCRAFT_LENGTH['McDonnell Douglas MD-83 (twin-jet)'] = 45.06 AIRCRAFT_LENGTH['Mooney M-20 (piston-single)'] = 8.13 AIRCRAFT_LENGTH['North American Navion (piston-single)'] = 8.38 AIRCRAFT_LENGTH['Pilatus PC-12 (single-turboprop)'] = 14.4 AIRCRAFT_LENGTH['Pilatus PC-24 (twin-jet)'] = 16.85 AIRCRAFT_LENGTH['Piper Cherokee (piston-single)'] = 7.10 AIRCRAFT_LENGTH['Raytheon Hawker 800 (twin-jet)'] = 15.60 AIRCRAFT_LENGTH['Raytheon Hawker 800XP (twin-jet)'] = 15.60 AIRCRAFT_LENGTH['Raytheon Hawker 850XP (twin-jet)'] = 15.60 AIRCRAFT_LENGTH['Raytheon Hawker 900XP (twin-jet)'] = 15.60 AIRCRAFT_LENGTH['Raytheon Hawker 1000 (twin-jet)'] = 16.08 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) # pylint: disable=line-too-long SHORTER_AIRCRAFT_NAME = {} <----SKIPPED LINES----> if missing_characters: for unused_n in range(missing_characters): message_array.append(0) extra_characters = max(0, len(message_array) - expected_characters) if extra_characters: Log('Message "%s" is too long at %d characters (max %d characters)' % (s, len(message_array), expected_characters)) message_array = message_array[:expected_characters] message_2d_array = [] for line_num in range(SPLITFLAP_LINE_COUNT): message_2d_array.append(message_array[ line_num * SPLITFLAP_CHARS_PER_LINE : (line_num + 1)*SPLITFLAP_CHARS_PER_LINE]) return message_2d_array def PublishMessage( s, subscription_id=SUBSCRIPTION_ID, key=KEY, secret=SECRET, timeout=5): """Publishes a text string to a Vestaboard. The message is pushed to the vestaboard splitflap display by way of its web services; see https://docs.vestaboard.com/introduction for more details. Args: s: String to publish. subscription_id: string subscription id from Vestaboard. key: string key from Vestaboard. secret: string secret from Vestaboard. timeout: Max duration in seconds that we should wait to establish a connection. """ error_code = False curl = pycurl.Curl() # See https://stackoverflow.com/questions/31826814/ # curl-post-request-into-pycurl-code # Set URL value <----SKIPPED LINES----> |