<commit_before>import os
import subprocess
def getoutput(cmd, cwd='.'):
    p = subprocess.Popen(cmd,
                         shell=True,
                         stdout=subprocess.PIPE,
                         cwd=cwd,
                         env={},
                        )
    out, _ = p.communicate()
    return out.decode() # will kill us sometimes

hg_prefix = 'python2 -c "from mercurial import dispatch;dispatch.run()" '


def hg(args, cwd='.'):
    return getoutput(hg_prefix + args, cwd)

def version_from_cachefile(root, cachefile=None):
    #XXX: for now we ignore root
    if not cachefile:
        return
    #replaces 'with open()' from py2.6
    fd = open(cachefile)
    fd.readline()  # remove the comment<commit_msg>winnt shouldnt get the messy hg prefix<commit_after>import os
import sys
import subprocess
def getoutput(cmd, cwd='.'):
    p = subprocess.Popen(cmd,
                         shell=True,
                         stdout=subprocess.PIPE,
                         cwd=cwd,
                         env={},
                        )
    out, _ = p.communicate()
    return out.decode() # will kill us sometimes

hg_prefix = 'python2 -c "from mercurial import dispatch;dispatch.run()" '
if sys.platform == 'winnt':
    hg_prefix = 'hg '

def hg(args, cwd='.'):
    return getoutput(hg_prefix + args, cwd)

def version_from_cachefile(root, cachefile=None):
    #XXX: for now we ignore root
    if not cachefile:
        return
    #replaces 'with open()' from py2.6
    fd = open(cachefile)
    fd.readline()  # remove the comment
{'fraction_non_alphanumeric': 0.10684580934101087, 'fraction_numerical': 0.003838771593090211, 'mean_word_length': 1.9904397705544934, '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': '447261', 'n_tokens_mistral': 494, 'n_tokens_neox': 469, 'n_words': 130}