<commit_before>
import os
import time
import textwrap
import stat
import shutil
import random
import string
import threading
import concurrent.futures
from functools import partial
from itertools import chain

from snakemake.jobs import Job
from snakemake.shell import shell
from snakemake.logging import logger
from snakemake.stats import Stats
from snakemake.utils import format
from snakemake.exceptions import print_exception, get_exception_origin
from snakemake.exceptions import format_error, RuleException
from snakemake.exceptions import ClusterJobException, ProtectedOutputException


class AbstractExecutor:

    def __init__(self, workflow, dag,
        printreason=False, quiet=False,
        printshellcmds=False, printthreads=True, output_wait=3):
        self.workflow = workflow
        self.dag = dag
        self.quiet = quiet
        self.printreason = printreason
        self.printshellcmds = printshellcmds
        self.printthreads = printthreads
        self.output_wait = output_wait

    def run(self, job, callback=None, error_callback=None):
        self._run(job)
        callback(job)

    def shutdown(self):
        pass

    def _run(self, job):
        self.printjob(job)

    def printjob(self, job):

        def format_files(job, io, ruleio, dynamicio):
            for f, f_ in zip(io, ruleio):
                if f in dynamicio:
                    yield "{} (dynamic)".format(f_)
                else:
                    yield f

        def format_ruleitem(name, value):
            return "" if not value else "\t{}: {}".format(name, value)

        desc = list()
        if not self.quiet:
            if job.message:
                desc.append(job.message)
            else:
                desc.append("rule {}:".format(job.rule.name))
                for name, value in (
                    ("input", ", ".join(format_files(
                        job, job.input, job.rule.input, job.dynamic_input))),
                    ("output", ", ".join(format_files(
                        job, job.output, job.rule.output,
                        job.dynamic_output))),
                    ("log", job.log),
                    ("reason",
                        self.dag.reason(job) if self.printreason else None)):
                    if value:
                        desc.append(format_ruleitem(name, value))
                if job.priority > 1:
                    desc.append(format_ruleitem(
                        "priority", "highest"
                        if job.priority == Job.HIGHEST_PRIORITY<commit_msg>Fixed issue #34.<commit_after>
import os
import time
import textwrap
import stat
import shutil
import random
import string
import threading
import concurrent.futures
from functools import partial
from itertools import chain

from snakemake.jobs import Job
from snakemake.shell import shell
from snakemake.logging import logger
from snakemake.stats import Stats
from snakemake.utils import format
from snakemake.exceptions import print_exception, get_exception_origin
from snakemake.exceptions import format_error, RuleException
from snakemake.exceptions import ClusterJobException, ProtectedOutputException


class AbstractExecutor:

    def __init__(self, workflow, dag,
        printreason=False, quiet=False,
        printshellcmds=False, printthreads=True, output_wait=3):
        self.workflow = workflow
        self.dag = dag
        self.quiet = quiet
        self.printreason = printreason
        self.printshellcmds = printshellcmds
        self.printthreads = printthreads
        self.output_wait = output_wait

    def run(self, job, callback=None, error_callback=None):
        self._run(job)
        callback(job)

    def shutdown(self):
        pass

    def _run(self, job):
        self.printjob(job)

    def printjob(self, job):

        def format_files(job, io, ruleio, dynamicio):
            for f in io:
                f_ = ruleio[f]
                if f in dynamicio:
                    yield "{} (dynamic)".format(f_)
                else:
                    yield f

        def format_ruleitem(name, value):
            return "" if not value else "\t{}: {}".format(name, value)

        desc = list()
        if not self.quiet:
            if job.message:
                desc.append(job.message)
            else:
                desc.append("rule {}:".format(job.rule.name))
                for name, value in (
                    ("input", ", ".join(format_files(
                        job, job.input, job.ruleio, job.dynamic_input))),
                    ("output", ", ".join(format_files(
                        job, job.output, job.ruleio,
                        job.dynamic_output))),
                    ("log", job.log),
                    ("reason",
                        self.dag.reason(job) if self.printreason else None)):
                    if value:
                        desc.append(format_ruleitem(name, value))
                if job.priority > 1:
                    desc.append(format_ruleitem(
                        "priority", "highest"
                        if job.priority == Job.HIGHEST_PRIORITY
{'fraction_non_alphanumeric': 0.08632112236944661, 'fraction_numerical': 0.0011691348402182386, 'mean_word_length': 1.87241186345831, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3182236', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1335, 'n_words': 367}