<commit_before>##
# 16.02.2005, c
import numpy as nm
import scipy as sc
import scipy.linalg as nla
import scipy.sparse as sp
import pdb

import glob, re, time, sys, os
from copy import copy, deepcopy
from types import MethodType, UnboundMethodType
from getch import getch

import atexit

real_types = [nm.float64]
complex_types = [nm.complex128]

nm.set_printoptions( threshold = 100 )

sfepy_config_dir = os.path.expanduser('~/.sfepy')
if not os.path.exists(sfepy_config_dir):
    os.makedirs(sfepy_config_dir)

##
# 22.09.2005, c
# 24.10.2005
if sys.version[:5] < '2.4.0':
    def sorted( sequence ):
        tmp = copy( sequence )
        tmp.sort()
        return tmp

##
# 26.05.2006, c
def debug():
    pdb.set_trace()

##
# c: 20.06.2008, r: 20.06.2008
def import_file( filename ):
    path = os.path.dirname( filename )
    if not path in sys.path:
        sys.path.append( path )
    name = os.path.splitext( os.path.basename( filename ) )[0]
    mod = __import__( name )
    return mod


def assert_( condition ):
    if not condition:
        raise ValueError( 'assertion failed!' )

##
# c: 06.04.2005, r: 05.05.2008
def pause( msg = None ):
    """
    Prints the line number and waits for a keypress.

    If you press:
    "q" ............. it will call sys.exit()
    any other key ... it will continue execution of the program

    This is useful for debugging.
    """
    f = sys._getframe(1)
    ff = f.f_code
    if (msg):
        print '%s, %d: %s(), %d: %s' % (ff.co_filename, ff.co_firstlineno,<commit_msg>fix import_file() for multiple imports<commit_after>##
# 16.02.2005, c
import numpy as nm
import scipy as sc
import scipy.linalg as nla
import scipy.sparse as sp
import pdb

import glob, re, time, sys, os
from copy import copy, deepcopy
from types import MethodType, UnboundMethodType
from getch import getch

import atexit

real_types = [nm.float64]
complex_types = [nm.complex128]

nm.set_printoptions( threshold = 100 )

sfepy_config_dir = os.path.expanduser('~/.sfepy')
if not os.path.exists(sfepy_config_dir):
    os.makedirs(sfepy_config_dir)

##
# 22.09.2005, c
# 24.10.2005
if sys.version[:5] < '2.4.0':
    def sorted( sequence ):
        tmp = copy( sequence )
        tmp.sort()
        return tmp

##
# 26.05.2006, c
def debug():
    pdb.set_trace()

def import_file( filename ):
    """Import a file as a module. The module is explicitly reloaded to
    prevent undesirable interactions."""
    path = os.path.dirname( filename )
    if not path in sys.path:
        sys.path.append( path )
    name = os.path.splitext( os.path.basename( filename ) )[0]

    if name in sys.modules:
        force_reload = True
    else:
        force_reload = False

    mod = __import__( name )

    if force_reload:
        reload(mod)

    return mod

def assert_( condition ):
    if not condition:
        raise ValueError( 'assertion failed!' )

##
# c: 06.04.2005, r: 05.05.2008
def pause( msg = None ):
    """
    Prints the line number and waits for a keypress.

    If you press:
    "q" ............. it will call sys.exit()
    any other key ... it will continue execution of the program

    This is useful for debugging.
    """
    f = sys._getframe(1)
    ff = f.f_code
    if (msg):
        print '%s, %d: %s(), %d: %s' % (ff.co_filename, ff.co_firstlineno,
{'fraction_non_alphanumeric': 0.12719563900666264, 'fraction_numerical': 0.04239854633555421, 'mean_word_length': 2.7279909706546275, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6568317', 'n_tokens_mistral': 1264, 'n_tokens_neox': 1145, 'n_words': 360}