<commit_before>try:
    from _Cfilters import nullify_secondary_maxima
except ImportError:
    import numpy as np
    # Because of the way C imports work, nullify_secondary_maxima
    # is *called*, as in nullify_secondary_maxima().
    # For the pure Python variant, we do not want to call the function,
    # so we make nullify_secondary_maxima a wrapper than returns
    # the pure Python function that does the actual filtering.
    def _filter(a):
        target = a.size // 2 + 1
        target_val = a[target]
        if np.any(a[:target] > target_val):
            return 0
        if np.any(a[target + 1:] >= target_val):
            return 0
        return target
    def nullify_secondary_maxima():
        return _filter<commit_msg>BUG/PERF: Fix and speedup pure-Python fallback for C filter.<commit_after>try:
    from _Cfilters import nullify_secondary_maxima
except ImportError:
    import numpy as np
    # Because of the way C imports work, nullify_secondary_maxima
    # is *called*, as in nullify_secondary_maxima().
    # For the pure Python variant, we do not want to call the function,
    # so we make nullify_secondary_maxima a wrapper than returns
    # the pure Python function that does the actual filtering.
    def _filter(a):
        target = a.size // 2
        target_val = a[target]
        if target_val == 0:
            return 0  # speedup trivial case
        if np.any(a[:target] > target_val):
            return 0
        if np.any(a[target + 1:] >= target_val):
            return 0
        return target_val
    def nullify_secondary_maxima():
        return _filter
{'fraction_non_alphanumeric': 0.06902985074626866, 'fraction_numerical': 0.006840796019900498, 'mean_word_length': 2.567627494456763, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3717909', 'n_tokens_mistral': 470, 'n_tokens_neox': 463, 'n_words': 172}