<commit_before>"""
In this file, mainly handle choosing which WSGI Server to start
the service.
"""

# -*- coding: utf-8 -*-
from SocketServer import ThreadingMixIn
from wsgiref.simple_server import WSGIServer, make_server


class BaseServer(object):
    """Base Server class"""
    def __init__(self, host, port, **kwargs):
        self.host = host
        self.port = port
        self.kws = kwargs

    def run(self, app):
        """To start the TCP server.
        Child Class should override this function"""
        pass


class NewWSGIServer(ThreadingMixIn, WSGIServer):
    """Support multi-thread"""
    pass


class WSGIrefServer(BaseServer):
    """Use wsgiref to build a server"""
    def run(self, wsgi_handler):
        server = make_server(
            host=self.host,
            port=self.port,
            app=wsgi_handler,
            server_class=NewWSGIServer
        )
        server.serve_forever()
<commit_msg>Update server.<commit_after># -*- coding: utf-8 -*-
"""
In this file, mainly handle choosing which WSGI Server to start
the service.
"""


class BaseServer(object):
    """Base Server class"""
    def __init__(self, host, port, **options):
        self.host = host
        self.port = port
        self.options = options

    def run(self, app):
        """To start the TCP server.
        Child Class should override this function"""
        pass


class WSGIrefServer(BaseServer):
    """Use wsgiref to build a server"""
    def run(self, app):
        from wsgiref.simple_server import make_server

        server = make_server(
            host=self.host,
            port=self.port,
            app=app,
            **self.options
        )
        server.serve_forever()

{'fraction_non_alphanumeric': 0.10572429906542057, 'fraction_numerical': 0.0011682242990654205, 'mean_word_length': 2.3588235294117648, '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': '1723051', 'n_tokens_mistral': 508, 'n_tokens_neox': 487, 'n_words': 150}