<commit_before># winservice.py

import sys
from sys import modules
from traceback import format_exc
from os.path import splitext, abspath

from servicemanager import LogInfoMsg
from win32api import SetConsoleCtrlHandler
from win32serviceutil import InstallService, ServiceFramework, StartService

from win32event import INFINITE
from win32event import CreateEvent, SetEvent, WaitForSingleObject

from win32service import SERVICE_STOPPED
from win32service import SERVICE_AUTO_START, SERVICE_RUNNING
from win32service import SERVICE_START_PENDING, SERVICE_STOP_PENDING

from circuits import BaseComponent

class Service(BaseComponent, ServiceFramework):

    _svc_name_ = "unknown"
    _svc_display_name_ = "Service Template"

    def __init__(self, *args):
        super(Service, self).__init__(*args)

        self._stop_event = CreateEvent(None, 0, 0, None)

    def SvcDoRun(self):
        self.ReportServiceStatus(SERVICE_START_PENDING)
        try:
            self.ReportServiceStatus(SERVICE_RUNNING)
            self.run()
            WaitForSingleObject(self._stop_event, INFINITE)
        except Exception, e:
            LogInfoMsg("ERROR: %s" % e)
            LogInfoMsg(format_exc())
            self.SvcStop()

    def SvcStop(self):
        self.ReportServiceStatus(SERVICE_STOP_PENDING)
        self.stop()
        SetEvent(self._stop_event)
        self.ReportServiceStatus(SERVICE_STOPPED)

def install(cls, name, description=None, stay_alive=True):
    cls._svc_name_ = name
    cls._svc_display_name_ = description or name

    if hasattr(modules[cls.__module__], "__file__"):
        module_path = modules[cls.__module__].__file__
    else:
        module_path = sys.executable

    module_file = splitext(abspath(module_path))[0]<commit_msg>tmp/win32_service.service: Fixed name of function<commit_after># winservice.py

import sys
from sys import modules
from traceback import format_exc
from os.path import splitext, abspath

from servicemanager import LogInfoMsg
from win32api import SetConsoleCtrlHandler
from win32serviceutil import InstallService, ServiceFramework, StartService

from win32event import INFINITE
from win32event import CreateEvent, SetEvent, WaitForSingleObject

from win32service import SERVICE_STOPPED
from win32service import SERVICE_AUTO_START, SERVICE_RUNNING
from win32service import SERVICE_START_PENDING, SERVICE_STOP_PENDING

from circuits import BaseComponent

class Service(BaseComponent, ServiceFramework):

    _svc_name_ = "unknown"
    _svc_display_name_ = "Service Template"

    def __init__(self, *args):
        super(Service, self).__init__(*args)

        self._stop_event = CreateEvent(None, 0, 0, None)

    def SvcDoRun(self):
        self.ReportServiceStatus(SERVICE_START_PENDING)
        try:
            self.ReportServiceStatus(SERVICE_RUNNING)
            self.run()
            WaitForSingleObject(self._stop_event, INFINITE)
        except Exception, e:
            LogInfoMsg("ERROR: %s" % e)
            LogInfoMsg(format_exc())
            self.SvcStop()

    def SvcStop(self):
        self.ReportServiceStatus(SERVICE_STOP_PENDING)
        self.stop()
        SetEvent(self._stop_event)
        self.ReportServiceStatus(SERVICE_STOPPED)

def install_service(cls, name, description=None, stay_alive=True):
    cls._svc_name_ = name
    cls._svc_display_name_ = description or name

    if hasattr(modules[cls.__module__], "__file__"):
        module_path = modules[cls.__module__].__file__
    else:
        module_path = sys.executable

    module_file = splitext(abspath(module_path))[0]
{'fraction_non_alphanumeric': 0.07146860986547085, 'fraction_numerical': 0.010089686098654708, 'mean_word_length': 3.8957475994513033, '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': '6060662', 'n_tokens_mistral': 1088, 'n_tokens_neox': 1071, 'n_words': 243}