Standard Conditions#
This module provides basic conditions.
HasText
,Regexp
,HasCallbackQuery
are last-request-based conditions.CheckLastLabels
is a label-based condition.
- class ExactMatch(match, *, skip_none=True)[source]#
Bases:
BaseCondition
Check if
last_request
matchesmatch
.If
skip_none
, will not compareNone
fields ofmatch
.-
match:
Message
# Message to compare last request with.
Is initialized according to
MessageInitTypes
.
-
match:
- class HasText(text)[source]#
Bases:
BaseCondition
Check if the
text
attribute oflast_request
containstext
.-
text:
str
# Text to search for in the last request.
-
text:
- class Regexp(pattern, *, flags=0)[source]#
Bases:
BaseCondition
Check if the
text
attribute oflast_request
containspattern
.-
pattern:
Union
[str
,Pattern
]# The RegExp pattern to search for in the last request.
-
flags:
Union
[int
,RegexFlag
]# Flags to pass to
re.compile
.
- property re_object: Pattern#
Compiled pattern.
-
pattern:
- class Any(*conditions)[source]#
Bases:
BaseCondition
Check if any condition from the
conditions
list is True.-
conditions:
List
[BaseCondition
]# List of conditions.
-
conditions:
- class All(*conditions)[source]#
Bases:
BaseCondition
Check if all conditions from the
conditions
list is True.-
conditions:
List
[BaseCondition
]# List of conditions.
-
conditions:
- class Negation(condition)[source]#
Bases:
BaseCondition
Return the negation of the result of
condition
.-
condition:
BaseCondition
# Condition to negate.
-
condition:
- class CheckLastLabels(*, flow_labels=None, labels=None, last_n_indices=1)[source]#
Bases:
BaseCondition
Check if any label in the last
last_n_indices
ofContext.labels
is inlabels
or if itsflow_name
is inflow_labels
.-
flow_labels:
List
[str
]# List of flow names to find in the last labels.
-
labels:
List
[AbsoluteNodeLabel
]# List of labels to find in the last labels.
Is initialized according to
AbsoluteNodeLabelInitTypes
.
-
last_n_indices:
int
# Number of labels to check.
-
flow_labels:
- class HasCallbackQuery(query_string)[source]#
Bases:
BaseCondition
Check if
last_request
contains aCallbackQuery
attachment withCallbackQuery.query_string
matchingHasCallbackQuery.query_string
.-
query_string:
str
# Query string to find in last request’s attachments.
-
query_string: