<commit_before>import yaml
import os
import shutil

def read_yaml_file(filename, default=None, ignoreNonExistantFile=False, fixCorruption=False):
    if filename[-5:] == ".yaml" or filename[-4:] == ".yml":
        if ignoreNonExistantFile:
            try:
                file = open(filename)
                result = yaml.safe_load(fixCorruptedYaml(file.read(), fixCorruption))
                file.close()
            except IOError:
                return default
        else:
            file = open(filename)
            result = yaml.safe_load(fixCorruptedYaml(file.read(), fixCorruption))
            file.close()
        return result
    else:
        raise ValueError('Filename must have .yaml ending')

def fixCorruptedYaml(content, fixCorruption=False):
    if not fixCorruption:
        return content
    else:
        lines = content.splitlines()
        indent = 0
        opensNewBlock = False<commit_msg>Added documentation<commit_after>import yaml
import os
import shutil

def read_yaml_file(filename, default=None, ignoreNonExistantFile=False, fixCorruption=False):
    if filename[-5:] == ".yaml" or filename[-4:] == ".yml":
        if ignoreNonExistantFile:
            try:
                file = open(filename)
                result = yaml.safe_load(fixCorruptedYaml(file.read(), fixCorruption))
                file.close()
            except IOError:
                return default
        else:
            file = open(filename)
            result = yaml.safe_load(fixCorruptedYaml(file.read(), fixCorruption))
            file.close()
        return result
    else:
        raise ValueError('Filename must have .yaml ending')

def fixCorruptedYaml(content, fixCorruption=False):
    """Fixes indentation errors"""
    if not fixCorruption:
        return content
    else:
        lines = content.splitlines()
        indent = 0
        opensNewBlock = False
{'fraction_non_alphanumeric': 0.09413008989952407, 'fraction_numerical': 0.0031729243786356425, 'mean_word_length': 2.2452830188679247, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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': '6769365', 'n_tokens_mistral': 519, 'n_tokens_neox': 504, 'n_words': 125}