<commit_before>#!/usr/local/bin/python

from twisted.enterprise import adbapi
from twisted.words.protocols.jabber.client import basicClientFactory
from twisted.words.protocols.jabber import jid, xmlstream
from twisted.words.xish import domish
from twisted.internet import reactor
import presence
import news

config = {
    'user': 'mimir',
    'host': 'ik.nu',
    'resource': 'news_monitor',
    'secret': '35t120p',
    'dbuser': 'ralphm',
    'dbname': 'mimir'
}

class Log:

    def connected(self, xmlstream):
        xmlstream.rawDataInFn = self.rawDataIn
        xmlstream.rawDataOutFn = self.rawDataOut

    def rawDataIn(self, buf):
        print "RECV: %s" % unicode(buf, 'utf-8').encode('ascii', 'replace')

    def rawDataOut(self, buf):
        print "SEND: %s" % unicode(buf, 'utf-8').encode('ascii', 'replace')

log = Log()
dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL',
                               user=config["dbuser"],
                               database=config["dbname"],
                               client_encoding='utf-8',
                               cp_min = 1,
                               cp_max = 1
                               )
ms = presence.Storage(dbpool)
presence_monitor = presence.RosterMonitor(ms)
news_monitor = news.Monitor(presence_monitor, dbpool)
cf = basicClientFactory(jid.JID(tuple = (config["user"],
                                         config["host"],
                                         config["resource"])),
                        config["secret"])
cf.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, log.connected)
cf.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, presence_monitor.connected)
cf.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, news_monitor.connected)
reactor.connectTCP(config["host"], 5222, cf)
reactor.run()<commit_msg>Lower maximum retry limit.<commit_after>#!/usr/local/bin/python

from twisted.enterprise import adbapi
from twisted.words.protocols.jabber.client import basicClientFactory
from twisted.words.protocols.jabber import jid, xmlstream
from twisted.words.xish import domish
from twisted.internet import reactor
import presence
import news

config = {
    'user': 'mimir',
    'host': 'ik.nu',
    'resource': 'news_monitor',
    'secret': '35t120p',
    'dbuser': 'ralphm',
    'dbname': 'mimir'
}

class Log:

    def connected(self, xmlstream):
        xmlstream.rawDataInFn = self.rawDataIn
        xmlstream.rawDataOutFn = self.rawDataOut

    def rawDataIn(self, buf):
        print "RECV: %s" % unicode(buf, 'utf-8').encode('ascii', 'replace')

    def rawDataOut(self, buf):
        print "SEND: %s" % unicode(buf, 'utf-8').encode('ascii', 'replace')

log = Log()
dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL',
                               user=config["dbuser"],
                               database=config["dbname"],
                               client_encoding='utf-8',
                               cp_min = 1,
                               cp_max = 1
                               )
ms = presence.Storage(dbpool)
presence_monitor = presence.RosterMonitor(ms)
news_monitor = news.Monitor(presence_monitor, dbpool)
cf = basicClientFactory(jid.JID(tuple = (config["user"],
                                         config["host"],
                                         config["resource"])),
                        config["secret"])
cf.maxDelay = 900
cf.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, log.connected)
cf.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, presence_monitor.connected)
cf.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, news_monitor.connected)
reactor.connectTCP(config["host"], 5222, cf)
reactor.run()
{'fraction_non_alphanumeric': 0.12158808933002481, 'fraction_numerical': 0.008547008547008548, 'mean_word_length': 2.425873465533522, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '612258', 'n_tokens_mistral': 1096, 'n_tokens_neox': 1054, 'n_words': 204}