<commit_before>import yaml

from .loader import Loader, I18nFileLoadError

class YamlLoader(Loader):
    """class to load yaml files"""
    def __init__(self):
        super(YamlLoader, self).__init__()

    def parse_file(self, file_content):
        try:
            return yaml.load(file_content, Loader=yaml.FullLoader)
        except yaml.scanner.ScannerError as e:
            raise I18nFileLoadError("invalid YAML: {0}".format(str(e)))<commit_msg>Restore compatibility with older versions of pyyaml<commit_after>import yaml

from .loader import Loader, I18nFileLoadError

class YamlLoader(Loader):
    """class to load yaml files"""
    def __init__(self):
        super(YamlLoader, self).__init__()

    def parse_file(self, file_content):
        try:
            if hasattr(yaml, "FullLoader"):
                return yaml.load(file_content, Loader=yaml.FullLoader)
            else:
                return yaml.load(file_content)
        except yaml.scanner.ScannerError as e:
            raise I18nFileLoadError("invalid YAML: {0}".format(str(e)))
{'fraction_non_alphanumeric': 0.10198300283286119, 'fraction_numerical': 0.009442870632672332, 'mean_word_length': 3.045801526717557, 'pattern_counts': {'":': 0, '<': 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': '2855511', 'n_tokens_mistral': 333, 'n_tokens_neox': 314, 'n_words': 77}