<commit_before>#!/usr/bin/python
# Misc utilities for testing.

import glob
import os
import sys


# These functions are to locate the module path reliably (supposedly).
# From StackOverflow.
def we_are_frozen():
    # All of the modules are built-in to the interpreter, e.g., by py2exe
    return hasattr(sys, "frozen")


def module_path():
    encoding = sys.getfilesystemencoding()
    if we_are_frozen():
        return os.path.dirname(unicode(sys.executable, encoding))
    return os.path.dirname(unicode(__file__, encoding))


def reset_database():
    """
    Removes the sqlite database and creates a new one.
    :return:
    """

    path = module_path()
    basepath = os.path.join(path, "../../")

    try:
        os.remove(os.path.join(basepath), "database.db")
    except:
        pass

    os.chdir(basepath)
    os.system("alembic upgrade head")<commit_msg>[selenium]: Fix to selenium _utils<commit_after>#!/usr/bin/python
# Misc utilities for testing.

import glob
import os
import sys


# These functions are to locate the module path reliably (supposedly).
# From StackOverflow.
def we_are_frozen():
    # All of the modules are built-in to the interpreter, e.g., by py2exe
    return hasattr(sys, "frozen")


def module_path():
    encoding = sys.getfilesystemencoding()
    if we_are_frozen():
        return os.path.dirname(unicode(sys.executable, encoding))
    return os.path.dirname(unicode(__file__, encoding))


def reset_database():
    """
    Removes the sqlite database and creates a new one.
    :return:
    """

    path = module_path()
    basepath = os.path.join(path, "../../")

    try:
        os.remove(os.path.join(basepath, "database.db"))
    except:
        pass

    os.chdir(basepath)
    os.system("alembic upgrade head")
{'fraction_non_alphanumeric': 0.12040700960994913, 'fraction_numerical': 0.0011305822498586771, 'mean_word_length': 3.164705882352941, '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': '2243455', 'n_tokens_mistral': 582, 'n_tokens_neox': 545, 'n_words': 157}