SHARE
TWEET

load_trip_others

a guest Feb 18th, 2020 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from application import *
  2. import hashlib
  3. import flight
  4.  
  5.  
  6. ###
  7. # SETUP INSTRUCTIONS:
  8. # STEP 1: In Folder 'starter_code' > create a folder > ulitmate_testing_suite_a1 > Save this file underneath it as
  9. # 'Test_Multi_Agent_Fingerprint_Suite.py'
  10. # STEP 2: Add your tester name
  11. ###
  12. def deep_fingerprint_trip_id():
  13.     input_data_small = import_data('../data/airports.csv',
  14.                                    '../data/customers.csv',
  15.                                    '../data/segments_small.csv',
  16.                                    '../data/trips_small.csv')
  17.     input_data_big = import_data('../data/airports.csv',
  18.                                  '../data/customers.csv',
  19.                                  '../data/segments.csv', '../data/trips.csv')
  20.     small_string = ''
  21.     big_sting = ''
  22.     airports = create_airports(input_data_small[0])
  23.     customers = create_customers(input_data_small[2])
  24.  
  25.     flights_small = create_flight_segments(input_data_small[1])
  26.     trips_small = load_trips(input_data_small[3], customers, flights_small)
  27.  
  28.     flights_big = create_flight_segments(input_data_big[1])
  29.     trips_big = load_trips(input_data_big[3], customers, flights_big)
  30.  
  31.     for t in trips_small:
  32.         small_string += t.get_reservation_id() + str(t.trip_departure) + f'{t.get_in_flight_time()}{t.get_in_flight_time()}{round(t.get_total_trip_time())}'
  33.         for s in t.get_flight_segments():
  34.             small_string += str(s.seat_availability)
  35.             for element in s._manifest:
  36.                 small_string += str(element)
  37.  
  38.     for t in trips_big:
  39.         big_sting += t.get_reservation_id() + str(t.trip_departure) + f'{t.get_in_flight_time()}{t.get_in_flight_time()}{round(t.get_total_trip_time())}'
  40.         for s in t.get_flight_segments():
  41.             big_sting += str(s.seat_availability)
  42.             for element in s._manifest:
  43.                 big_sting += str(element)
  44.     return small_string, big_sting
  45.  
  46.  
  47. def deep_fingerprint_trip_id_limited():
  48.     input_data_small = import_data('../data/airports.csv',
  49.                                    '../data/customers.csv',
  50.                                    '../data/segments_small.csv',
  51.                                    '../data/trips_small.csv')
  52.     input_data_big = import_data('../data/airports.csv',
  53.                                  '../data/customers.csv',
  54.                                  '../data/segments.csv', '../data/trips.csv')
  55.     small_limited = ''
  56.     big_limited = ''
  57.     airports = create_airports(input_data_small[0])
  58.     customers = create_customers(input_data_small[2])
  59.  
  60.     flight.AIRPLANE_CAPACITY = {"Economy": 2, "Business": 1}
  61.     flights_small = create_flight_segments(input_data_small[1])
  62.     trips_small = load_trips(input_data_small[3], customers, flights_small)
  63.  
  64.     flights_big = create_flight_segments(input_data_big[1])
  65.     trips_big = load_trips(input_data_big[3], customers, flights_big)
  66.  
  67.     for t in trips_small:
  68.         small_limited += t.get_reservation_id() + str(t.trip_departure) + f'{t.get_in_flight_time()}{t.get_in_flight_time()}{round(t.get_total_trip_time())}'
  69.         for s in t.get_flight_segments():
  70.             small_limited += str(s.seat_availability)
  71.             for element in s._manifest:
  72.                 small_limited += str(element)
  73.  
  74.     for t in trips_big:
  75.         big_limited += t.get_reservation_id() + str(t.trip_departure) + f'{t.get_in_flight_time()}{t.get_in_flight_time()}{round(t.get_total_trip_time())}'
  76.         for s in t.get_flight_segments():
  77.             big_limited += str(s.seat_availability)
  78.             for element in s._manifest:
  79.                 big_limited += str(element)
  80.  
  81.     return small_limited, big_limited
  82.  
  83.  
  84. if __name__ == "__main__":
  85.     small, big = deep_fingerprint_trip_id()
  86.     small_limited, big_limited = deep_fingerprint_trip_id_limited()
  87.     print("Small MD5 Fingerprint : " + hashlib.md5(
  88.         (small).encode('utf-8')).hexdigest())
  89.     print("big MD5 Fingerprint : " + hashlib.md5(
  90.         (big).encode('utf-8')).hexdigest())
  91.     print("Small_limited MD5 Fingerprint : " + hashlib.md5(
  92.         (small_limited).encode('utf-8')).hexdigest())
  93.     print("big_limited MD5 Fingerprint : " + hashlib.md5(
  94.         (big_limited).encode('utf-8')).hexdigest())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top