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

import os
import sys
import pickle

example_dir = '../../../examples/undocumented/python_modular'
test_dir = '../../../tests/integration/data/python%d-tests' % sys.version_info[0]
blacklist = ("__init__.py",
		"classifier_libsvm_minimal_modular.py",
		"classifier_multiclassocas_modular.py",
		"modelselection_grid_search_kernel.py",
		"serialization_string_kernels_modular.py",
		"kernel_fisher_modular.py",
		"kernel_top_modular.py",
		"distribution_hmm_modular.py",
		"kernel_director_linear_modular.py",
		"features_director_dot_modular.py",
		"converter_tdistributedstochasticneighborembedding_modular.py",
		"evaluation_director_contingencytableevaluation_modular.py",
		"distance_director_euclidean_modular.py",
		"classifier_multiclass_ecoc_random.py",
#the tests below all fail on travis but work fine on our buildbot
		"classifier_lda_modular.py",
		"classifier_liblinear_modular.py",
		"classifier_svmlight_batch_linadd_modular.py",
		"converter_tdistributedstochasticneighborembedding_modular.py",
		"distance_mahalanobis_modular.py",
		"mathematics_sparseinversecovariance_modular.py",
		"preprocessor_dimensionreductionpreprocessor_modular.py",
		"preprocessor_kernelpca_modular.py",
		"preprocessor_pca_modular.py",
		"regression_kernel_ridge_modular.py",
		"regression_least_squares_modular.py",
		"regression_linear_ridge_modular.py",
		"regression_svrlight_modular.py",
		"statistics_hsic.py",
		"features_dense_protocols_modular.py",
		"features_dense_zero_copy_modular.py",
		"transfer_multitask_clustered_logistic_regression.py",
		"transfer_multitask_l12_logistic_regression.py",
		"transfer_multitask_trace_logistic_regression.py",
		)

def get_fname(mod_name, i):
	return os.path.join(test_dir, mod_name + str(i) + '.txt')

def setup_tests(tests=[]):
	os.chdir(example_dir)

	if not len(tests):
		tests =  os.listdir(".")
		tests.sort()
	else:
		tests = [ os.path.basename(t) for t in tests ]

	sys.path.insert(0, '.')
	return tests

def check_for_function(fname):
	for l in open(fname).readlines():
		if l.startswith("def "):
			return True
	return False

def get_test_mod(t):
	if t.endswith(".py") and not t.startswith('.') and t not in blacklist:
		mod_name = t[:-3]

		if not check_for_function(t):<commit_msg>enable tests previously failing on travis<commit_after>#!/usr/bin/env python

import os
import sys
import pickle

example_dir = '../../../examples/undocumented/python_modular'
test_dir = '../../../tests/integration/data/python%d-tests' % sys.version_info[0]
blacklist = ("__init__.py",
		"classifier_libsvm_minimal_modular.py",
		"classifier_multiclassocas_modular.py",
		"modelselection_grid_search_kernel.py",
		"serialization_string_kernels_modular.py",
		"kernel_fisher_modular.py",
		"kernel_top_modular.py",
		"distribution_hmm_modular.py",
		"kernel_director_linear_modular.py",
		"features_director_dot_modular.py",
		"converter_tdistributedstochasticneighborembedding_modular.py",
		"evaluation_director_contingencytableevaluation_modular.py",
		"distance_director_euclidean_modular.py",
		"classifier_multiclass_ecoc_random.py",
		"statistics_hsic.py",
		"transfer_multitask_clustered_logistic_regression.py",
#the tests below all fail on travis but work fine on our buildbot
#		"classifier_lda_modular.py",
#		"classifier_liblinear_modular.py",
#		"classifier_svmlight_batch_linadd_modular.py",
#		"converter_tdistributedstochasticneighborembedding_modular.py",
#		"distance_mahalanobis_modular.py",
#		"mathematics_sparseinversecovariance_modular.py",
#		"preprocessor_dimensionreductionpreprocessor_modular.py",
#		"preprocessor_kernelpca_modular.py",
#		"preprocessor_pca_modular.py",
#		"regression_kernel_ridge_modular.py",
#		"regression_least_squares_modular.py",
#		"regression_linear_ridge_modular.py",
#		"regression_svrlight_modular.py",
#		"features_dense_protocols_modular.py",
#		"features_dense_zero_copy_modular.py",
#		"transfer_multitask_l12_logistic_regression.py",
#		"transfer_multitask_trace_logistic_regression.py",
		)

def get_fname(mod_name, i):
	return os.path.join(test_dir, mod_name + str(i) + '.txt')

def setup_tests(tests=[]):
	os.chdir(example_dir)

	if not len(tests):
		tests =  os.listdir(".")
		tests.sort()
	else:
		tests = [ os.path.basename(t) for t in tests ]

	sys.path.insert(0, '.')
	return tests

def check_for_function(fname):
	for l in open(fname).readlines():
		if l.startswith("def "):
			return True
	return False

def get_test_mod(t):
	if t.endswith(".py") and not t.startswith('.') and t not in blacklist:
		mod_name = t[:-3]

		if not check_for_function(t):
{'fraction_non_alphanumeric': 0.1220361105068523, 'fraction_numerical': 0.0021753317380900587, 'mean_word_length': 6.368589743589744, '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': '5442337', 'n_tokens_mistral': 1866, 'n_tokens_neox': 1756, 'n_words': 236}