Standard Destinations#
This module provides basic destinations.
- class FromHistory(**data)[source]#
Bases:
BaseDestination
Return label of the node located at a certain position in the label history.
- position: int#
Position of the label in label history.
Should be negative:
-1
refers to the current node (same asctx.last_label
);-2
– to the previous node.
- class Current(**data)[source]#
Bases:
FromHistory
Return label of the current node.
- position: int#
Position is set to
-1
to get the last node.
- class Previous(**data)[source]#
Bases:
FromHistory
Return label of the previous node.
- position: int#
Position is set to
-2
to get the second to last node.
- class Start(**data)[source]#
Bases:
BaseDestination
Return
start_label
.
- class Fallback(**data)[source]#
Bases:
BaseDestination
Return
fallback_label
.
- get_next_node_in_flow(node_label, ctx, *, increment=True, loop=False)[source]#
Function that returns node label of a node in the same flow after shifting the index.
- Parameters:
node_label (
AbsoluteNodeLabel
) – Label of the node to shift from.ctx (
Context
) – Dialog context.increment (
bool
) – If it is True, label index is incremented by 1, otherwise it is decreased by 1.loop (
bool
) – If it is True the iteration over the label list is going cyclically (i.e. Backward in the first node returns the last node).
- Return type:
- Returns:
The tuple that consists of (flow_label, label, priority). If fallback is executed (flow_fallback_label, fallback_label, priority) are returned.
- class Forward(**data)[source]#
Bases:
BaseDestination
Return the next node relative to the current node in the current flow.
- loop: bool#
Whether to return the first node of the flow if the current node is the last one. Otherwise and exception is raised (and transition is considered unsuccessful).
- class Backward(**data)[source]#
Bases:
BaseDestination
Return the previous node relative to the current node in the current flow.
- loop: bool#
Whether to return the last node of the flow if the current node is the first one. Otherwise and exception is raised (and transition is considered unsuccessful).