dootle.actions.postbox

Postbox: Each Task Tree gets one, as a set[Any] Each Task can put something in its own postbox. And can read any other task tree’s postbox, but not modify it.

Functions

_validate_key(→ tuple[str, str])

Validate and split a key into (box, subbox)

Classes

_DootPostBox

Internal Postbox class.

PutPostAction

push data to the inter-task postbox of this task tree

GetPostAction

Read data from the inter-task postbox of a task tree.

ClearPostAction

Clear your postbox

SummarizePostAction

print a summary of this task tree's postbox

Module Contents

dootle.actions.postbox._validate_key(
key: doot.workflow.TaskName,
) tuple[str, str]

Validate and split a key into (box, subbox)

Parameters:

key (doot.workflow.TaskName)

Return type:

tuple[str, str]

class dootle.actions.postbox._DootPostBox

Internal Postbox class. holds a static variable of boxes, which maps task roots -> unique postbox Postboxes are lists, values are appended to it

Can ‘put’, ‘get’, ‘clear_box’, and ‘clear’.

Keys are task names, of {body}..{tail} eg: example::task..key which corresponds to body[example::task][key]

Subboxes: TypeAlias = dict[str, list[Any]]
Boxes: TypeAlias = dict[str, Subboxes]
boxes: ClassVar[_DootPostBox.Boxes]
default_subbox: Final[str] = '-'
whole_box_key: Final[str] = '*'
static put(
key: doot.workflow.TaskName,
val: None | list | set | Any,
) None
Parameters:
  • key (doot.workflow.TaskName)

  • val (None | list | set | Any)

Return type:

None

static get(key: doot.workflow.TaskName) list | dict
Parameters:

key (doot.workflow.TaskName)

Return type:

list | dict

static clear_box(key: doot.workflow.TaskName) None
Parameters:

key (doot.workflow.TaskName)

Return type:

None

static clear() None
Return type:

None

class dootle.actions.postbox.PutPostAction

push data to the inter-task postbox of this task tree ‘args’ are pushed to the postbox of the calling task root (ie: stripped of UUIDs) ‘kwargs’ are pushed to the kwarg specific subbox. can be explicit tasks or a subbox of the calling task root

Both key and value are expanded of kwargs. The Subbox is the last ..{name} of the full path

eg: {do=”post.put”, args=[“{key}”, “{key}”], “group::task.sub..subbox”=”{key}”, “subbox”=”{key2}”}

_add_to_task_box(
spec,
state,
args,
_basename,
) None
Return type:

None

_add_to_target_box(
spec,
state,
kwargs,
_basename,
) None
Return type:

None

class dootle.actions.postbox.GetPostAction

Read data from the inter-task postbox of a task tree. ‘args’ pop a value from the calling tasks root (ie: no UUIDs) box into that key name ‘kwargs’ are read literally

stateKey=”group::task.sub..{subbox}” eg: {do=’post.get’, args=[“first”, “second”, “third”], data=”bib::format..-“}

abstractmethod _get_from_task_box(spec, state, args) dict
Return type:

dict

_get_from_target_boxes(
spec,
state,
kwargs,
) dict[doot.util.dkey.DKey, list | dict]
Return type:

dict[doot.util.dkey.DKey, list | dict]

class dootle.actions.postbox.ClearPostAction

Clear your postbox

class dootle.actions.postbox.SummarizePostAction

print a summary of this task tree’s postbox The arguments of the action are held in self.spec