<commit_before>import yaml, json

def verify(input_dict, reference_dict):
    ans = []
    for k in reference_dict:
        input_dict, temp_ans = verify_helper(k, input_dict[k], reference_dict[k])
        ans += temp_ans
    return input_dict, len(ans) == 0, ans
    
def verify_helper(name, input_element, reference_dict):
    """
    Returns: modified_input,list_of_errors

    where list of errors is: [{name: name, message: ..., 
    """
    ans = []
    if reference_dict['type'] == 'dict':
        l1,l2 = compare_dict_keys(input_element, reference_dict['values'])
        if len(l1) > 0:
            ans += [{"name":name, "message":"extra keys in input: " + ",".join(l1)}]
        else:
            ok = True
            for k in l2:
                if 'default' in reference_dict['values'][k]:
                    input_element[k] = reference_dict['values'][k]['default']
                elif not 'required' in reference_dict['values'][k] or reference_dict['values'][k]['required'] == False:
                    ans += [{"name":name+'/'+k, "message":"required key is absent"}]
                    ok = False
            if(ok):
                for k in input_element:
                    input_element[k],temp_ans = verify_helper(name + '/' + k, input_element[k],reference_dict['values'][str(k)])
                    ans += temp_ans
                
    elif reference_dict['type'] == 'list':
        for i in range(len(input_element)):
            input_element[i],temp_ans = verify_helper(name+'/'+str(i), input_element[i], reference_dict['values'])
            ans += temp_ans
                
    elif reference_dict['type'] == 'num':<commit_msg>verifier documentation<commit_after>import yaml, json

def verify(input_dict, reference_dict):
    """
    Returns: modified_input, success, list_of_errors

    where: 
    - modified_input is the input populated with default values where applicable
    - success is a boolean true if there were no problems and false otherwise
    - list_of_errors is as in verify_helper
    """
    ans = []
    for k in reference_dict:
        input_dict, temp_ans = verify_helper(k, input_dict[k], reference_dict[k])
        ans += temp_ans

    # Any further custom verification goes below this line, which may
    # modify input_dict as needed and add any errors to ans as dicts
    # with the format: {"name":problem_key, "message":"what is wrong"}
    
    return input_dict, len(ans) == 0, ans
    
def verify_helper(name, input_element, reference_dict):
    """
    Returns: modified_input,list_of_errors

    where list of errors is: [{name: name, message: ...}, ...]
    """
    ans = []
    if reference_dict['type'] == 'dict':
        l1,l2 = compare_dict_keys(input_element, reference_dict['values'])
        if len(l1) > 0:
            ans += [{"name":name, "message":"extra keys in input: " + ",".join(l1)}]
        else:
            ok = True
            for k in l2:
                if 'default' in reference_dict['values'][k]:
                    input_element[k] = reference_dict['values'][k]['default']
                elif not 'required' in reference_dict['values'][k] or reference_dict['values'][k]['required'] == False:
                    ans += [{"name":name+'/'+k, "message":"required key is absent"}]
                    ok = False
            if(ok):
                for k in input_element:
                    input_element[k],temp_ans = verify_helper(name + '/' + k, input_element[k],reference_dict['values'][str(k)])
                    ans += temp_ans
                
    elif reference_dict['type'] == 'list':
        for i in range(len(input_element)):
            input_element[i],temp_ans = verify_helper(name+'/'+str(i), input_element[i], reference_dict['values'])
            ans += temp_ans
                
    elif reference_dict['type'] == 'num':
{'fraction_non_alphanumeric': 0.13566397078006784, 'fraction_numerical': 0.003652491521001826, 'mean_word_length': 2.4049733570159857, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6679716', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1100, 'n_words': 282}