# Path: airdialogue/context_generator/src/customer.py
# class Customer(object):
#   def __init__(self, facts_obj, book_window, airport_list):
#   def get_departure_and_return_date(self):
#   def get_json(self):
#   def get_customer_condition(self):
# 
# Path: airdialogue/context_generator/src/facts.py
# class Facts(object):
#   def __init__(self, firstname_file, lastname_file, airportcode_file):
#   def _get_airline_list(self):
#   def _read_file(self, filename):
#   def _get_airport_and_full_name(self, airport_list_raw):
# 
# Path: airdialogue/context_generator/src/kb.py
# class AirFare(object):
# class Knowledgebase(object):
#   def __init__(self, fact_obj, airport_list, flight_number, ref_departure_date,
#                ref_return_date):
#   def get_json(self):
#   def __init__(self, fact_obj, num_flights, airport_list, departure_date,
#                return_date):
#   def get_json(self):
# 
# Path: airdialogue/context_generator/src/utils.py
# def continue_booking(facts, ag_cond, kb, goal_str):
# def airflight_selector(facts, condition, airfare_database):
# def generate_expected_action(facts, agent_condition, airfare_database,
#                              reservation):
# def check_states(user_action, expected_action):
# def get_day_segment_by_hour(hour):
# def check_condition(facts, flight, condition, get_full_diff=False):
# def generate_action(flights, name, status):
# def standardize_intent(org_intent):
# def standardize_action(org_action):
# def get_unix_epoch(dt):
# def get_datetime(unix_epoch):
# def get_month_and_day(fact_obj, unix_epoch):
# def get_hour(unix_epoch):
# def discrete_price(original_price):
# def format_time(hour):
# def get_connection(con):
# def discrete_sample_(probabilities):
# def choice(values, cnt=-1, p=None):


import copy
import json
import random
import numpy as np
from tensorflow.compat.v1 import gfile
from airdialogue.context_generator.src import customer
from airdialogue.context_generator.src import facts
from airdialogue.context_generator.src import kb as knowledgebase
from airdialogue.context_generator.src import utils
                       output_object=False,
                       verbose=False):
    """generate context. if output_file is not none then we write to file."""
    if output_data and output_kb:
      fp_data = gfile.Open(output_data, "w")
      fp_kb = gfile.Open(output_kb, "w")
    else:
      fp_data = None
      fp_kb = None
    all_context = []
    status_stats = {}
    for n in range(num_context):
      airport_candidate = list(
          np.random.choice(
              self.fact_obj.airport_list,
              self.num_candidate_airports,
              replace=False))
      if display_freq:
        if verbose and n % display_freq == 0:
          print((n, "/", num_context))
      cus = customer.Customer(self.fact_obj, self.book_window,
                              airport_candidate)
      ref_departure_date, ref_return_date = cus.departure_date, cus.return_date
      kb = knowledgebase.Knowledgebase(self.fact_obj, self.num_db_record,
                                       airport_candidate, ref_departure_date,
                                       ref_return_date)
      intent_json = utils.standardize_intent(cus.get_json())
      kb_and_res_json = kb.get_json()
      kb_json = kb_and_res_json["kb"]
      res_json = kb_and_res_json["reservation"]

# Path: airdialogue/context_generator/src/customer.py
# class Customer(object):
#   def __init__(self, facts_obj, book_window, airport_list):
#   def get_departure_and_return_date(self):
#   def get_json(self):
#   def get_customer_condition(self):
# 
# Path: airdialogue/context_generator/src/facts.py
# class Facts(object):
#   def __init__(self, firstname_file, lastname_file, airportcode_file):
#   def _get_airline_list(self):
#   def _read_file(self, filename):
#   def _get_airport_and_full_name(self, airport_list_raw):
# 
# Path: airdialogue/context_generator/src/kb.py
# class AirFare(object):
# class Knowledgebase(object):
#   def __init__(self, fact_obj, airport_list, flight_number, ref_departure_date,
#                ref_return_date):
#   def get_json(self):
#   def __init__(self, fact_obj, num_flights, airport_list, departure_date,
#                return_date):
#   def get_json(self):
# 
# Path: airdialogue/context_generator/src/utils.py
# def continue_booking(facts, ag_cond, kb, goal_str):
# def airflight_selector(facts, condition, airfare_database):
# def generate_expected_action(facts, agent_condition, airfare_database,
#                              reservation):
# def check_states(user_action, expected_action):
# def get_day_segment_by_hour(hour):
# def check_condition(facts, flight, condition, get_full_diff=False):
# def generate_action(flights, name, status):
# def standardize_intent(org_intent):
# def standardize_action(org_action):
# def get_unix_epoch(dt):
# def get_datetime(unix_epoch):
# def get_month_and_day(fact_obj, unix_epoch):
# def get_hour(unix_epoch):
# def discrete_price(original_price):
# def format_time(hour):
# def get_connection(con):
# def discrete_sample_(probabilities):
# def choice(values, cnt=-1, p=None):


# Path: airdialogue/context_generator/context_generator_lib.py
import copy
import json
import random
import numpy as np
from tensorflow.compat.v1 import gfile
from airdialogue.context_generator.src import customer
from airdialogue.context_generator.src import facts
from airdialogue.context_generator.src import kb as knowledgebase
from airdialogue.context_generator.src import utils

                       output_object=False,
                       verbose=False):
    """generate context. if output_file is not none then we write to file."""
    if output_data and output_kb:
      fp_data = gfile.Open(output_data, "w")
      fp_kb = gfile.Open(output_kb, "w")
    else:
      fp_data = None
      fp_kb = None
    all_context = []
    status_stats = {}
    for n in range(num_context):
      airport_candidate = list(
          np.random.choice(
              self.fact_obj.airport_list,
              self.num_candidate_airports,
              replace=False))
      if display_freq:
        if verbose and n % display_freq == 0:
          print((n, "/", num_context))
      cus = customer.Customer(self.fact_obj, self.book_window,
                              airport_candidate)
      ref_departure_date, ref_return_date = cus.departure_date, cus.return_date
      kb = knowledgebase.Knowledgebase(self.fact_obj, self.num_db_record,
                                       airport_candidate, ref_departure_date,
                                       ref_return_date)
      intent_json = utils.standardize_intent(cus.get_json())
      kb_and_res_json = kb.get_json()
      kb_json = kb_and_res_json["kb"]
      res_json = kb_and_res_json["reservation"]

      expected_action = utils.generate_expected_action(