Beispiel #1
0
    "-w",
    "--with-dependencies",
    is_flag=True,
    help="Remove obsolete dependencies not required anymore.",
)
@click.pass_context
@check_aea_project
def remove(click_context, with_dependencies):  # pylint: disable=unused-argument
    """Remove a resource from the agent."""
    ctx = cast(Context, click_context.obj)
    if with_dependencies:
        ctx.set_config("with_dependencies", True)


@remove.command()
@click.argument("connection_id", type=PublicIdParameter(), required=True)
@pass_ctx
def connection(ctx: Context, connection_id):
    """
    Remove a connection from the agent.

    It expects the public id of the connection to remove from the local registry.
    """
    remove_item(ctx, "connection", connection_id)


@remove.command()
@click.argument("contract_id", type=PublicIdParameter(), required=True)
@pass_ctx
def contract(ctx: Context, contract_id):
    """
Beispiel #2
0
from aea.configurations.base import DEFAULT_AEA_CONFIG_FILE, PublicId
from aea.configurations.constants import DEFAULT_REGISTRY_PATH


@click.command(name="fetch")
@registry_flag(
    help_local="For fetching agent from local folder.",
    help_remote="For fetching agent from remote registry.",
)
@click.option(
    "--alias",
    type=str,
    required=False,
    help="Provide a local alias for the agent.",
)
@click.argument("public-id", type=PublicIdParameter(), required=True)
@click.pass_context
def fetch(click_context, public_id, alias, local, remote):
    """Fetch Agent from Registry."""
    ctx = cast(Context, click_context.obj)
    if remote:
        fetch_agent(ctx, public_id, alias)
    else:
        fetch_agent_locally(ctx, public_id, alias, is_mixed=not local)


def _is_version_correct(ctx: Context, agent_public_id: PublicId) -> bool:
    """
    Compare agent version to the one in public ID.

    :param ctx: Context object.
Beispiel #3
0
from aea.helpers.multiaddr.base import MultiAddr


URI_REGEX = re.compile(r"(?:https?://)?(?P<host>[^:/ ]+):(?P<port>[0-9]*)")


@click.command()
@click.argument(
    "ledger_id",
    metavar="TYPE",
    type=click.Choice(list(crypto_registry.supported_ids)),
    required=True,
)
@click.option("-c", "--connection", is_flag=True)
@click.option(
    "-i", "--connection-id", type=PublicIdParameter(), required=False, default=None,
)
@click.option(
    "-h", "--host-field", type=str, required=False, default=None,
)
@click.option(
    "-p", "--port-field", type=str, required=False, default=None,
)
@click.option(
    "-u", "--uri-field", type=str, required=False, default="public_uri",
)
@click.pass_context
@check_aea_project
def get_multiaddress(
    click_context,
    ledger_id: str,
Beispiel #4
0
 def test_get_metavar_positive(self):
     """Test for get_metavar positive result."""
     result = PublicIdParameter.get_metavar("obj", "param")
     expected_result = "PUBLIC_ID"
     self.assertEqual(result, expected_result)
Beispiel #5
0
URI_REGEX = re.compile(r"(?:https?://)?(?P<host>[^:/ ]+):(?P<port>[0-9]*)")


@click.command()
@click.argument(
    "ledger_id",
    metavar="TYPE",
    type=click.Choice(list(crypto_registry.supported_ids)),
    required=True,
)
@click.option("-c", "--connection", is_flag=True)
@click.option(
    "-i",
    "--connection-id",
    type=PublicIdParameter(),
    required=False,
    default=None,
)
@click.option(
    "-h",
    "--host-field",
    type=str,
    required=False,
    default=None,
)
@click.option(
    "-p",
    "--port-field",
    type=str,
    required=False,