<commit_before>#!/usr/bin/env python
#
# EXPERIMENTAL
# IRC <=> Zulip mirroring bot
#
# Setup: First, you need to install python-irc version 8.5.3
# (https://bitbucket.org/jaraco/irc)

from __future__ import print_function
import irc.bot
import irc.strings
from irc.client import ip_numstr_to_quad, ip_quad_to_numstr, Event, ServerConnection
import zulip
import optparse

if False: from typing import Any

IRC_DOMAIN = "irc.example.com"

def zulip_sender(sender_string):
    # type: (str) -> str
    nick = sender_string.split("!")[0]
    return nick + "@" + IRC_DOMAIN

class IRCBot(irc.bot.SingleServerIRCBot):
    def __init__(self, channel, nickname, server, port=6667):
        # type: (irc.bot.Channel, str, str, int) -> None
        irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
        self.channel = channel # type: irc.bot.Channel

    def on_nicknameinuse(self, c, e):
        # type: (ServerConnection, Event) -> None
        c.nick(c.get_nickname().replace("_zulip", "__zulip"))<commit_msg>irc-mirror: Update the installation link.<commit_after>#!/usr/bin/env python
#
# EXPERIMENTAL
# IRC <=> Zulip mirroring bot
#
# Setup: First, you need to install python-irc version 8.5.3
# (https://github.com/jaraco/irc)

from __future__ import print_function
import irc.bot
import irc.strings
from irc.client import ip_numstr_to_quad, ip_quad_to_numstr, Event, ServerConnection
import zulip
import optparse

if False: from typing import Any

IRC_DOMAIN = "irc.example.com"

def zulip_sender(sender_string):
    # type: (str) -> str
    nick = sender_string.split("!")[0]
    return nick + "@" + IRC_DOMAIN

class IRCBot(irc.bot.SingleServerIRCBot):
    def __init__(self, channel, nickname, server, port=6667):
        # type: (irc.bot.Channel, str, str, int) -> None
        irc.bot.SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname)
        self.channel = channel # type: irc.bot.Channel

    def on_nicknameinuse(self, c, e):
        # type: (ServerConnection, Event) -> None
        c.nick(c.get_nickname().replace("_zulip", "__zulip"))
{'fraction_non_alphanumeric': 0.1291090995712244, 'fraction_numerical': 0.007622677465459742, 'mean_word_length': 4.0359712230215825, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '4848246', 'n_tokens_mistral': 761, 'n_tokens_neox': 723, 'n_words': 177}