<commit_before>import threading
import os
import inspect
import subprocess
import time
import sys
from collections import deque

import endpoints
from ..utils import Host, Path


def find_module_path():
    """find where the master module is located"""
    #return os.path.dirname(os.path.realpath(os.path.join(inspect.getsourcefile(endpoints), "..")))
    path = os.path.dirname(inspect.getsourcefile(endpoints))
    return path


def find_module_import_path():
    """find and return the importable path for endpoints"""
    module_path = find_module_path()
    path = os.path.dirname(module_path)
    return path
    #path = os.path.dirname(os.path.realpath(os.path.join(module_path, "..")))
    #return os.path.dirname(os.path.realpath(os.path.join(inspect.getsourcefile(endpoints), "..")))


class WSGIThread(threading.Thread):
    """Used internally by the Client classes to start one of the server clients
    in a separate thread"""
    def __init__(self, server):
        super(WSGIThread, self).__init__()
        self.server = server
        self._stop = threading.Event()
        self.daemon = True

    def stop(self):
        self._stop.set()

    def stopped(self):
        return self._stop.isSet()

    def flush(self, line):
        sys.stdout.write(line)
        sys.stdout.flush()

    def run(self):
        process = None
        try:
            args, kwargs = self.server.get_subprocess_args_and_kwargs()
            process = subprocess.Popen(*args, **kwargs)

            # Poll process for new output until finished
            for line in iter(process.stdout.readline, ""):
                self.server.buf.append(line.strip())
                if not self.server.quiet:
                    self.flush(line)

                if self.stopped():
                    break

        except Exception as e:
            if not self.server.quiet:
                print e<commit_msg>fixes whitespace issue with the lines in the wsgi client<commit_after>import threading
import os
import inspect
import subprocess
import time
import sys
from collections import deque

import endpoints
from ..utils import Host, Path


def find_module_path():
    """find where the master module is located"""
    #return os.path.dirname(os.path.realpath(os.path.join(inspect.getsourcefile(endpoints), "..")))
    path = os.path.dirname(inspect.getsourcefile(endpoints))
    return path


def find_module_import_path():
    """find and return the importable path for endpoints"""
    module_path = find_module_path()
    path = os.path.dirname(module_path)
    return path
    #path = os.path.dirname(os.path.realpath(os.path.join(module_path, "..")))
    #return os.path.dirname(os.path.realpath(os.path.join(inspect.getsourcefile(endpoints), "..")))


class WSGIThread(threading.Thread):
    """Used internally by the Client classes to start one of the server clients
    in a separate thread"""
    def __init__(self, server):
        super(WSGIThread, self).__init__()
        self.server = server
        self._stop = threading.Event()
        self.daemon = True

    def stop(self):
        self._stop.set()

    def stopped(self):
        return self._stop.isSet()

    def flush(self, line):
        sys.stdout.write(line)
        sys.stdout.flush()

    def run(self):
        process = None
        try:
            args, kwargs = self.server.get_subprocess_args_and_kwargs()
            process = subprocess.Popen(*args, **kwargs)

            # Poll process for new output until finished
            for line in iter(process.stdout.readline, ""):
                self.server.buf.append(line.rstrip())
                if not self.server.quiet:
                    self.flush(line)

                if self.stopped():
                    break

        except Exception as e:
            if not self.server.quiet:
                print e
{'fraction_non_alphanumeric': 0.10712428497139885, 'fraction_numerical': 0.0, 'mean_word_length': 2.4720216606498195, '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': '6310133', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1079, 'n_words': 286}