<commit_before>
import argparse
import urllib2

from ample.testing import integration_util
from ample.testing import run_tests
from ample.util import ample_util

__author__ = "<NAME> and <NAME>"
__date__ = "26-Mar-2016"

def found_exe(e):
    try:
        ample_util.find_exe(e)
    except:
        return False
    return True

def internet_on():
    # Taken from stackoverflow.com/questions/3764291/checking-network-connection
    try:
        reponse=urllib2.urlopen("http://192.168.127.12", timeout=1)
    except urllib2.URLError:
        return False
    return True

def parse_args(test_dict):
    """wrapper function for running test cases from scripts directly"""
    parser = argparse.ArgumentParser()
    integration_util.add_cmd_options(parser)
    argd =  vars(parser.parse_args())
    if argd['test_cases']:
        argd['test_cases'] = list(set(test_dict.keys()) & set(argd['test_cases']))
    else:
        argd['test_cases'] = test_dict.keys()<commit_msg>fixed pinging for internet testing<commit_after>
import argparse
import urllib2

from ample.testing import integration_util
from ample.testing import run_tests
from ample.util import ample_util

__author__ = "<NAME> and <NAME>"
__date__ = "26-Mar-2016"

def found_exe(e):
    try:
        ample_util.find_exe(e)
    except:
        return False
    return True

def internet_on():
    # Taken from stackoverflow.com/questions/3764291/checking-network-connection
    try:
        reponse = urllib2.urlopen("http://google.com", timeout=5)
    except urllib2.URLError:
        return False
    return True

def parse_args(test_dict):
    """wrapper function for running test cases from scripts directly"""
    parser = argparse.ArgumentParser()
    integration_util.add_cmd_options(parser)
    argd =  vars(parser.parse_args())
    if argd['test_cases']:
        argd['test_cases'] = list(set(test_dict.keys()) & set(argd['test_cases']))
    else:
        argd['test_cases'] = test_dict.keys()
{'fraction_non_alphanumeric': 0.10912799592044875, 'fraction_numerical': 0.022947475777664456, 'mean_word_length': 3.6825775656324584, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '939106', 'n_tokens_mistral': 667, 'n_tokens_neox': 621, 'n_words': 144}