<commit_before>import json
from web.MetaStructure import MetaStructure


class MetaInfo:
    def __init__(self):
        """
        Initializes MetaInfo object with meta language information
        :rtype: None
        """
        with open("web/thesauruses/meta_info.json", 'r') as meta_file:
            meta_data = meta_file.read()
        self.data_structures = json.loads(meta_data)["structures"]

    def structure_friendly_name(self, structure_key):
        """
        Given a structure key (from meta_info.json), returns the structure's human-friendly name
        :param structure_key: ID of the structure located in the meta_info.json file
        :return: string with the human-friendly name
        """
        index = list(self.data_structures.values()).index(structure_key)
        return list(self.data_structures.keys())[index]

    def structure(self, structure_key):
        """
        Given a structure key (from meta_info.json), returns the whole MetaStructure for it
        :param structure_key: ID of the structure located in the meta_info.json file
        :return:
        """
        return MetaStructure(structure_key, self.structure_friendly_name(structure_key))<commit_msg>Fix pylint errors in models.py<commit_after>import json
from web.MetaStructure import MetaStructure


class MetaInfo:
    """Holds info about structures and languages"""
    def __init__(self):
        """
        Initializes MetaInfo object with meta language information

        :rtype: None
        """
        with open("web/thesauruses/meta_info.json", 'r') as meta_file:
            meta_data = meta_file.read()
        self.data_structures = json.loads(meta_data)["structures"]

    def structure_friendly_name(self, structure_key):
        """
        Given a structure key (from meta_info.json), returns the structure's
        human-friendly name

        :param structure_key: ID of the structure located in the meta_info.json file
        :return: string with the human-friendly name
        :rtype: String
        """
        index = list(self.data_structures.values()).index(structure_key)
        return list(self.data_structures.keys())[index]

    def structure(self, structure_key):
        """
        Given a structure key (from meta_info.json), returns the whole
        MetaStructure for it

        :param structure_key: ID of the structure located in the meta_info.json file
        :return: MetaStructure for the requested key
        :rtype: MetaStructure
        """
        return MetaStructure(structure_key, self.structure_friendly_name(structure_key))
{'fraction_non_alphanumeric': 0.08536114329857088, 'fraction_numerical': 0.0, 'mean_word_length': 2.9242424242424243, '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': '3459590', 'n_tokens_mistral': 688, 'n_tokens_neox': 669, 'n_words': 204}