<commit_before>"""
Example check for Idiot.
"""

import psutil
import re

from idiot import CheckPlugin


class ApacheCheck(CheckPlugin):
    name = "Apache"

    def run(self):
        """
        Run the check.

        All check scripts must implement this method. It must return a tuple of:
        (<success>, <message>)

        In this case example, if the check succeeds and the apache process is
        nowhere to be found, the check will return (True, "No httpd processes found").

        If the check fails and an apache process is found, it returns
        (False, "Found httpd processes with pids <pids>")
        """
        pids = []
        for p in psutil.process_iter():
            try:
                if p.name() == 'httpd':
                    pids.append(p.pid)
            except psutil.NoSuchProcess:
                pass

        if len(pids):
            return (False, "Found httpd processes with pids: {}".format(', '.join([str(p) for p in pids])))<commit_msg>Fixed typo<commit_after>"""
Example check for Idiot.
"""

import psutil
import re

from idiot import CheckPlugin


class ApacheCheck(CheckPlugin):
    name = "Apache"

    def run(self):
        """
        Run the check.

        All check scripts must implement this method. It must return a tuple of:
        (<success>, <message>)

        In this example, if the check succeeds and the apache process is nowhere
        to be found, the check will return (True, "No httpd processes found").

        If the check fails and an apache process is found, it returns
        (False, "Found httpd processes with pids <pids>")
        """
        pids = []
        for p in psutil.process_iter():
            try:
                if p.name() == 'httpd':
                    pids.append(p.pid)
            except psutil.NoSuchProcess:
                pass

        if len(pids):
            return (False, "Found httpd processes with pids: {}".format(', '.join([str(p) for p in pids])))
{'fraction_non_alphanumeric': 0.09827760891590678, 'fraction_numerical': 0.0, 'mean_word_length': 2.006088280060883, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2721335', 'n_tokens_mistral': 556, 'n_tokens_neox': 530, 'n_words': 219}