messageboard-2022-12-28-2111.py
01234567890123456789012345678901234567890123456789012345678901234567890123456789









211821192120212121222123212421252126212721282129213021312132213321342135213621372138  213921402141214221432144214521462147214821492150215121522153215421552156215721582159








64746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514











                            <----SKIPPED LINES---->




  flight = {}
  parsed_json = json.loads(flight_json)

  fa_flight_number = list(parsed_json['flights'].keys())[0]
  parsed_flight_details = parsed_json['flights'][fa_flight_number]
  flight['fa_flight_number'] = fa_flight_number

  origin = parsed_flight_details.get('origin')
  if origin:
    flight['origin_friendly'] = origin.get('friendlyLocation')
    flight['origin_iata'] = origin.get('iata')

  destination = parsed_flight_details.get('destination')
  if destination:
    flight['destination_friendly'] = destination.get('friendlyLocation')
    flight['destination_iata'] = destination.get('iata')

  aircraft_type = parsed_flight_details.get('aircraft')
  if aircraft_type:
    flight['aircraft_type_code'] = aircraft_type.get('type')
    flight['aircraft_type_friendly'] = aircraft_type.get(


        'friendlyType').replace('biréacteur', 'twin-jet')
    flight['owner_location'] = Unidecode(aircraft_type.get('ownerLocation'))
    flight['owner'] = Unidecode(aircraft_type.get('owner'))
    flight['tail'] = Unidecode(aircraft_type.get('tail'))

  takeoff_time = parsed_flight_details.get('takeoffTimes')
  if takeoff_time:
    flight['scheduled_takeofftime'] = takeoff_time.get('scheduled')
    flight['actual_takeoff_time'] = takeoff_time.get('actual')

  gate_departure_time = parsed_flight_details.get('gateDepartureTimes')
  if gate_departure_time:
    flight['scheduled_departure_time'] = gate_departure_time.get('scheduled')
    flight['actual_departure_time'] = gate_departure_time.get('actual')

  gate_arrival_time = parsed_flight_details.get('gateArrivalTimes')
  if gate_arrival_time:
    flight['scheduled_arrival_time'] = gate_arrival_time.get('scheduled')
    flight['estimated_arrival_time'] = gate_arrival_time.get('estimated')

  landing_time = parsed_flight_details.get('landingTimes')




                            <----SKIPPED LINES---->




      [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
      [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
      [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]
    where each 0 is replaced by an integer 0,...,69.
  '''
  # For each element in the string,
  #   if it is an '{', find the closing '}' and collapse into one element
  #   if it is not an '{' and we are not in an escaped string, translate
  translation = {
  ' ': 0, 'A': 1, 'B': 2, 'C': 3, 'D': 4,
  'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9,
  'J': 10, 'K': 11, 'L': 12, 'M': 13, 'N': 14,
  'O': 15, 'P': 16, 'Q': 17, 'R': 18, 'S': 19,
  'T': 20, 'U': 21, 'V': 22, 'W': 23, 'X': 24,
  'Y': 25, 'Z': 26, '1': 27, '2': 28, '3': 29,
  '4': 30, '5': 31, '6': 32, '7': 33, '8': 34,
  '9': 35, '0': 36, '!': 37, '@': 38, '#': 39,
  '$': 40, '(': 41, ')': 42, '-': 44, '+': 46,
  '&': 47, '=': 48, ';': 49, ':': 50, "'": 52,
  '"': 53, '%': 54, ',': 55, '.': 56, '/': 59,
  '?': 60, '°': 62, 'É': 5, 'Д': 1}

  # valid codes are those enumerated above plus the seven colors in 63, ..., 69
  valid_codes = list(translation.values())
  valid_codes.extend([63, 64, 65, 66, 67, 68, 69])

  pointer = 0
  message_array = []

  while pointer < len(s):
    if s[pointer] == '{':
      end_escape = s.find('}', pointer)

      if end_escape == -1:
        Log('Escaped sequence missing closing curly brace: "%s"' % s)

      escaped_sequence = s[pointer+1 : end_escape]
      try:
        escaped_value = int(escaped_sequence)
      except ValueError:
        Log('Escaped sequence "%s" is not a number in message "%s"'




                            <----SKIPPED LINES---->





01234567890123456789012345678901234567890123456789012345678901234567890123456789









21182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161








64766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516











                            <----SKIPPED LINES---->




  flight = {}
  parsed_json = json.loads(flight_json)

  fa_flight_number = list(parsed_json['flights'].keys())[0]
  parsed_flight_details = parsed_json['flights'][fa_flight_number]
  flight['fa_flight_number'] = fa_flight_number

  origin = parsed_flight_details.get('origin')
  if origin:
    flight['origin_friendly'] = origin.get('friendlyLocation')
    flight['origin_iata'] = origin.get('iata')

  destination = parsed_flight_details.get('destination')
  if destination:
    flight['destination_friendly'] = destination.get('friendlyLocation')
    flight['destination_iata'] = destination.get('iata')

  aircraft_type = parsed_flight_details.get('aircraft')
  if aircraft_type:
    flight['aircraft_type_code'] = aircraft_type.get('type')
    flight['aircraft_type_friendly'] = aircraft_type.get('friendlyType')
    if flight['aircraft_type_friendly']:
      flight['aircraft_type_friendly'] = flight[
          'aircraft_type_friendly'].replace('biréacteur', 'twin-jet')
    flight['owner_location'] = Unidecode(aircraft_type.get('ownerLocation'))
    flight['owner'] = Unidecode(aircraft_type.get('owner'))
    flight['tail'] = Unidecode(aircraft_type.get('tail'))

  takeoff_time = parsed_flight_details.get('takeoffTimes')
  if takeoff_time:
    flight['scheduled_takeofftime'] = takeoff_time.get('scheduled')
    flight['actual_takeoff_time'] = takeoff_time.get('actual')

  gate_departure_time = parsed_flight_details.get('gateDepartureTimes')
  if gate_departure_time:
    flight['scheduled_departure_time'] = gate_departure_time.get('scheduled')
    flight['actual_departure_time'] = gate_departure_time.get('actual')

  gate_arrival_time = parsed_flight_details.get('gateArrivalTimes')
  if gate_arrival_time:
    flight['scheduled_arrival_time'] = gate_arrival_time.get('scheduled')
    flight['estimated_arrival_time'] = gate_arrival_time.get('estimated')

  landing_time = parsed_flight_details.get('landingTimes')




                            <----SKIPPED LINES---->




      [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
      [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
      [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]]
    where each 0 is replaced by an integer 0,...,69.
  '''
  # For each element in the string,
  #   if it is an '{', find the closing '}' and collapse into one element
  #   if it is not an '{' and we are not in an escaped string, translate
  translation = {
  ' ': 0, 'A': 1, 'B': 2, 'C': 3, 'D': 4,
  'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9,
  'J': 10, 'K': 11, 'L': 12, 'M': 13, 'N': 14,
  'O': 15, 'P': 16, 'Q': 17, 'R': 18, 'S': 19,
  'T': 20, 'U': 21, 'V': 22, 'W': 23, 'X': 24,
  'Y': 25, 'Z': 26, '1': 27, '2': 28, '3': 29,
  '4': 30, '5': 31, '6': 32, '7': 33, '8': 34,
  '9': 35, '0': 36, '!': 37, '@': 38, '#': 39,
  '$': 40, '(': 41, ')': 42, '-': 44, '+': 46,
  '&': 47, '=': 48, ';': 49, ':': 50, "'": 52,
  '"': 53, '%': 54, ',': 55, '.': 56, '/': 59,
  '?': 60, '°': 62, 'É': 5, 'Д': 1, 'В': 2}

  # valid codes are those enumerated above plus the seven colors in 63, ..., 69
  valid_codes = list(translation.values())
  valid_codes.extend([63, 64, 65, 66, 67, 68, 69])

  pointer = 0
  message_array = []

  while pointer < len(s):
    if s[pointer] == '{':
      end_escape = s.find('}', pointer)

      if end_escape == -1:
        Log('Escaped sequence missing closing curly brace: "%s"' % s)

      escaped_sequence = s[pointer+1 : end_escape]
      try:
        escaped_value = int(escaped_sequence)
      except ValueError:
        Log('Escaped sequence "%s" is not a number in message "%s"'




                            <----SKIPPED LINES---->