<commit_before># flake8: noqa
from __future__ import print_function, unicode_literals

import io
import logging
import os

from invoke import task, run
import pkg_resources

# see urllib3 regarding InsecureRequestWarning and InsecurePlatformWarning
logging.captureWarnings(True)

if not os.getenv('VIRTUAL_ENV'):
    if not os.path.exists('.venv'):
        run('virtualenv -q --system-site-packages .venv', hide=True)
    execfile('.venv/bin/activate_this.py', dict(__file__='.venv/bin/activate_this.py'))

try:
    pkg_resources.require('semantic_version')
    pkg_resources.require('twine')
    pkg_resources.require('wheel')
except pkg_resources.DistributionNotFound:
    run('pip -q install -U semantic_version twine wheel', hide=True)


@task
def install_gitflow():
    """Install git-flow if not found"""
    if not run('which git-flow', hide=True, warn=True).ok:
        run('wget --no-check-certificate -q -O /tmp/gitflow-installer.sh  https://raw.github.com/petervanderdoes/gitflow/develop/contrib/gitflow-installer.sh')
        run('sudo bash /tmp/gitflow-installer.sh install stable')
        run('rm /tmp/gitflow-installer.sh')


@task
def next_release(major=False, minor=False, patch=True):
    """Get next release version (by major, minor or patch)"""

    import semantic_version

    prev = run('git describe --abbrev=0 --tags', hide=True).stdout
    ver = semantic_version.Version.coerce(prev.strip())
    if major:
        return ver.next_major()
    if minor:
        return ver.next_minor()
    if patch:
        return ver.next_patch()
    return None


@task(install_gitflow)<commit_msg>enable working with new project, no tags<commit_after># flake8: noqa
from __future__ import print_function, unicode_literals

import io
import logging
import os

from invoke import task, run
import pkg_resources

# see urllib3 regarding InsecureRequestWarning and InsecurePlatformWarning
logging.captureWarnings(True)

if not os.getenv('VIRTUAL_ENV'):
    if not os.path.exists('.venv'):
        run('virtualenv -q --system-site-packages .venv', hide=True)
    execfile('.venv/bin/activate_this.py', dict(__file__='.venv/bin/activate_this.py'))

try:
    pkg_resources.require('semantic_version')
    pkg_resources.require('twine')
    pkg_resources.require('wheel')
except pkg_resources.DistributionNotFound:
    run('pip -q install -U semantic_version twine wheel', hide=True)


@task
def install_gitflow():
    """Install git-flow if not found"""
    if not run('which git-flow', hide=True, warn=True).ok:
        run('wget --no-check-certificate -q -O /tmp/gitflow-installer.sh  https://raw.github.com/petervanderdoes/gitflow/develop/contrib/gitflow-installer.sh')
        run('sudo bash /tmp/gitflow-installer.sh install stable')
        run('rm /tmp/gitflow-installer.sh')


@task
def next_release(major=False, minor=False, patch=True):
    """Get next release version (by major, minor or patch)"""

    import semantic_version

    prev = run('git describe --abbrev=0 --tags', warn=True, hide=True).stdout or '0.0.0'
    ver = semantic_version.Version.coerce(prev.strip())
    if major:
        return ver.next_major()
    if minor:
        return ver.next_minor()
    if patch:
        return ver.next_patch()
    return None


@task(install_gitflow)
{'fraction_non_alphanumeric': 0.12396694214876033, 'fraction_numerical': 0.0027548209366391185, 'mean_word_length': 3.9365558912386707, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '1229816', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1022, 'n_words': 250}