<commit_before>import socket
import select

import config

class IRCConnection:
    def __init__(self, serverName, port=6667):
        self.connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.connection.connect((serverName, port))
        self.connection.setblocking(0)

    def sendMessage(self, toSend):
        '''Helper function that sends the given
           string as an IRC message.
        '''
        print toSend
        self.connection.send(str(toSend) + "\r\n")

    def receive(self):
        '''Recieve 512 bytes from the connection (512 bytes == 1 message)
        '''
        # time out after a reasonable period of time so we revoice quickly
        ready = select.select([self.connection], [], [], 0.2)
        if ready[0]:
            return str(self.connection.recv(512))
        else:
            return ""

    def setNick(self, nick):
        '''Sets the nick to given string.
        '''
        self.sendMessage("NICK " + nick)

    def setUser(self, userName, hostName, serverName, realName):
        '''Set the user info as given.
        '''
        self.sendMessage("USER " + userName + " " +
                                   hostName + " " +
                                   serverName + " :" +
                                   realName)
<commit_msg>No longer prints out PONGs<commit_after>import socket
import select

import config

class IRCConnection:
    def __init__(self, serverName, port=6667):
        self.connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.connection.connect((serverName, port))
        self.connection.setblocking(0)

    def sendMessage(self, toSend):
        '''Helper function that sends the given
           string as an IRC message.
        '''
        if not toSend.startswith("PONG"):
            print toSend
        self.connection.send(str(toSend) + "\r\n")

    def receive(self):
        '''Recieve 512 bytes from the connection (512 bytes == 1 message)
        '''
        # time out after a reasonable period of time so we revoice quickly
        ready = select.select([self.connection], [], [], 0.2)
        if ready[0]:
            return str(self.connection.recv(512))
        else:
            return ""

    def setNick(self, nick):
        '''Sets the nick to given string.
        '''
        self.sendMessage("NICK " + nick)

    def setUser(self, userName, hostName, serverName, realName):
        '''Set the user info as given.
        '''
        self.sendMessage("USER " + userName + " " +
                                   hostName + " " +
                                   serverName + " :" +
                                   realName)

{'fraction_non_alphanumeric': 0.10816859380828049, 'fraction_numerical': 0.013427825438269302, 'mean_word_length': 1.8201892744479495, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6564369', 'n_tokens_mistral': 749, 'n_tokens_neox': 705, 'n_words': 201}