<commit_before>"""Helper for building, testing, and linting coverage.py.

To get portability, all these operations are written in Python here instead
of in shell scripts, batch files, or Makefiles.

"""

import fnmatch
import glob
import os
import sys
import zipfile

def do_remove_extension(args):
    """Remove the compiled C extension, no matter what its name."""

    so_patterns = """
        tracer.so
        tracer.*.so
        """.split()

    for pattern in so_patterns:
        pattern = os.path.join("coverage", pattern)
        for filename in glob.glob(pattern):
            try:
                os.remove(filename)
            except OSError:
                pass

def do_test_with_tracer(args):
    """Run nosetests with a particular tracer."""
    import nose.core
    os.environ["COVERAGE_TEST_TRACER"] = args[0]
    nose_args = ["nosetests"] + args[1:]
    nose.core.main(argv=nose_args)

def do_zip_mods(args):
    """Build the zipmods.zip file."""
    zf = zipfile.ZipFile("test/zipmods.zip", "w")
    zf.write("test/covmodzip1.py", "covmodzip1.py")
<commit_msg>Also clean up Windows-compiled executables.<commit_after>"""Helper for building, testing, and linting coverage.py.

To get portability, all these operations are written in Python here instead
of in shell scripts, batch files, or Makefiles.

"""

import fnmatch
import glob
import os
import sys
import zipfile

def do_remove_extension(args):
    """Remove the compiled C extension, no matter what its name."""

    so_patterns = """
        tracer.so
        tracer.*.so
        tracer.pyd
        """.split()

    for pattern in so_patterns:
        pattern = os.path.join("coverage", pattern)
        for filename in glob.glob(pattern):
            try:
                os.remove(filename)
            except OSError:
                pass

def do_test_with_tracer(args):
    """Run nosetests with a particular tracer."""
    import nose.core
    os.environ["COVERAGE_TEST_TRACER"] = args[0]
    nose_args = ["nosetests"] + args[1:]
    nose.core.main(argv=nose_args)

def do_zip_mods(args):
    """Build the zipmods.zip file."""
    zf = zipfile.ZipFile("test/zipmods.zip", "w")
    zf.write("test/covmodzip1.py", "covmodzip1.py")

{'fraction_non_alphanumeric': 0.11512415349887133, 'fraction_numerical': 0.0036117381489841984, 'mean_word_length': 2.8673647469458987, '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': '6209540', 'n_tokens_mistral': 711, 'n_tokens_neox': 692, 'n_words': 197}