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

from twisted.internet import task
from twisted.internet import reactor
from twisted.names.srvconnect import SRVConnector
from twisted.words.xish import domish, xpath
from twisted.words.protocols.jabber import xmlstream, client, jid
import platform
from time import time
from datetime import datetime, date

from Shoutbox import *
from utilities import *
from XmppBridge import *

class XMPPClientConnector(SRVConnector):
    def __init__(self, reactor, domain, factory):
        SRVConnector.__init__(self, reactor, 'xmpp-client', domain, factory)

    def pickServer(self):
        host, port = SRVConnector.pickServer(self)

        if not self.servers and not self.orderedServers:
            # no SRV record, fall back..
            port = 5222

        return host, port

class TwistedBridge(XmppBridge):
    client_supported_features = ['jabber:iq:last', 'jabber:iq:version']
    login = ""
    passwd = ""
    room = ""
    host = ""
    port = 5222
    roomjid = ""
    resource = ""
    xmlstream = None
    last_time = 0

    def make_connection(self):
        """
        Make an XMPP connection and authorize the user.
        """
        self.jid = jid.JID(self.login)
        f = client.XMPPClientFactory(self.jid, self.passwd)
        #ConnectAuthenticator
        #a = XMPPAuthenticator(jid, password)
        #a = xmlstream.ConnectAuthenticator(self.jid, self.passwd)
        #f = xmlstream.XmlStreamFactory(a)
        f.addBootstrap(xmlstream.STREAM_CONNECTED_EVENT, self.connected)
        f.addBootstrap(xmlstream.STREAM_END_EVENT, self.disconnected)
        f.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, self.authenticated)
        f.addBootstrap(xmlstream.INIT_FAILED_EVENT, self.init_failed)
        connector = XMPPClientConnector(reactor, self.jid.host, f)
        connector.connect()

    def close_connection(self):
        self.send_presence(ptype="unavailable", reason="Quitting...")
        self.xmlstream.sendFooter()

    def connected(self, xs):
        print 'Connected.'
        self.xmlstream = xs

        # Consider last activity time to be when connected.
        self.update_last_time()
<commit_msg>Removed commented out code.<commit_after># -*- coding: utf-8 -*-

from twisted.internet import task
from twisted.internet import reactor
from twisted.names.srvconnect import SRVConnector
from twisted.words.xish import domish, xpath
from twisted.words.protocols.jabber import xmlstream, client, jid
import platform
from time import time
from datetime import datetime, date

from Shoutbox import *
from utilities import *
from XmppBridge import *

class XMPPClientConnector(SRVConnector):
    def __init__(self, reactor, domain, factory):
        SRVConnector.__init__(self, reactor, 'xmpp-client', domain, factory)

    def pickServer(self):
        host, port = SRVConnector.pickServer(self)

        if not self.servers and not self.orderedServers:
            # no SRV record, fall back..
            port = 5222

        return host, port

class TwistedBridge(XmppBridge):
    client_supported_features = ['jabber:iq:last', 'jabber:iq:version']
    login = ""
    passwd = ""
    room = ""
    host = ""
    port = 5222
    roomjid = ""
    resource = ""
    xmlstream = None
    last_time = 0

    def make_connection(self):
        """
        Make an XMPP connection and authorize the user.
        """
        self.jid = jid.JID(self.login)
        f = client.XMPPClientFactory(self.jid, self.passwd)
        f.addBootstrap(xmlstream.STREAM_CONNECTED_EVENT, self.connected)
        f.addBootstrap(xmlstream.STREAM_END_EVENT, self.disconnected)
        f.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, self.authenticated)
        f.addBootstrap(xmlstream.INIT_FAILED_EVENT, self.init_failed)
        connector = XMPPClientConnector(reactor, self.jid.host, f)
        connector.connect()

    def close_connection(self):
        self.send_presence(ptype="unavailable", reason="Quitting...")
        self.xmlstream.sendFooter()

    def connected(self, xs):
        print 'Connected.'
        self.xmlstream = xs

        # Consider last activity time to be when connected.
        self.update_last_time()

{'fraction_non_alphanumeric': 0.09608030592734225, 'fraction_numerical': 0.004780114722753346, 'mean_word_length': 3.0356798457087755, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 18}, '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': '2306956', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1257, 'n_words': 302}