<commit_before># -*- coding: utf-8 -*-

import re
import json
import urllib

to_kick = []
stats = json.load(file('mods/canaima/stats.json'))
conf = json.load(file('mods/canaima/config.json'))


def encode_dict(dictionary):
    for key, items in dictionary.items():
        if isinstance(key, unicode):
            key = key.encode('utf-8')
        if isinstance(items, unicode):
            items = items.encode('utf-8')
        elif isinstance(items, dict):
            encode_dict(items)
        del dictionary[key]
        dictionary.update({key: items})

encode_dict(conf)

import badwords
import nodata
import noupper
import noflood
import norepeat

from sysb import commands
from irc.handlers import handler
from irc.connection import servers as base


@handler('privmsg notice join rpl_whoreply rpl_endofwho')
#@thread(no_class=True, n='moderador')
def pipe(self, event, group):
    event = event.lower()
    if event == 'rpl_whoreply':
        multi = group('line').lower().split(' ', 7)
        channel, user, host, server, nick, s, hopcount, realname = multi
        if channel != conf["channel"].lower():
            raise UnboundLocalError("it is not the required event")
        for _host, message in to_kick:
            if _host == host and nick != self.base.nick.lower():
                self.kick(conf["channel"], nick, message)
        return True
    elif event == 'rpl_endofwho':
        if len(to_kick) > conf['count_limit']:
            for obj in to_kick:
                to_kick.remove(obj)
        return True

    if group('host') in conf['ignore']:
        raise UnboundLocalError("it is not the required event")

    if event == 'join':
        if group('channel').lower() == conf['channel']:
            self.privmsg(group('nick'), conf['welcome'])
            self.privmsg(group('nick'), conf['example'])

            host = group('host')
            try:
                page = urllib.urlopen('http://freegeoip.net/json/' + host)
                results = json.loads(page)
            except:<commit_msg>UserBot-0.7.54  >:D<commit_after># -*- coding: utf-8 -*-

import re
import json
import urllib

to_kick = []
stats = json.load(file('mods/canaima/stats.json'))
conf = json.load(file('mods/canaima/config.json'))


def encode_dict(dictionary):
    for key, items in dictionary.items():
        if isinstance(key, unicode):
            key = key.encode('utf-8')
        if isinstance(items, unicode):
            items = items.encode('utf-8')
        elif isinstance(items, dict):
            encode_dict(items)
        del dictionary[key]
        dictionary.update({key: items})

encode_dict(conf)

import badwords
import nodata
import noupper
import noflood
import norepeat

from sysb import commands
from irc.handlers import handler
from irc.connection import servers as base


@handler('privmsg notice join rpl_whoreply rpl_endofwho')
#@thread(no_class=True, n='moderador')
def pipe(self, event, group):
    event = event.lower()
    if event == 'rpl_whoreply':
        multi = group('line').lower().split(' ', 7)
        channel, user, host, server, nick, s, hopcount, realname = multi
        if channel != conf["channel"].lower():
            raise UnboundLocalError("it is not the required event")
        for _host, message in to_kick:
            if _host == host and nick != self.base.nick.lower():
                self.kick(conf["channel"], nick, message)
        return True
    elif event == 'rpl_endofwho':
        if len(to_kick) > conf['count_limit']:
            for obj in to_kick:
                to_kick.remove(obj)
        return True

    if group('host') in conf['ignore']:
        raise UnboundLocalError("it is not the required event")

    if event == 'join':
        if group('channel').lower() == conf['channel']:
            self.privmsg(group('nick'), conf['welcome'])
            self.privmsg(group('nick'), conf['example'])

            host = group('host')
            try:
                page = urllib.urlopen('http://freegeoip.net/json/' + host)
                results = json.loads(page.read())
            except:
{'fraction_non_alphanumeric': 0.13274553024736713, 'fraction_numerical': 0.0029390154298310064, 'mean_word_length': 2.5730533683289587, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '776972', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1200, 'n_words': 322}