<commit_before>import json


class PyslateJsonBackend(object):

    def __init__(self, file_name):
        with open(file_name, "r") as file:
            self.tags = json.loads(file.read())

    def get_content(self, tag_names, languages):
        return self.get_translation_record(tag_names, languages)[0]

    def get_form(self, tag_names, languages):
        return self.get_translation_record(tag_names, languages)[1]

    def get_translation_record(self, tag_names, languages):
        for language in languages:
            for tag_name in tag_names:
                if language in self.tags.get(tag_name, {}):
                    translation = self.tags.TAGS[tag_name][language]
                    if type(translation) is list:
                        return translation[0], translation[1]
                    return translation, None
<commit_msg>add 't' format to open()<commit_after>import json


class PyslateJsonBackend(object):

    def __init__(self, file_name):
        with open(file_name, "rt") as file:
            self.tags = json.loads(file.read())

    def get_content(self, tag_names, languages):
        return self.get_translation_record(tag_names, languages)[0]

    def get_form(self, tag_names, languages):
        return self.get_translation_record(tag_names, languages)[1]

    def get_translation_record(self, tag_names, languages):
        for language in languages:
            for tag_name in tag_names:
                if language in self.tags.get(tag_name, {}):
                    translation = self.tags.TAGS[tag_name][language]
                    if type(translation) is list:
                        return translation[0], translation[1]
                    return translation, None

{'fraction_non_alphanumeric': 0.09164733178654293, 'fraction_numerical': 0.004640371229698376, 'mean_word_length': 2.4708249496981893, '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': '722301', 'n_tokens_mistral': 482, 'n_tokens_neox': 465, 'n_words': 116}