<commit_before># -*- coding: utf-8 -*-
from base import *

modname = "Core"


def start():
    return [
        "mreload",
        "module",
        "join",
        "part",
        ]


def msg(mp, ct):
    if mp.acmd("mreload"):
        reload(c_modules)
        reload(c_wlist)
        import evazbot.irc as irc
        reload(irc)
        reload(cmd)
        c_modules.reloadall()
        return True

    if ct.cmd('m', 0, 99):
        if ct.args.getbool('add'):
            module = ct.args.getdef()
            if c_modules.astart(module):
                print((module + " is now active."))
            ct.msg('Added %s' % module)
        elif ct.args.getbool('remove'):
            module = ct.args.getdef()
            if c_modules.remove(module):
                print(("Removed " + module + " from active."))
            ct.msg('Removed %s' % module)
        elif ct.args.getbool('dadd'):
            module = ct.args.getdef()
            if c_modules.astart(module):
                print((module + " is now active."))
            dmodules = []
            with open(c_modules.dbfile, 'r') as f:
                for line in f.readlines():
                    if len(line.strip()) > 0:
                        dmodules.append(line.strip())
            if module not in dmodules:
                dmodules.append(module)
            dmodules2 = []
            for i in dmodules:
                dmodules2.append(i + '\n')
            with open(c_modules.dbfile, 'w') as f:
                f.writelines(dmodules2)
            ct.msg(('Added ' + module + ' to default list.'))
        elif ct.args.getbool('dremove'):
            module = ct.args.getdef()
            if c_modules.remove(module):
                print(("Removed " + module + " from active."))
            dmodules = []
            with open(c_modules.dbfile, 'r') as f:
                for line in f.readlines():
                    if len(line.strip()) > 0:
                        dmodules.append(line.strip())
            dmodules = list(filter((module).__ne__, dmodules))
            dmodules2 = []
            for i in dmodules:
                dmodules2.append(i + '\n')
            with open(c_modules.dbfile, 'w') as f:
                f.writelines(dmodules2)
            ct.msg(('Removed ' + module + ' from default list.'))
        else:
            ct.msg('Invalid arguments')
    if mp.acmd("join", 99):
        channel = mp.argsdef()
        main.ircprofiles[main.currentprofile]['channels'].append(channel)
        main.joinchan(channel)
        main.sendcmsg('Attempted to join channel ' + channel)<commit_msg>core formatting<commit_after># -*- coding: utf-8 -*-
from base import *

modname = "Core"


def start():
    return [
        "mreload",
        "module",
        "join",
        "part",
        ]


def msg(mp, ct):
    if mp.acmd("mreload"):
        reload(c_modules)
        reload(c_wlist)
        import evazbot.irc as irc
        reload(irc)
        reload(cmd)
        c_modules.reloadall()
        return True

    if ct.cmd('m', 0, 99):
        if ct.args.getbool('add'):
            module = ct.args.getdef().strip()
            if c_modules.astart(module):
                print((module + " is now active."))
            ct.msg('Added %s' % module)
        elif ct.args.getbool('remove'):
            module = ct.args.getdef().strip()
            if c_modules.remove(module):
                print(("Removed " + module + " from active."))
            ct.msg('Removed %s' % module)
        elif ct.args.getbool('dadd'):
            module = ct.args.getdef().strip()
            if c_modules.astart(module):
                print((module + " is now active."))
            dmodules = []
            with open(c_modules.dbfile, 'r') as f:
                for line in f.readlines():
                    if len(line.strip()) > 0:
                        dmodules.append(line.strip())
            if module not in dmodules:
                dmodules.append(module)
            dmodules2 = []
            for i in dmodules:
                dmodules2.append(i + '\n')
            with open(c_modules.dbfile, 'w') as f:
                f.writelines(dmodules2)
            ct.msg(('Added ' + module + ' to default list.'))
        elif ct.args.getbool('dremove'):
            module = ct.args.getdef().strip()
            if c_modules.remove(module):
                print(("Removed " + module + " from active."))
            dmodules = []
            with open(c_modules.dbfile, 'r') as f:
                for line in f.readlines():
                    if len(line.strip()) > 0:
                        dmodules.append(line.strip())
            dmodules = list(filter((module).__ne__, dmodules))
            dmodules2 = []
            for i in dmodules:
                dmodules2.append(i + '\n')
            with open(c_modules.dbfile, 'w') as f:
                f.writelines(dmodules2)
            ct.msg(('Removed ' + module + ' from default list.'))
        else:
            ct.msg('Invalid arguments')
    if mp.acmd("join", 99):
        channel = mp.argsdef()
        main.ircprofiles[main.currentprofile]['channels'].append(channel)
        main.joinchan(channel)
        main.sendcmsg('Attempted to join channel ' + channel)
{'fraction_non_alphanumeric': 0.13575525812619502, 'fraction_numerical': 0.005353728489483747, 'mean_word_length': 1.5149038461538462, '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': '3803292', 'n_tokens_mistral': 1607, 'n_tokens_neox': 1510, 'n_words': 338}