<commit_before># -*- coding: utf-8 -*-
from __future__ import print_function
import json
import os
import sys
import tarfile
import tempfile
import shutil
from contextlib import closing
from io import BytesIO

try:
    from urllib.request import urlopen
except ImportError:
    from urllib2 import urlopen


def main():
    args = sys.argv[1:]
    try:
        package_name = args[0]
        version = args[1]
    except:
        print('Usage: dukpy-install package_name version')
        print('')
        print('Downloads a specific package version from npmjs.org. Note this is'
              'a very basic script that does not support dependencies.')
        return 1

    install_jspackage(package_name, version, './node_modules')


def install_jspackage(package_name, version, modulesdir):
    """Installs a JavaScript package downloaded from npmjs.org.

    For example to install React::

        install_jspackage('react', '0.14.8', './node_modules')<commit_msg>Use another directory to avoid messing with nodejs modules<commit_after># -*- coding: utf-8 -*-
from __future__ import print_function
import json
import os
import sys
import tarfile
import tempfile
import shutil
from contextlib import closing
from io import BytesIO

try:
    from urllib.request import urlopen
except ImportError:
    from urllib2 import urlopen


def main():
    args = sys.argv[1:]
    try:
        package_name = args[0]
        version = args[1]
    except:
        print('Usage: dukpy-install package_name version')
        print('')
        print('Downloads a specific package version from npmjs.org. Note this is'
              'a very basic script that does not support dependencies.')
        return 1

    install_jspackage(package_name, version, './js_modules')


def install_jspackage(package_name, version, modulesdir):
    """Installs a JavaScript package downloaded from npmjs.org.

    For example to install React::

        install_jspackage('react', '0.14.8', './node_modules')
{'fraction_non_alphanumeric': 0.08472012102874432, 'fraction_numerical': 0.010085728693898134, 'mean_word_length': 3.2483940042826553, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5583656', 'n_tokens_mistral': 575, 'n_tokens_neox': 546, 'n_words': 199}