示例#1
0
def get_hosts(directory):
  hosts=[]
  for host_file in os.listdir(directory):
    hosts.append(load_json(directory+host_file))
  for host in hosts:
    hos_login=host['login']
    hos_password=host['password']
    host['credentials']={'login':hos_login,'password':hos_password}
    del(host['login'])
    del(host['password'])
  return hosts
示例#2
0
def get_hosts(directory):
    hosts = []
    for host_file in os.listdir(directory):
        hosts.append(load_json(directory + host_file))
    for host in hosts:
        hos_login = host['login']
        hos_password = host['password']
        host['credentials'] = {'login': hos_login, 'password': hos_password}
        del (host['login'])
        del (host['password'])
    return hosts
示例#3
0
def get_tests(directory):
  tests=[]
  for test_file in os.listdir(directory):
    tests.append(load_json(directory+test_file))
  for test in tests:
    tes_type=test['type']
    tes_name=test['test_name']
    tes_params=ast.literal_eval(re.sub('\r\n','',test['test_params']))
    tes_params=ast.literal_eval(re.sub('#','',test['test_params']))
    test[tes_type]={tes_name:tes_params}
    del(test['test_name'])
    del(test['test_params'])
  return tests
示例#4
0
def get_tests(directory):
    tests = []
    for test_file in os.listdir(directory):
        tests.append(load_json(directory + test_file))
    for test in tests:
        tes_type = test['type']
        tes_name = test['test_name']
        tes_params = ast.literal_eval(re.sub('\r\n', '', test['test_params']))
        tes_params = ast.literal_eval(re.sub('#', '', test['test_params']))
        test[tes_type] = {tes_name: tes_params}
        del (test['test_name'])
        del (test['test_params'])
    return tests
示例#5
0
def main():
    d_dir = args.data_dir

    dialog_data_file = '{}/data.json'.format(d_dir)
    dialog_data = load_json(dialog_data_file)
    dialog_id_list = list(set(dialog_data.keys())) # Bug: v1.0 contains duplicate id in the valid data
    print('# of dialogs:', len(dialog_data))
    # print(dialog_data['PMUL4641.json']) # print a sample dialog

    valid_list_file = '{}/valListFile.json'.format(d_dir)
    test_list_file  = '{}/testListFile.json'.format(d_dir)

    valid_id_list = list(set(load_list_file(valid_list_file))) # Bug: v1.0 contains duplicate id in the valid data
    test_id_list = load_list_file(test_list_file)
    train_id_list = [did for did in dialog_id_list if did not in (valid_id_list + test_id_list)]
    print('# of train dialogs:', len(train_id_list))
    print('# of valid dialogs:', len(valid_id_list))
    print('# of test dialogs :', len(test_id_list))
    assert(len(dialog_id_list) == len(train_id_list) + len(valid_id_list) + len(test_id_list))

    train_data = [v for k, v in dialog_data.items() if k in train_id_list]
    valid_data = [v for k, v in dialog_data.items() if k in valid_id_list]
    test_data = [v for k, v in dialog_data.items() if k in test_id_list]
    assert(len(train_data) == len(train_id_list))
    assert(len(valid_data) == len(valid_id_list))
    assert(len(test_data) == len(test_id_list))

    # print some dialogs with Dialog States
    for d in train_data[:3]:
        print('-' * 50)
        analyze_dialog(d, True)

    hotel_db_list      = load_json('{}/hotel_db.json'.format(d_dir))
    train_db_list      = load_json('{}/train_db.json'.format(d_dir))
    attractin_db_list  = load_json('{}/attraction_db.json'.format(d_dir))
    restaurant_db_list = load_json('{}/restaurant_db.json'.format(d_dir))
示例#6
0

def get_hosts(directory):
  hosts=[]
  for host_file in os.listdir(directory):
    hosts.append(load_json(directory+host_file))
  for host in hosts:
    hos_login=host['login']
    hos_password=host['password']
    host['credentials']={'login':hos_login,'password':hos_password}
    del(host['login'])
    del(host['password'])
  return hosts

if __name__=='__main__':
  tests=load_json("tests.json")
  hosts=load_json("hosts.json")
else:
  tests=get_tests("tests/")
  hosts=get_hosts("hosts/")


result={}
  
for test in tests:
  result[test['id']]=True

def test_results(hosts,tests):
  hostnames=[x["hostname"] for x in hosts]
  
  result={}
示例#7
0
def get_hosts(directory):
    hosts = []
    for host_file in os.listdir(directory):
        hosts.append(load_json(directory + host_file))
    for host in hosts:
        hos_login = host['login']
        hos_password = host['password']
        host['credentials'] = {'login': hos_login, 'password': hos_password}
        del (host['login'])
        del (host['password'])
    return hosts


if __name__ == '__main__':
    tests = load_json("tests.json")
    hosts = load_json("hosts.json")
else:
    tests = get_tests("tests/")
    hosts = get_hosts("hosts/")

result = {}

for test in tests:
    result[test['id']] = True


def test_results(hosts, tests):
    hostnames = [x["hostname"] for x in hosts]

    result = {}