<commit_before>import os, yaml

class Config(object):
    filePath = None

    def __init__(self, filePath):
        self.filePath = filePath
        self.settings = {}

    def loadConfig(self, globalConfig):
        if globalConfig:
            self.settings = globalConfig

        if not os.path.exists(os.path.join("config", self.filePath)):
            self.createDefaultConfig(os.path.join("config", self.filePath))
        else:
            with open(os.path.join("config", self.filePath), 'r') as configFile:
                configData = yaml.load(configFile)

            if configData:
                for key in configData:
                    self.settings[key] = configData[key]

    def createDefaultConfig(self, filePath):
        self.settings["nickname"] = "PyHeufyBot"
        self.settings["username"] = "PyHeufyBot"
        self.settings["realname"] = "PyHeufyBot"
        self.settings["server"] = "irc.example.com"
        self.settings["port"] = 6667
        self.settings["channels"] = []

        with open(filePath, 'w') as configFile:
            configData = yaml.dump(self.settings, configFile)
    
    def getSettingWithDefault(self, setting, defaultValue):
        if setting in self.settings:
            return settings[setting]
        else:
            return defaultValue<commit_msg>We don't really need to create a default config since we ship one<commit_after>import os, yaml

class Config(object):
    filePath = None

    def __init__(self, filePath):
        self.filePath = filePath
        self.settings = {}

    def loadConfig(self, globalConfig):
        if globalConfig:
            self.settings = globalConfig

        if not os.path.exists(os.path.join("config", self.filePath)):
            print "ERROR: \"{0}\" was found. Make sure to create it or copy \"{0}.example\" to \"{0}\".".format(self.filePath)
            return False
        else:
            with open(os.path.join("config", self.filePath), 'r') as configFile:
                configData = yaml.load(configFile)

            if configData:
                for key in configData:
                    self.settings[key] = configData[key]
            return True
            
    def getSettingWithDefault(self, setting, defaultValue):
        if setting in self.settings:
            return settings[setting]
        else:
            return defaultValue
{'fraction_non_alphanumeric': 0.10717299578059072, 'fraction_numerical': 0.002953586497890295, 'mean_word_length': 2.1403973509933776, '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': '3669249', 'n_tokens_mistral': 663, 'n_tokens_neox': 635, 'n_words': 162}