<commit_before>import json
import click
from pprint import pprint
from bitshares.storage import configStorage as config
from bitshares.proposal import Proposal, Proposals
from prettytable import PrettyTable
from .decorators import (
    onlineChain,
    unlockWallet
)
from .main import main


@main.command()
@click.pass_context
@onlineChain
@click.argument(
    'proposal',
    nargs=-1)
@click.option(
    "--account",
    help="Account that takes this action",
    default=config["default_account"],
    type=str)
@unlockWallet
def disapproveproposal(ctx, proposal, account):
    """ Disapprove a proposal
    """
    pprint(ctx.bitshares.disapproveproposal(
        proposal,
        account=account
    ))


@main.command()
@click.pass_context
@onlineChain
@click.argument(
    'proposal',
    nargs=-1)
@click.option(
    "--account",
    help="Account that takes this action",
    default=config["default_account"],
    type=str)
@unlockWallet
def approveproposal(ctx, proposal, account):
    """ Approve a proposal
    """
    pprint(ctx.bitshares.approveproposal(
        proposal,
        account=account
    ))


@main.command()
@click.pass_context
@onlineChain
@click.argument(
    "account",
    default=config["default_account"],
    type=str,
    required=False
)
def proposals(ctx, account):
    """ List proposals
    """
    proposals = Proposals(account)
    t = PrettyTable([
        "id",
        "expiration",
        "required approvals",
        "available approvals",
        "review period time",
        "proposal",
    ])
    t.align = 'l'
    for proposal in proposals:
        t.add_row([
            proposal["id"],
            proposal["expiration_time"],
            (
                proposal["required_active_approvals"] +
                proposal["required_owner_approvals"]
            ),
            (
                proposal["available_active_approvals"] +
                proposal["available_key_approvals"] +
                proposal["available_owner_approvals"]
            ),
            proposal.get("review_period_time", None),
            json.dumps(proposal["proposed_transaction"], indent=4),
        ])

    click.echo(str(t))<commit_msg>[proposals] nicer formatting of the approvals<commit_after>import json
import click
from pprint import pprint
from bitshares.storage import configStorage as config
from bitshares.proposal import Proposals
from prettytable import PrettyTable
from .decorators import (
    onlineChain,
    unlockWallet
)
from .main import main


@main.command()
@click.pass_context
@onlineChain
@click.argument(
    'proposal',
    nargs=-1)
@click.option(
    "--account",
    help="Account that takes this action",
    default=config["default_account"],
    type=str)
@unlockWallet
def disapproveproposal(ctx, proposal, account):
    """ Disapprove a proposal
    """
    pprint(ctx.bitshares.disapproveproposal(
        proposal,
        account=account
    ))


@main.command()
@click.pass_context
@onlineChain
@click.argument(
    'proposal',
    nargs=-1)
@click.option(
    "--account",
    help="Account that takes this action",
    default=config["default_account"],
    type=str)
@unlockWallet
def approveproposal(ctx, proposal, account):
    """ Approve a proposal
    """
    pprint(ctx.bitshares.approveproposal(
        proposal,
        account=account
    ))


@main.command()
@click.pass_context
@onlineChain
@click.argument(
    "account",
    default=config["default_account"],
    type=str,
    required=False
)
def proposals(ctx, account):
    """ List proposals
    """
    proposals = Proposals(account)
    t = PrettyTable([
        "id",
        "expiration",
        "required approvals",
        "available approvals",
        "review period time",
        "proposal",
    ])
    t.align = 'l'
    for proposal in proposals:
        t.add_row([
            proposal["id"],
            proposal["expiration_time"],
            json.dumps(
                proposal["required_active_approvals"] +
                proposal["required_owner_approvals"],
                indent=1),
            json.dumps(
                proposal["available_active_approvals"] +
                proposal["available_key_approvals"] +
                proposal["available_owner_approvals"],
                indent=1),
            proposal.get("review_period_time", None),
            json.dumps(proposal["proposed_transaction"], indent=4),
        ])

    click.echo(str(t))
{'fraction_non_alphanumeric': 0.11538461538461539, 'fraction_numerical': 0.001799370220422852, 'mean_word_length': 2.678246484698098, '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': '2597316', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1290, 'n_words': 267}