<commit_before>#!/usr/bin/env python

#In this module we implement an "as numpy" hack which makes it possible to
#utilize Bohrium using the command line argument "python -m bohrium.as_numpy"

import sys
import os
import numpy
import bohrium

def execfile_wrapper(path):
    """execfile() does not exist in Python 3"""
    try:
        execfile(path)
    except NameError:
        import runpy
        return runpy.run_path(path, run_name="__main__")


# numpy becomes bohrium
sys.modules['numpy_force'] = numpy
sys.modules['numpy'] = bohrium<commit_msg>npbackend:  avoid wrapping the script execution in a try/except construct<commit_after>#!/usr/bin/env python

#In this module we implement an "as numpy" hack which makes it possible to
#utilize Bohrium using the command line argument "python -m bohrium.as_numpy"

import sys
import os
import numpy
import bohrium

def execfile_wrapper(path):
    """execfile() does not exist in Python 3"""

    # We need this ugly code in order to avoid wrapping the script execution in a try/except construct
    try:
        execfile
    except NameError:
        import runpy
        return runpy.run_path(path, init_globals={}, run_name="__main__")
    return execfile(path, {"__name__": "__main__", "__file__": path})

# numpy becomes bohrium
sys.modules['numpy_force'] = numpy
sys.modules['numpy'] = bohrium
{'fraction_non_alphanumeric': 0.09037037037037036, 'fraction_numerical': 0.0014814814814814814, 'mean_word_length': 4.078947368421052, 'pattern_counts': {'":': 2, '<': 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': '7030521', 'n_tokens_mistral': 413, 'n_tokens_neox': 406, 'n_words': 150}