<commit_before>import sys
import threading
import traceback
from tehbot import *
import irc.client
from Queue import Queue, Empty

def kbdinput():
    while True:
        try:
            inp = raw_input().strip()
            if inp == "":
                continue
            if inp[0] == "/": # command mode
                tmp = inp[1:].split(None, 1)

                if len(tmp) > 0:
                    cmd = tmp[0].lower()
                    args = tmp[1] if len(tmp) > 1 else None
                    queue.put(("kbd_" + cmd, args))

        except EOFError, SystemExit:
            break
        except:
            print Tehbot.ts()
            traceback.print_exc()


queue = Queue()
kbdthread = threading.Thread(target=kbdinput)
kbdthread.daemon = True
kbdthread.start()


try:
    bot = Tehbot()
    bot.connect()
except:
    print Tehbot.ts()
    traceback.print_exc()
    try:
        bot.quit()
    finally:
        raise SystemExit


#import plugins
#if not plugins.is_windows():
    #def sighandler(signum, frame):
        #bot.reload()

    #import signal
    #signal.signal(signal.SIGHUP, sighandler)

while True:
    if bot.quit_called:
        break

    try:
        bot.process_once(0.2)

        try:
            cmd, args = queue.get(False)
        except Empty:
            continue

        queue.task_done()

        try:
            func = getattr(bot, cmd)
        except AttributeError as e:
            print "Unknown command:", cmd
            continue

        func(args)
    except KeyboardInterrupt:
        bot.quit()
    except irc.client.ServerConnectionError as e:
        print "%s: %s" % (Tehbot.ts(), e)
        traceback.print_exc()
    except:
        print Tehbot.ts()
        traceback.print_exc()<commit_msg>set timer to 10ms<commit_after>import sys
import threading
import traceback
from tehbot import *
import irc.client
from Queue import Queue, Empty

def kbdinput():
    while True:
        try:
            inp = raw_input().strip()
            if inp == "":
                continue
            if inp[0] == "/": # command mode
                tmp = inp[1:].split(None, 1)

                if len(tmp) > 0:
                    cmd = tmp[0].lower()
                    args = tmp[1] if len(tmp) > 1 else None
                    queue.put(("kbd_" + cmd, args))

        except EOFError, SystemExit:
            break
        except:
            print Tehbot.ts()
            traceback.print_exc()


queue = Queue()
kbdthread = threading.Thread(target=kbdinput)
kbdthread.daemon = True
kbdthread.start()


try:
    bot = Tehbot()
    bot.connect()
except:
    print Tehbot.ts()
    traceback.print_exc()
    try:
        bot.quit()
    finally:
        raise SystemExit


#import plugins
#if not plugins.is_windows():
    #def sighandler(signum, frame):
        #bot.reload()

    #import signal
    #signal.signal(signal.SIGHUP, sighandler)

while True:
    if bot.quit_called:
        break

    try:
        bot.process_once(0.01)

        try:
            cmd, args = queue.get(False)
        except Empty:
            continue

        queue.task_done()

        try:
            func = getattr(bot, cmd)
        except AttributeError as e:
            print "Unknown command:", cmd
            continue

        func(args)
    except KeyboardInterrupt:
        bot.quit()
    except irc.client.ServerConnectionError as e:
        print "%s: %s" % (Tehbot.ts(), e)
        traceback.print_exc()
    except:
        print Tehbot.ts()
        traceback.print_exc()
{'fraction_non_alphanumeric': 0.10565180346492474, 'fraction_numerical': 0.005964214711729622, 'mean_word_length': 1.6885496183206108, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 7, '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': '6770877', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1062, 'n_words': 272}