<commit_before># -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import time
import sys
import os
import imp

import numpy
import bohrium

# basestring is not available in Python 3
try:
  basestring
except NameError:
  basestring = str

# Never run test with the '-m bohrium' switch
assert (numpy != bohrium)

# Terminal colors
HEADER  = '\033[35m'
OKBLUE  = '\033[34m'
OKGREEN = '\033[32m'
WARNING = '\033[33m'
FAIL    = '\033[31m'
ENDC    = '\033[0m'


def get_test_object_names(obj):
    """ Returns all attribute names that starts with "test_" """
    ret = []

    for o in dir(obj):
        if o.startswith("test_"):
            ret.append(o)

    return ret


def check_result(res_np, res_bh):
    if isinstance(res_np, type):
        return res_np is res_bh
    if isinstance(res_np, basestring):
        return res_np == res_bh

    if bohrium.is_scalar(res_np):
        if not bohrium.is_scalar(res_bh):
            return False
    elif res_bh.size == 0 and res_bh.size == 0:
        return True  # Empty arrays are considered equal
    elif res_bh.shape != res_np.shape:
        return False
    try:
        return numpy.allclose(res_np, res_bh, equal_nan=True)
    except TypeError:
        # Old versions of NumPy do not have the 'equal_nan' option
        return numpy.allclose(res_np, res_bh)


def run(args):
    for filename in args.files:<commit_msg>test: fixed test of empty result<commit_after># -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import time
import sys
import os
import imp

import numpy
import bohrium

# basestring is not available in Python 3
try:
  basestring
except NameError:
  basestring = str

# Never run test with the '-m bohrium' switch
assert (numpy != bohrium)

# Terminal colors
HEADER  = '\033[35m'
OKBLUE  = '\033[34m'
OKGREEN = '\033[32m'
WARNING = '\033[33m'
FAIL    = '\033[31m'
ENDC    = '\033[0m'


def get_test_object_names(obj):
    """ Returns all attribute names that starts with "test_" """
    ret = []

    for o in dir(obj):
        if o.startswith("test_"):
            ret.append(o)

    return ret


def check_result(res_np, res_bh):
    if isinstance(res_np, type):
        return res_np is res_bh
    if isinstance(res_np, basestring):
        return res_np == res_bh

    if bohrium.is_scalar(res_np):
        if not bohrium.is_scalar(res_bh):
            return False
    elif res_np.size == 0 and res_bh.size == 0:
        return True  # Empty arrays are considered equal
    elif res_bh.shape != res_np.shape:
        return False
    try:
        return numpy.allclose(res_np, res_bh, equal_nan=True)
    except TypeError:
        # Old versions of NumPy do not have the 'equal_nan' option
        return numpy.allclose(res_np, res_bh)


def run(args):
    for filename in args.files:
{'fraction_non_alphanumeric': 0.09698046181172292, 'fraction_numerical': 0.02344582593250444, 'mean_word_length': 2.868131868131868, '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': '5960156', 'n_tokens_mistral': 995, 'n_tokens_neox': 936, 'n_words': 296}