<commit_before>import click

from blackbelt.handle_github import (
    pull_request,
    merge as do_merge,
    deploy as do_deploy
)

from blackbelt.commands.documented_command import command


@click.group(help='Handle github-related tasks and integrations.')
def cli():
    pass


@command()
@click.argument('card_url', required=False)
def pr(card_url):
    """
    Send current branch for code review with::

        bb gh pr [CARD_URL]

    This:

    #. Inspects current repository for branches
    #. If CARD_URL parameter is not specified, it inspects ``Doing`` on the :term:`Work Board` for the current working ticket (you should have only one working ticket in ``Doing`` that is assigned only to you)
        If CARD_URL parameter is specified, it inspects ``Doing`` on the :term:`Work Board` for the selected working ticket, and will raise an error if ticket is not found.
    #. Creates a pull request that references the trello card and references the PR on the card as well
    #. Moves the card to ``Ready``
    #. Opens the browser with the PR for further editing/review
    """
    pull_request(card_url)


@command()
@click.argument('pr_url')
def merge(pr_url):
    """
    Merge PR on Github into master with::<commit_msg>Fix copy / formatting a bit<commit_after>import click

from blackbelt.handle_github import (
    pull_request,
    merge as do_merge,
    deploy as do_deploy
)

from blackbelt.commands.documented_command import command


@click.group(help='Handle github-related tasks and integrations.')
def cli():
    pass


@command()
@click.argument('card_url', required=False)
def pr(card_url):
    """
    Send current branch for code review with::

        bb gh pr [CARD_URL]

    This:

    #. Inspects current repository for branches
    #. If CARD_URL parameter is not specified, it inspects ``Doing`` on the :term:`Work Board` for the current working ticket (you should have only one working ticket in ``Doing`` that is assigned only to you). If it is specified, it inspects ``Doing`` on the :term:`Work Board` for the selected working ticket, and will raise an error if ticket is not found.
    #. Creates a pull request that references the trello card and references the PR on the card as well
    #. Moves the card to ``Ready``
    #. Opens the browser with the PR for further editing/review
    """
    pull_request(card_url)


@command()
@click.argument('pr_url')
def merge(pr_url):
    """
    Merge PR on Github into master with::
{'fraction_non_alphanumeric': 0.08734330772341285, 'fraction_numerical': 0.0, 'mean_word_length': 3.6767485822306236, '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': '3066224', 'n_tokens_mistral': 726, 'n_tokens_neox': 685, 'n_words': 302}