<commit_before>import sys
import json
import pkg_resources
from subprocess import check_output


def get_version():
    out = check_output(["gauge", "-v", "--machine-readable"])
    data = json.loads(str(out.decode()))
    for plugin in data['plugins']:
        if plugin['name'] == 'python':
            return plugin['version']
    return ''


def get_dev_getgauge_version(plugin_nightly_version):
    refined_version = plugin_nightly_version.replace(
        'nightly', '').replace('-', '')
    return refined_version[:6] + "dev" + refined_version[6:]


def install_getgauge(getgauge_version):
    install_cmd = [sys.executable, "-m", "pip", "install", getgauge_version, "--user"]
    if "dev" in getgauge_version:
        install_cmd.append("--pre")
    check_output(install_cmd)


def assert_versions():
    python_plugin_version = get_version()
    if not python_plugin_version:
        print('The gauge python plugin is not installed!')
        exit(1)

    expected_gauge_version = python_plugin_version
    if "nightly" in python_plugin_version:
        expected_gauge_version = get_dev_getgauge_version(
            python_plugin_version)

    try:
        getgauge_version = pkg_resources.get_distribution('getgauge').version
        if getgauge_version != expected_gauge_version:
            install_getgauge("getgauge=="+expected_gauge_version)
    except pkg_resources.DistributionNotFound:
        install_getgauge("getgauge=="+expected_gauge_version)


if __name__ == '__main__':
    assert_versions()
<commit_msg>Use shell=True for windows npm installation of gauge<commit_after>import sys
import json
import pkg_resources
from subprocess import check_output


def get_version():
    out = check_output(["gauge", "-v", "--machine-readable"],shell=True)
    data = json.loads(str(out.decode()))
    for plugin in data['plugins']:
        if plugin['name'] == 'python':
            return plugin['version']
    return ''


def get_dev_getgauge_version(plugin_nightly_version):
    refined_version = plugin_nightly_version.replace(
        'nightly', '').replace('-', '')
    return refined_version[:6] + "dev" + refined_version[6:]


def install_getgauge(getgauge_version):
    install_cmd = [sys.executable, "-m", "pip", "install", getgauge_version, "--user"]
    if "dev" in getgauge_version:
        install_cmd.append("--pre")
    check_output(install_cmd)


def assert_versions():
    python_plugin_version = get_version()
    if not python_plugin_version:
        print('The gauge python plugin is not installed!')
        exit(1)

    expected_gauge_version = python_plugin_version
    if "nightly" in python_plugin_version:
        expected_gauge_version = get_dev_getgauge_version(
            python_plugin_version)

    try:
        getgauge_version = pkg_resources.get_distribution('getgauge').version
        if getgauge_version != expected_gauge_version:
            install_getgauge("getgauge=="+expected_gauge_version)
    except pkg_resources.DistributionNotFound:
        install_getgauge("getgauge=="+expected_gauge_version)


if __name__ == '__main__':
    assert_versions()

{'fraction_non_alphanumeric': 0.11221864951768488, 'fraction_numerical': 0.0019292604501607716, 'mean_word_length': 3.9696485623003195, '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': '493085', 'n_tokens_mistral': 969, 'n_tokens_neox': 897, 'n_words': 189}