messageboard-2020-05-28-1805.py
01234567890123456789012345678901234567890123456789012345678901234567890123456789









53725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418











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




          flight.get('flight_number'), flight.get('squawk'),
          last_flight.get('flight_number'), last_flight.get('squawk')))
  flights[-1] = flight

  # 2) replace the last pickled record
  #
  # There is potential complication in that the last flight and the new flight
  # crossed into a new day, and we are using date segmentation so that the last
  # flight exists in yesterday's file
  max_days = 1
  if not SIMULATION and DisplayTime(flight, '%x') != DisplayTime(last_flight, '%x'):
    max_days = 2
    message += (
        '; in repickling, we crossed days, so pickled flights that might otherwise'
        ' be in %s file are now all located in %s file' % (
            DisplayTime(last_flight, '%x'), DisplayTime(flight, '%x')))

  Log(message)

  args = (PICKLE_FLIGHTS, not SIMULATION, max_days)
  saved_flights = UnpickleObjectFromFile(*args)
  files_to_overwrite = UnpickleObjectFromFile(*args, filenames=True)

  if saved_flights:
    saved_flights[-1] = flight
  else:
    saved_flights = [flight]
  for file in files_to_overwrite:
    os.remove(file)
  for f in saved_flights:
    PickleObjectToFile(f, PICKLE_FLIGHTS, not SIMULATION)

  return False


def HeartbeatRestart():
  if SIMULATION:
    return 0
  UpdateDashboard(True)  # Indicates that this wasn't running a moment before, ...
  UpdateDashboard(False)  # ... and now it is running!
  return time.time()

def Heartbeat(last_heartbeat_time):
  if SIMULATION:
    return last_heartbeat_time
  now = time.time()
  if now - last_heartbeat_time > HEARTBEAT_SECONDS:




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





01234567890123456789012345678901234567890123456789012345678901234567890123456789









53725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394    53955396539753985399540054015402540354045405540654075408540954105411541254135414











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




          flight.get('flight_number'), flight.get('squawk'),
          last_flight.get('flight_number'), last_flight.get('squawk')))
  flights[-1] = flight

  # 2) replace the last pickled record
  #
  # There is potential complication in that the last flight and the new flight
  # crossed into a new day, and we are using date segmentation so that the last
  # flight exists in yesterday's file
  max_days = 1
  if not SIMULATION and DisplayTime(flight, '%x') != DisplayTime(last_flight, '%x'):
    max_days = 2
    message += (
        '; in repickling, we crossed days, so pickled flights that might otherwise'
        ' be in %s file are now all located in %s file' % (
            DisplayTime(last_flight, '%x'), DisplayTime(flight, '%x')))

  Log(message)

  args = (PICKLE_FLIGHTS, not SIMULATION, max_days)
  saved_flights = UnpickleObjectFromFile(*args)[:-1]
  files_to_overwrite = UnpickleObjectFromFile(*args, filenames=True)





  for file in files_to_overwrite:
    os.remove(file)
  for f in saved_flights:
    PickleObjectToFile(f, PICKLE_FLIGHTS, not SIMULATION)

  return False


def HeartbeatRestart():
  if SIMULATION:
    return 0
  UpdateDashboard(True)  # Indicates that this wasn't running a moment before, ...
  UpdateDashboard(False)  # ... and now it is running!
  return time.time()

def Heartbeat(last_heartbeat_time):
  if SIMULATION:
    return last_heartbeat_time
  now = time.time()
  if now - last_heartbeat_time > HEARTBEAT_SECONDS:




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