<commit_before>"""
Low level abstraction layer over IRC.
"""
import panglery

from twisted.words.protocols import irc


class FancyInfobarbPangler(panglery.Pangler):
    def onPrivateMessage(self, _func=None):
        return self.add_hook(_func,
                             event="privateMessage",
                             needs=["user", "message"])


    def onChannelMessage(self, _func=None):
        return self.add_hook(_func,
                             event="channelMessage",
                             needs=["user", "channel", "message"])



class InfobarbClient(irc.IRCClient):
    """
    The IRC client for an infobarb.
    """
    nickname = "infobarb"

    def __init__(self, pangler):
        self.p = pangler


    def privmsg(self, user, channel, message):
        """
        Called when a PRIVMSG is received from the server.
        """
        if channel == self.nickname:
            event = "privateMessage"<commit_msg>Upstream moved to subscribe instead of add_hook, which fixes my OCD triggering because of underscores_in_mixedCaseCode<commit_after>"""
Low level abstraction layer over IRC.
"""
import panglery

from twisted.words.protocols import irc


class FancyInfobarbPangler(panglery.Pangler):
    def onPrivateMessage(self, _func=None):
        return self.subscribe(_func,
                              event="privateMessage",
                              needs=["user", "message"])


    def onChannelMessage(self, _func=None):
        return self.subscribe(_func,
                              event="channelMessage",
                              needs=["user", "channel", "message"])



class InfobarbClient(irc.IRCClient):
    """
    The IRC client for an infobarb.
    """
    nickname = "infobarb"

    def __init__(self, pangler):
        self.p = pangler


    def privmsg(self, user, channel, message):
        """
        Called when a PRIVMSG is received from the server.
        """
        if channel == self.nickname:
            event = "privateMessage"
{'fraction_non_alphanumeric': 0.10084451068057626, 'fraction_numerical': 0.0, 'mean_word_length': 2.1321928460342146, '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': '1625667', 'n_tokens_mistral': 582, 'n_tokens_neox': 549, 'n_words': 145}