<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
authored by:  RaNaN

This modul class handels all incoming and outgoing data between server and gui

"""
import asynchat
import asyncore
import socket
import threading
import time

from RequestHandler import RequestHandler


class ServerThread(threading.Thread):
    def __init__(self, pycore):
        threading.Thread.__init__(self)
        self.setDaemon(True)
        self.server = MainServerSocket(int(pycore.config['port']), pycore)

    def run(self):
        asyncore.loop()
        print "loop closed"

    def sockets(self):
        """returns all connected sockets in a list"""
        sockets = []
        for value in asyncore.socket_map.values():
            if SecondaryServerSocket == value.__class__:
                sockets.append(value)

        return sockets

    def push_all(self, obj):
        """push obj to all sockets"""
        for socket in self.sockets():
            socket.push_obj(obj)


class MainServerSocket(asyncore.dispatcher):
    def __init__(self, port, pycore):
        asyncore.dispatcher.__init__(self)
        pycore.logger.info('initing Remote-Server')
        self.pycore = pycore
        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
        self.bind(('localhost', port))
        self.listen(5)
    def handle_accept(self):
        newSocket, address = self.accept()<commit_msg>remote fix<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
authored by:  RaNaN

This modul class handels all incoming and outgoing data between server and gui

"""
import asynchat
import asyncore
import socket
import threading
import time

from RequestHandler import RequestHandler


class ServerThread(threading.Thread):
    def __init__(self, pycore):
        threading.Thread.__init__(self)
        self.setDaemon(True)
        self.server = MainServerSocket(int(pycore.config['port']), pycore)

    def run(self):
        asyncore.loop()
        print "loop closed"

    def sockets(self):
        """returns all connected sockets in a list"""
        sockets = []
        for value in asyncore.socket_map.values():
            if SecondaryServerSocket == value.__class__:
                sockets.append(value)

        return sockets

    def push_all(self, obj):
        """push obj to all sockets"""
        for socket in self.sockets():
            socket.push_obj(obj)


class MainServerSocket(asyncore.dispatcher):
    def __init__(self, port, pycore):
        asyncore.dispatcher.__init__(self)
        pycore.logger.info('initing Remote-Server')
        self.pycore = pycore
        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
        self.bind(('', port))
        self.listen(5)
    def handle_accept(self):
        newSocket, address = self.accept()
{'fraction_non_alphanumeric': 0.10530085959885387, 'fraction_numerical': 0.0014326647564469914, 'mean_word_length': 2.7743243243243243, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7460870', 'n_tokens_mistral': 823, 'n_tokens_neox': 799, 'n_words': 208}