<commit_before>import configparser
import os

from up.utils.singleton import Singleton


class ConfigReader(metaclass=Singleton):
    CONFIG_DIR = os.path.join(os.getcwd(), 'config')
    MODULES_CONFIG_PATH = os.path.join(CONFIG_DIR, 'modules.cfg')
    GLOBAL_CONFIG_PATH = os.path.join(CONFIG_DIR, 'config.cfg')

    def __init__(self):
        current_path = os.path.dirname(__file__)

        self.__modules_config_path = os.path.abspath(os.path.join(current_path, self.MODULES_CONFIG_PATH))
        self.__modules_config = configparser.ConfigParser(allow_no_value=True)
        self.__modules_config.read(self.__modules_config_path)

        self.__global_config_path = os.path.abspath(os.path.join(current_path, self.GLOBAL_CONFIG_PATH))
        self.__global_config = configparser.ConfigParser(allow_no_value=True)
        self.__global_config.read(self.__global_config_path)

    def module_enabled(self, module):
        module_name = module.__class__.__name__
        if module_name in self.__modules_config['DISABLED MODULES']:
            return False
        return True

    @property
    def global_config(self):
        return self.__global_config

    @property
    def global_config_path(self):
        return self.__global_config_path

    @staticmethod
    def instance():
        return ConfigReader()<commit_msg>Renamed disabled Modules config<commit_after>import configparser
import os

import yaml

from up.utils.singleton import Singleton


class ConfigReader(metaclass=Singleton):
    CONFIG_DIR = os.path.join(os.getcwd(), 'config')
    MODULES_CONFIG_PATH = os.path.join(CONFIG_DIR, 'modules.yml')
    GLOBAL_CONFIG_PATH = os.path.join(CONFIG_DIR, 'config.cfg')

    def __init__(self):
        current_path = os.path.dirname(__file__)

        self.__modules_config_path = os.path.abspath(os.path.join(current_path, self.MODULES_CONFIG_PATH))
        self.__modules_config = None
        if os.path.isfile(self.__modules_config_path):
            with open(self.__modules_config_path) as f:
                self.__modules_config = yaml.load(f)

        self.__global_config_path = os.path.abspath(os.path.join(current_path, self.GLOBAL_CONFIG_PATH))
        self.__global_config = configparser.ConfigParser(allow_no_value=True)
        self.__global_config.read(self.__global_config_path)

    def module_enabled(self, module):
        module_name = module.__class__.__name__
        if self.__modules_config and self.__modules_config.get('disabled modules') is not None:
            if module_name in self.__modules_config['disabled modules']:
                return False
        return True

    @property
    def global_config(self):
        return self.__global_config

    @property
    def global_config_path(self):
        return self.__global_config_path

    @staticmethod
    def instance():
        return ConfigReader()
{'fraction_non_alphanumeric': 0.08951048951048951, 'fraction_numerical': 0.0, 'mean_word_length': 3.498427672955975, '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': '2101749', 'n_tokens_mistral': 863, 'n_tokens_neox': 848, 'n_words': 147}