def create_packages_list(file): packages = HashTable() locations = create_locations_table('./files/locations.csv') hub = 0 graph = create_location_graph() with open(file, newline='', encoding='utf-8-sig') as packages_file: reader = csv.reader(packages_file) for row in reader: p_id = int(row[0].strip()) street = row[1].strip() weight = row[6].strip() deadline = row[5].strip() if deadline == 'EOD': deadline = '' else: dl = deadline.split(' ') deadline = dl[0] + ':00' address = locations[street] p = Package(p_id, address, deadline, weight) addr_idx = locations[street].graph_index shortest_path_to_hub = graph.shortest_paths(addr_idx)[0] p.distance_from_hub = shortest_path_to_hub packages.insert(p_id, p) return packages