<commit_before>import os
import urllib
import urllib2


def vimrc_path(editor):
    return os.path.expanduser('~/.%src' % editor)


def _generate_vimrc(editor, langs):
    params = [('langs', l.strip()) for l in langs]
    params.append(('editor', editor))
    data = urllib.urlencode(params)
    resp = urllib2.urlopen("https://vim-bootstrap.appspot.com/generate.vim",
                           data)
    return resp.read()


def get_available_langs():
    resp = urllib2.urlopen("https://vim-bootstrap.appspot.com/langs")
    return resp.read()


def update(vimrc, editor, langs):
    content = _generate_vimrc(editor, langs)
    vimrc = os.path.expanduser(vimrc)

    with open(vimrc, 'w') as fh:
        fh.write(str(content))

    return content

<commit_msg>support p3k on python file<commit_after>import os
try:
    import urllib2
    import urllib
except ImportError:
    import urllib.request as urllib2
    import urllib.parse as urllib


def vimrc_path(editor):
    return os.path.expanduser('~/.%src' % editor)


def _generate_vimrc(editor, langs):
    params = [('langs', l.strip()) for l in langs]
    params.append(('editor', editor))
    data = urllib.urlencode(params)
    resp = urllib2.urlopen("https://vim-bootstrap.appspot.com/generate.vim",
                           data)
    return resp.read()


def get_available_langs():
    resp = urllib2.urlopen("https://vim-bootstrap.appspot.com/langs")
    return resp.read().decode('utf-8')


def update(vimrc, editor, langs):
    content = _generate_vimrc(editor, langs)
    vimrc = os.path.expanduser(vimrc)

    with open(vimrc, 'w') as fh:
        fh.write(str(content))

    return content


{'fraction_non_alphanumeric': 0.13349368610944076, 'fraction_numerical': 0.005411906193625977, 'mean_word_length': 3.180904522613065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '4376731', 'n_tokens_mistral': 606, 'n_tokens_neox': 572, 'n_words': 121}