<commit_before>"""
:copyright: 2010 by <NAME>
:license: MIT

"""
import re
import os
import subprocess

def hg(args, cwd='.'):
    p = subprocess.Popen(
        'hg ' + args,
        shell=True,
        stdout=subprocess.PIPE,
        cwd=cwd,
        env=dict(os.environ, HGPLAIN='1')
    )
    out, _ = p.communicate()
    return out.strip().decode()  # will kill us sometimes

# extended pep 386 regex
# see http://www.python.org/dev/peps/pep-0386/#the-new-versioning-algorithm
version_re = r"""^
(?P<prefix>\w+-?)?         # any text, may have a dash
                              # custom to deal with tag prefixes
(?P<version>\d+\.\d+)         # minimum 'N.N'
(?P<extraversion>(?:\.\d+)*)  # any number of extra '.N' segments
(?P<prerelfullversion>
(:?<commit_msg>try harder to disable i18n<commit_after>"""
:copyright: 2010 by <NAME>
:license: MIT

"""
import re
import os
import subprocess

def hg(args, cwd='.'):
    p = subprocess.Popen(
        'hg ' + args,
        shell=True,
        stdout=subprocess.PIPE,
        cwd=cwd,
        env=dict(os.environ,
                 # try to disable i18n
                 LC_ALL='C',
                 LANGUAGE='',
                 HGPLAIN='1',
                )
    )
    out, _ = p.communicate()
    return out.strip().decode()  # will kill us on hg lacking HGPLAIN support

# extended pep 386 regex
# see http://www.python.org/dev/peps/pep-0386/#the-new-versioning-algorithm
version_re = r"""^
(?P<prefix>\w+-?)?         # any text, may have a dash
                              # custom to deal with tag prefixes
(?P<version>\d+\.\d+)         # minimum 'N.N'
(?P<extraversion>(?:\.\d+)*)  # any number of extra '.N' segments
(?P<prerelfullversion>
(:?
{'fraction_non_alphanumeric': 0.16060961313012895, 'fraction_numerical': 0.016412661195779603, 'mean_word_length': 2.1906542056074767, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4956805', 'n_tokens_mistral': 616, 'n_tokens_neox': 578, 'n_words': 144}