<commit_before>#!/usr/bin/env python2
# -*- coding: utf-8 -*-

import sys
import re
import inspect
import json
import resource

from socket         import socket, AF_INET, SOCK_STREAM
from urllib         import urlopen
from bytebot_config import *
from time           import time

BYTEBOT_DEBUG_DEBUG = 0b00001
BYTEBOT_DEBUG_INFO  = 0b00010
BYTEBOT_DEBUG_WARN  = 0b00100
BYTEBOT_DEBUG_ERROR = 0b01000
BYTEBOT_DEBUG_EMERG = 0b10000

class BytebotIrc:
    def __init__(self, server, port=6667, nick='Bytebot', password='', channel='', debug=BYTEBOT_DEBUG_WARN):
        self.server   = server
        self.port     = port
        self.nick     = nick
        self.password = password
        self.channel  = channel

        self.debug    = debug
        self.warm_up  = True
        self.socket   = socket(AF_INET, SOCK_STREAM)

        self.register_hook('ping', self.ping)

    def print(self, message, debug_level=BYTEBOT_DEBUG_WARN):
        if self.debug & debug_level == self.debug:
            print(message)

    def connect(self):
        self.socket.connect(self.server, self.port)

    def login(self):
        self.socket.send("USER "+ BYTEBOT_NICK +" "+ BYTEBOT_NICK +" "+ BYTEBOT_NICK +" :bytespeicher bot\n")
        self.socket.send("NICK "+ BYTEBOT_NICK +"\n")
        if self.password:
            self.socket.send("PRIVMSG NICKSERV :IDENTIFY " + BYTEBOT_PASSWORD+ "\r\n")

        if.self.channel:
            self.socket.send("JOIN "+ BYTEBOT_CHANNEL +"\n")
    
    def send_message(self, message):
        self.log('send_message: ' + message, BYTEBOT_DEBUG_DEBUG)
        self.socket.send("PRIVMSG" + BYTEBOT_CHANNEL + " :" + message + "\r\n")

    def run_commands(self, message):
        for cmd in self.hooks:
            cmd(message)<commit_msg>BUGFIX: renamed print to log (again..)<commit_after>#!/usr/bin/env python2
# -*- coding: utf-8 -*-

import sys
import re
import inspect
import json
import resource

from socket         import socket, AF_INET, SOCK_STREAM
from urllib         import urlopen
from bytebot_config import *
from time           import time

BYTEBOT_DEBUG_DEBUG = 0b00001
BYTEBOT_DEBUG_INFO  = 0b00010
BYTEBOT_DEBUG_WARN  = 0b00100
BYTEBOT_DEBUG_ERROR = 0b01000
BYTEBOT_DEBUG_EMERG = 0b10000

class BytebotIrc:
    def __init__(self, server, port=6667, nick='Bytebot', password='', channel='', debug=BYTEBOT_DEBUG_WARN):
        self.server   = server
        self.port     = port
        self.nick     = nick
        self.password = password
        self.channel  = channel

        self.debug    = debug
        self.warm_up  = True
        self.socket   = socket(AF_INET, SOCK_STREAM)

        self.register_hook('ping', self.ping)

    def log(self, message, debug_level=BYTEBOT_DEBUG_WARN):
        if self.debug & debug_level == self.debug:
            print(message)

    def connect(self):
        self.socket.connect(self.server, self.port)

    def login(self):
        self.socket.send("USER "+ BYTEBOT_NICK +" "+ BYTEBOT_NICK +" "+ BYTEBOT_NICK +" :bytespeicher bot\n")
        self.socket.send("NICK "+ BYTEBOT_NICK +"\n")
        if self.password:
            self.socket.send("PRIVMSG NICKSERV :IDENTIFY " + BYTEBOT_PASSWORD+ "\r\n")

        if.self.channel:
            self.socket.send("JOIN "+ BYTEBOT_CHANNEL +"\n")
    
    def send_message(self, message):
        self.log('send_message: ' + message, BYTEBOT_DEBUG_DEBUG)
        self.socket.send("PRIVMSG" + BYTEBOT_CHANNEL + " :" + message + "\r\n")

    def run_commands(self, message):
        for cmd in self.hooks:
            cmd(message)
{'fraction_non_alphanumeric': 0.11142295818130789, 'fraction_numerical': 0.020207690148751054, 'mean_word_length': 2.6666666666666665, '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': '2578540', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1185, 'n_words': 250}