madbot_cli.render
Write plans and reports for a person to read.
Each line starts with a sign: + to create, ~ to update, =
unchanged, ! to look at. --json prints the same content for a program.
Attributes
Functions
| Name | Description |
|---|---|
connection_line | Describe the plan of a connection. |
next_commands | Choose the commands to run after an apply, each with what it is for. |
node_state | Say where the data of a node stand after an apply. |
plural | Write a number of things. |
reached_state | Say where a submission apply went through stands: failed, sent or waiting. |
render_apply | Write the summary of an apply: each node, each submission, then what to run next. |
render_associations | Write the plan of the associations of a node. |
render_deposit | Write what a deposit holds, and the data it misses. |
render_metadata | Write the plan of the metadata of a submission. |
render_node | Write the plan of a node, then of the nodes under it, each one level further in. |
render_plan | Write a plan for a person to check. |
render_samples | Write the plan of the samples of a node. |
render_source | Write the plan of the data of a source on a node. |
render_submission | Write the plan of a submission. |
render_summary | Write the counts of a plan. |
render_untracked | Write what the workspace holds that the file does not mention. |
short | Show a value on one line. |
submission_state | Say where a submission stands after an apply. |
SIGNSattributemodule attribute#
SIGNS = {CREATE: '+', UPDATE: '~', CONNECT: '~', UNCHANGED: '=', DEPOSITED: '='}The sign that starts the line of each action.
WORDSattributemodule attribute#
WORDS = {
CREATE: 'create',
UPDATE: 'update',
CONNECT: 'give the credentials',
UNCHANGED: 'unchanged',
DEPOSITED: 'deposited'
}The word that names each action.
Writeattributemodule attribute#
Write = Callable[[str], None]Writes a line.
connection_linefunction#
def connection_line(kind: str, key: str, connection: Mapping) -> strDescribe the plan of a connection.
Parameters
Returns
str- One line.
next_commandsfunction#
def next_commands(report: Mapping, file: str, submit: bool) -> list[tuple[str, str]]Choose the commands to run after an apply, each with what it is for.
Parameters
Returns
list of tuple- Each command, and why to run it; empty when nothing is left to do.
node_statefunction#
def node_state(node: Mapping) -> strSay where the data of a node stand after an apply.
Parameters
| Name | Type | Description |
|---|---|---|
node | mapping | A node of the report of apply. |
Returns
str- Such as
12 data read, 2 failed to read.
pluralfunction#
def plural(number: int, noun: str) -> strWrite a number of things.
Returns
str- Such as
1 valueor2 values.
reached_statefunction#
def reached_state(submission: Mapping) -> strSay where a submission apply went through stands: failed, sent or waiting.
Parameters
| Name | Type | Description |
|---|---|---|
submission | mapping | A submission of the report of apply, neither left nor refused. |
Returns
str- Such as
readyorsent (submitted), PRJEB1234.
render_applyfunction#
def render_apply(write: Write, report: Mapping, file: str, submit: bool) -> NoneWrite the summary of an apply: each node, each submission, then what to run next.
render_associationsfunction#
def render_associations(write: Write, associations: Mapping, verbose: bool) -> NoneWrite the plan of the associations of a node.
render_depositfunction#
def render_deposit(write: Write, submission: Mapping) -> NoneWrite what a deposit holds, and the data it misses.
Parameters
| Name | Type | Description |
|---|---|---|
write | callable | Writes a line. |
submission | mapping | The plan of a deposited submission. |
render_metadatafunction#
def render_metadata(write: Write, metadata: Mapping | str | None) -> NoneWrite the plan of the metadata of a submission.
render_nodefunction#
def render_node(write: Write, node: Mapping, verbose: bool, depth: int = 0) -> NoneWrite the plan of a node, then of the nodes under it, each one level further in.
render_planfunction#
def render_plan(write: Write, result: Mapping, verbose: bool = False) -> NoneWrite a plan for a person to check.
render_samplesfunction#
def render_samples(write: Write, samples: Mapping, verbose: bool) -> NoneWrite the plan of the samples of a node.
render_sourcefunction#
def render_source(write: Write, key: str, source: Mapping, verbose: bool) -> NoneWrite the plan of the data of a source on a node.
render_submissionfunction#
def render_submission(write: Write, submission: Mapping) -> NoneWrite the plan of a submission.
Parameters
| Name | Type | Description |
|---|---|---|
write | callable | Writes a line. |
submission | mapping | Its plan. |
render_summaryfunction#
def render_summary(write: Write, summary: Mapping) -> NoneWrite the counts of a plan.
Parameters
| Name | Type | Description |
|---|---|---|
write | callable | Writes a line. |
summary | mapping | The summary of a plan. |
render_untrackedfunction#
def render_untracked(write: Write, result: Mapping) -> NoneWrite what the workspace holds that the file does not mention.
Parameters
| Name | Type | Description |
|---|---|---|
write | callable | Writes a line. |
result | mapping | A plan. |
shortfunction#
def short(value: Any, width: int = 60) -> strShow a value on one line.
Returns
str- The value as JSON-like text, cut at
width.
submission_statefunction#
def submission_state(submission: Mapping) -> strSay where a submission stands after an apply.
Parameters
| Name | Type | Description |
|---|---|---|
submission | mapping | A submission of the report of apply. |
Returns
str- Such as
readyordraft, 3 mandatory values missing.

