<commit_before>#! /bin/bash
set -e

curdir=${0%/*}
topdir=${curdir}/../

#coverage_opts="--with-coverage --cover-tests --cover-inclusive"
coverage_opts=""

which pep8 2>&1 > /dev/null && check_with_pep8=1 || check_with_pep8=0

if test $# -gt 0; then
    test $check_with_pep8 = 1 && (for x in $@; do pep8 ${x%%:*}; done) || :
    PYTHONPATH=$topdir nosetests -c $curdir/nose.cfg $@
else
    for f in $(find ${topdir}/anyconfig -name '*.py'); do
        echo "[Info] Check $f..."
        test $check_with_pep8 = 1 && pep8 $f || :
        PYTHONPATH=$topdir nosetests -c $curdir/nose.cfg ${coverage_opts} $f
    done
fi<commit_msg>made python package dir automatically found, and coverage option set from env. val 'WITH_COVERAGE'<commit_after>#! /bin/bash
set -e

curdir=${0%/*}
topdir=${curdir}/../

if `env | grep -q 'WITH_COVERAGE' 2>/dev/null`; then
    coverage_opts="--with-coverage --cover-tests --cover-inclusive"
fi

which pep8 2>&1 > /dev/null && check_with_pep8=1 || check_with_pep8=0

if test $# -gt 0; then
    test $check_with_pep8 = 1 && (for x in $@; do pep8 ${x%%:*}; done) || :
    PYTHONPATH=$topdir nosetests -c $curdir/nose.cfg ${coverage_opts} $@
else
    # Find out python package dir and run tests for .py files under it.
    for d in ${topdir}/*; do
        if test -d $d -a -f $d/__init__.py; then
            pypkgdir=$d

            for f in $(find ${pypkgdir} -name '*.py'); do
                echo "[Info] Check $f..."
                test $check_with_pep8 = 1 && pep8 $f || :
                PYTHONPATH=$topdir nosetests -c $curdir/nose.cfg \
                        ${coverage_opts} $f
            done

            break
        fi
    done
fi
{'fraction_non_alphanumeric': 0.16367980884109917, 'fraction_numerical': 0.018518518518518517, 'mean_word_length': 2.425357873210634, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '862029', 'n_tokens_mistral': 649, 'n_tokens_neox': 619, 'n_words': 172}