<commit_before>import sys

from wurstminebot import commands
from wurstminebot import core
import json
from wurstminebot import loops
import minecraft
from wurstminebot import nicksub
import random
import re
import traceback


def endMOTD(sender, headers, message):
    irc_config = core.config('irc')
    chans = set(irc_config.get('channels', []))
    if 'main_channel' in irc_config:
        chans.add(irc_config['main_channel'])
    if 'dev_channel' in irc_config:
        chans.add(irc_config['dev_channel'])
    if 'live_channel' in irc_config:
        chans.add(irc_config['live_channel'])
    for chan in chans:
        try:
            core.state['bot'].joinchan(chan)
        except:
            core.debug_print(
                'Exception while joining channel ' + str(chan) + ':')
            if core.config('debug', False) or core.state.get('is_daemon', False):
                traceback.print_exc(file=sys.stdout)
    if irc_config.get('main_channel') is not None:
        core.state['bot'].say(irc_config['main_channel'], "aaand I'm back.")
    minecraft.tellraw({
        'text': "aaand I'm back.",
        'color': 'gold'
    })
    core.debug_print("aaand I'm back.")
    core.update_all()
    if core.state.get('input_loop') is None:
        core.state['input_loop'] = loops.InputLoop()
        core.state['input_loop'].start()
    if core.state.get('twitter_stream') is None and core.twitter is not None:
        core.state['twitter_stream'] = loops.TwitterStream(core.twitter)
        core.state['twitter_stream'].start()


def error_not_chan_op(sender, headers, message):
    irc_config = core.config('irc')
    if 'nickserv_password' in irc_config:
        core.state['bot'].say(
            'NickServ', 'IDENTIFY ' + irc_config['nickserv_password'])
    elif 'main_channel' in irc_config:
        core.state['bot'].say(irc_config['main_channel'], random.choice([
            'To change the topic, I need to be a channel operator.',
            'op me pls',
            'i can has op?'
        ]))


def format_text(message):
    def colorname(number):
        if number == 0:
            return "white"
        elif number == 1:
            return "black"
        elif number == 2:
            return "dark_blue"
        elif number == 3:
            return "dark_green"
        elif number == 4:
            return "red"
        elif number == 5:  # actually brown but it's ok
            return "dark_red"
        elif number == 6:
            return "dark_purple"
        elif number == 7:  # actually orange but looks similar
            return "gold"
        elif number == 8:
            return "yellow"
        elif number == 9:
            return "green"
        elif number == 10:
            return "dark_aqua"
        elif number == 11:
            return "aqua"
        elif number == 12:
            return "blue"
        elif number == 13:
            return "light_purple"
        elif number == 14:
            return "gray"
        elif number == 15:
            return "dark_gray"
        else:
            return "aqua"

    messages = []
    curmsg = ""
    fgcolor = 'aqua'
    # FIXME: We assume that the backgroundcolor is set with the attribute
    # "backgroundcolor". Please check.
    bgcolor = 'black'

    index = 0
    textlen = len(message)

    while index < textlen:
        char = message[index]

        if char.encode('utf-8') == '\x03':
            messages.append(
                {'color': fgcolor, 'backgroundcolor': bgcolor, 'text': curmsg})
            curmsg = ""
            index += 1

            has_fgcolor = False
            fgcolor = 'aqua'
            bgcolor = 'black'

            try:
                number = int(message[index: index + 2])
                fgcolor = colorname(number)
                has_fgcolor = True
                index += 2
            except ValueError:
                try:
                    number = int(message[index])
                    fgcolor = colorname(number)
                    has_fgcolor = True
                    index += 1
                except ValueError:
                    pass

            print message[index]
            if has_fgcolor and message[index] == ',':
                index += 1
                try:
                    number = int(message[index: index + 2])
                    bgcolor = colorname(number)
                    index += 2
                except ValueError:
                    try:
                        number = int(message[index])
                        bgcolor = colorname(number)
                        index += 1
                    except ValueError:
                        pass
<commit_msg>Remove debug stuff from last commit<commit_after>import sys

from wurstminebot import commands
from wurstminebot import core
import json
from wurstminebot import loops
import minecraft
from wurstminebot import nicksub
import random
import re
import traceback


def endMOTD(sender, headers, message):
    irc_config = core.config('irc')
    chans = set(irc_config.get('channels', []))
    if 'main_channel' in irc_config:
        chans.add(irc_config['main_channel'])
    if 'dev_channel' in irc_config:
        chans.add(irc_config['dev_channel'])
    if 'live_channel' in irc_config:
        chans.add(irc_config['live_channel'])
    for chan in chans:
        try:
            core.state['bot'].joinchan(chan)
        except:
            core.debug_print(
                'Exception while joining channel ' + str(chan) + ':')
            if core.config('debug', False) or core.state.get('is_daemon', False):
                traceback.print_exc(file=sys.stdout)
    if irc_config.get('main_channel') is not None:
        core.state['bot'].say(irc_config['main_channel'], "aaand I'm back.")
    minecraft.tellraw({
        'text': "aaand I'm back.",
        'color': 'gold'
    })
    core.debug_print("aaand I'm back.")
    core.update_all()
    if core.state.get('input_loop') is None:
        core.state['input_loop'] = loops.InputLoop()
        core.state['input_loop'].start()
    if core.state.get('twitter_stream') is None and core.twitter is not None:
        core.state['twitter_stream'] = loops.TwitterStream(core.twitter)
        core.state['twitter_stream'].start()


def error_not_chan_op(sender, headers, message):
    irc_config = core.config('irc')
    if 'nickserv_password' in irc_config:
        core.state['bot'].say(
            'NickServ', 'IDENTIFY ' + irc_config['nickserv_password'])
    elif 'main_channel' in irc_config:
        core.state['bot'].say(irc_config['main_channel'], random.choice([
            'To change the topic, I need to be a channel operator.',
            'op me pls',
            'i can has op?'
        ]))


def format_text(message):
    def colorname(number):
        if number == 0:
            return "white"
        elif number == 1:
            return "black"
        elif number == 2:
            return "dark_blue"
        elif number == 3:
            return "dark_green"
        elif number == 4:
            return "red"
        elif number == 5:  # actually brown but it's ok
            return "dark_red"
        elif number == 6:
            return "dark_purple"
        elif number == 7:  # actually orange but looks similar
            return "gold"
        elif number == 8:
            return "yellow"
        elif number == 9:
            return "green"
        elif number == 10:
            return "dark_aqua"
        elif number == 11:
            return "aqua"
        elif number == 12:
            return "blue"
        elif number == 13:
            return "light_purple"
        elif number == 14:
            return "gray"
        elif number == 15:
            return "dark_gray"
        else:
            return "aqua"

    messages = []
    curmsg = ""
    fgcolor = 'aqua'
    # FIXME: We assume that the backgroundcolor is set with the attribute
    # "backgroundcolor". Please check.
    bgcolor = 'black'

    index = 0
    textlen = len(message)

    while index < textlen:
        char = message[index]

        if char.encode('utf-8') == '\x03':
            messages.append(
                {'color': fgcolor, 'backgroundcolor': bgcolor, 'text': curmsg})
            curmsg = ""
            index += 1

            has_fgcolor = False
            fgcolor = 'aqua'
            bgcolor = 'black'

            try:
                number = int(message[index: index + 2])
                fgcolor = colorname(number)
                has_fgcolor = True
                index += 2
            except ValueError:
                try:
                    number = int(message[index])
                    fgcolor = colorname(number)
                    has_fgcolor = True
                    index += 1
                except ValueError:
                    pass

            if has_fgcolor and message[index] == ',':
                index += 1
                try:
                    number = int(message[index: index + 2])
                    bgcolor = colorname(number)
                    index += 2
                except ValueError:
                    try:
                        number = int(message[index])
                        bgcolor = colorname(number)
                        index += 1
                    except ValueError:
                        pass

{'fraction_non_alphanumeric': 0.10460745354956504, 'fraction_numerical': 0.007303189775534315, 'mean_word_length': 1.6605714285714286, 'pattern_counts': {'":': 0, '<': 5, '<?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': '616299', 'n_tokens_mistral': 2689, 'n_tokens_neox': 2528, 'n_words': 697}