<commit_before>import requests
import subprocess


def pause_for_effect():
    # Pause execution so the user sees what happened
    try:
        raw_input()
    except NameError:
        input()


def check_for_updates(click, version, lock):
    info = requests.get(
        "https://pypi.python.org/pypi/spoppy/json").json()["info"]

    pypi_version = info["version"]

    version = version

    if version < pypi_version:
        click.echo("\033[1m\033[94mA new version of spoppy is "
                   "available!\033[0m")
        click.echo("\033[1m\033[96m Installed: {} \033[92m"
                   "PyPi: {}\033[0m".format(version,
                                            pypi_version))
        click.echo("\033[94m You can install it yourself or "
                   "automatically download it. Automatically "
                   "install it?\033[0m")

        message = '[Y(Automatically) / n(Manually)] '
        try:
            response = raw_input(message).lower()
        except NameError:
            response = input(message).lower()

        # Only do anything if they say yes
        if response == "y":
            try:
                subprocess.check_call(
                    ["sudo", "pip", "install", "spoppy", "--upgrade"])
                click.echo(
                    "\033[1m\033[92mspoppy updated sucessfully!\033[0m")

                click.echo("Please restart spoppy!")
                lock.release()
                pause_for_effect()

                raise SystemExit

            except subprocess.CalledProcessError:
                # Pip failed to automatically update
                click.echo(
                    "\033[1m\033[91mAutomatic updating failed!\033[0m")
                click.echo(
                    "You will have to manually update spoppy")
                pause_for_effect()
<commit_msg>Fix update checker. '10' < '9'<commit_after>import requests
import subprocess


def pause_for_effect():
    # Pause execution so the user sees what happened
    try:
        raw_input()
    except NameError:
        input()


def parse_version(v):
    try:
        return [int(part) for part in v.split('.')]
    except ValueError:
        return [0, 0, 0]


def check_for_updates(click, version, lock):
    info = requests.get(
        "https://pypi.python.org/pypi/spoppy/json").json()["info"]

    pypi_version = info["version"]

    version = version

    if parse_version(version) < parse_version(pypi_version):
        click.echo("\033[1m\033[94mA new version of spoppy is "
                   "available!\033[0m")
        click.echo("\033[1m\033[96m Installed: {} \033[92m"
                   "PyPi: {}\033[0m".format(version,
                                            pypi_version))
        click.echo("\033[94m You can install it yourself or "
                   "automatically download it. Automatically "
                   "install it?\033[0m")

        message = '[Y(Automatically) / n(Manually)] '
        try:
            response = raw_input(message).lower()
        except NameError:
            response = input(message).lower()

        # Only do anything if they say yes
        if response == "y":
            try:
                subprocess.check_call(
                    ["sudo", "pip", "install", "spoppy", "--upgrade"])
                click.echo(
                    "\033[1m\033[92mspoppy updated sucessfully!\033[0m")

                click.echo("Please restart spoppy!")
                lock.release()
                pause_for_effect()

                raise SystemExit

            except subprocess.CalledProcessError:
                # Pip failed to automatically update
                click.echo(
                    "\033[1m\033[91mAutomatic updating failed!\033[0m")
                click.echo(
                    "You will have to manually update spoppy")
                pause_for_effect()

{'fraction_non_alphanumeric': 0.10936695831188883, 'fraction_numerical': 0.035512094698919194, 'mean_word_length': 1.640625, 'pattern_counts': {'":': 2, '<': 6, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3709882', 'n_tokens_mistral': 1194, 'n_tokens_neox': 1036, 'n_words': 253}