<commit_before>from socket import error as SocketError
import os
import subprocess
import signal
import threading
import time
import atexit
import random
import sys
import logging

from zombie.proxy.client import ZombieProxyClient

__all__ = ['ZombieProxyServer']


class PipeWorker(threading.Thread):
    """
    A thread that monitors and redirects node.js stdout and stderr to the
    parent process console.
    """

    def __init__(self, pipe):
        super(PipeWorker, self).__init__()
        self.pipe = pipe
        self.daemon = True
        self.log = logging.getLogger(__name__)

    def __worker(self, pipe):
        while True:
            line = pipe.readline()
            if line:
                self.log.debug(line[:-1])
            else:
                break

    def run(self):
        try:
            self.__worker(self.pipe)
        except Exception as e:
            try:
                self.log.error(e)
            except:  # pragma: nocover
                pass

__server_instance__ = None
proxy_path = os.path.join(
    os.path.dirname(os.path.abspath(__file__)),
    'server.js'
)


def singleton(cls):
    instances = {}

    def ZombieProxyServer(*args, **kwargs):
        if cls not in instances:
            instances[cls] = cls(*args, **kwargs)
            global __server_instance__
            __server_instance__ = instances[cls]
        return instances[cls]
        ZombieProxyServer.__name__ = cls.__name__
        ZombieProxyServer.__doc__ = cls.__doc__
        ZombieProxyServer.__repr__ = cls.__repr__
    return ZombieProxyServer


@singleton
class ZombieProxyServer(object):
<commit_msg>This code was never executed<commit_after>from socket import error as SocketError
import os
import subprocess
import signal
import threading
import time
import atexit
import random
import sys
import logging

from zombie.proxy.client import ZombieProxyClient

__all__ = ['ZombieProxyServer']


class PipeWorker(threading.Thread):
    """
    A thread that monitors and redirects node.js stdout and stderr to the
    parent process console.
    """

    def __init__(self, pipe):
        super(PipeWorker, self).__init__()
        self.pipe = pipe
        self.daemon = True
        self.log = logging.getLogger(__name__)

    def __worker(self, pipe):
        while True:
            line = pipe.readline()
            if line:
                self.log.debug(line[:-1])
            else:
                break

    def run(self):
        try:
            self.__worker(self.pipe)
        except Exception as e:
            try:
                self.log.error(e)
            except:  # pragma: nocover
                pass

__server_instance__ = None
proxy_path = os.path.join(
    os.path.dirname(os.path.abspath(__file__)),
    'server.js'
)


def singleton(cls):
    instances = {}

    def ZombieProxyServer(*args, **kwargs):
        if cls not in instances:
            instances[cls] = cls(*args, **kwargs)
            global __server_instance__
            __server_instance__ = instances[cls]
        return instances[cls]
    return ZombieProxyServer


@singleton
class ZombieProxyServer(object):

{'fraction_non_alphanumeric': 0.08373129576567973, 'fraction_numerical': 0.0006367398917542184, 'mean_word_length': 2.2525879917184266, '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': '4856166', 'n_tokens_mistral': 924, 'n_tokens_neox': 902, 'n_words': 240}