<commit_before>import imp

ID = "reload"
permission = 3


def execute(self, name, params, channel, userdata, rank):
    if len(params) > 0 and params[0] in self.commands:
        cmd = params[0]
        path = self.commands[cmd][1]
        print path
        
        self.sendChatMessage(self.send, channel, "Reloading "+path)
        self.commands[cmd] = (imp.load_source(cmd, path), path)
        
        try:
            if not callable(self.commands[cmd][0].__initialize__):
               self.commands[cmd][0].__initialize__ = False
        except AttributeError:
            self.commands[cmd][0].__initialize__ = False
        else:
            if self.commands[cmd][0].__initialize__ != False:
                self.commands[cmd][0].__initialize__(self, False)
        self.sendChatMessage(self.send, channel, "Done!")
    
    elif len(params) > 0 and params[0] not in self.commands:
        self.sendChatMessage(self.send, channel, "Command does not exist")
    else:
        self.sendChatMessage(self.send, channel, "Reloading..")
        self.commands = self.__LoadModules__("commands")
        for cmd in self.commands:
            if self.commands[cmd][0].__initialize__ != False:
                self.commands[cmd][0].__initialize__(self, False)
        self.sendChatMessage(self.send, channel, "Done!")

def __initialize__(self, Startup):
    entry = self.helper.newHelp(ID)
    
    entry.addDescription("The 'reload' command allows you to reload all commands at once, or one specific command at a time.")
    entry.addArgument("command name", "The name of the command you want to reload", optional = True)
    entry.rank = permission
    
    self.helper.registerHelp(entry, overwrite = True)<commit_msg>Removed ability to reload ALL commands<commit_after>import imp

ID = "reload"
permission = 3


def execute(self, name, params, channel, userdata, rank):
    if len(params) > 0 and params[0] in self.commands:
        cmd = params[0]
        path = self.commands[cmd][1]
        print path
        
        self.sendChatMessage(self.send, channel, "Reloading "+path)
        self.commands[cmd] = (imp.load_source(cmd, path), path)
        
        try:
            if not callable(self.commands[cmd][0].__initialize__):
                self.commands[cmd][0].__initialize__ = False
        except AttributeError:
            self.commands[cmd][0].__initialize__ = False
        else:
            if self.commands[cmd][0].__initialize__ != False:
                self.commands[cmd][0].__initialize__(self, False)
        self.sendChatMessage(self.send, channel, "Done!")
    
    elif len(params) > 0 and params[0] not in self.commands:
        self.sendChatMessage(self.send, channel, "Command does not exist")
    else:
        self.sendMessage(channel, "Please specify a command.")

def __initialize__(self, Startup):
    entry = self.helper.newHelp(ID)
    
    entry.addDescription("The 'reload' command allows you to reload specific commands. All changes made to the file will take effect.")
    entry.addArgument("command name", "The name of the command you want to reload", optional = True)
    entry.rank = permission
    
    self.helper.registerHelp(entry, overwrite = True)
{'fraction_non_alphanumeric': 0.11388455538221529, 'fraction_numerical': 0.008112324492979718, 'mean_word_length': 2.7762073027090697, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5792076', 'n_tokens_mistral': 924, 'n_tokens_neox': 904, 'n_words': 244}