selinon.builtin_predicate module
Built-in predicates used as core building blocks to build predicates.
-
class
selinon.builtin_predicate.AlwaysTruePredicate(flow)[source]
Bases: selinon.builtin_predicate.BuiltinPredicate
Predicate used if condition in config file is omitted.
-
ast()[source]
Python AST of this predicate (construct transitively for all indirect children as well).
| Returns: | AST of describing all children predicates |
-
check()[source]
Check predicate for consistency.
-
static
create(tree, nodes_from, flow, can_inspect_results)[source]
Create the predicate.
| Parameters: |
- tree (List) – node from which should be predicate instantiated
- nodes_from (List[Nodes]) – nodes which are used within edge definition
- flow (Flow) – flow to which predicate belongs to
- can_inspect_results (bool) – True if predicates in the condition can query task result
|
| Returns: | Predicate instance
|
-
nodes_used()[source]
Compute all nodes that are used (transitively) by child/children.
| Returns: | list of nodes that are used |
| Return type: | List[Node] |
-
predicates_used()[source]
Compute all predicates that are used (transitively) by child/children.
| Returns: | used predicates by children |
| Return type: | List[Predicate] |
-
requires_message()[source]
Recursively check if one of the predicates require message from storage (result of previous task).
| Returns: | True if a result from storage is required |
-
class
selinon.builtin_predicate.AndPredicate(children)[source]
Bases: selinon.builtin_predicate.NaryPredicate
And predicate representation.
-
ast()[source]
Python AST of this predicate (construct transitively for all indirect children as well).
| Returns: | AST of describing all children predicates |
-
static
create(tree, nodes_from, flow, can_inspect_results)[source]
Create And predicate.
| Parameters: |
- tree (List) – node from which should be predicate instantiated
- nodes_from – nodes that are used in described edge
- flow (Flow) – flow to which predicate belongs to
- can_inspect_results (bool) – True if predicates in the condition can query task result
|
| Returns: | instance of cls
|
-
class
selinon.builtin_predicate.BuiltinPredicate[source]
Bases: selinon.predicate.Predicate
Build in predicate abstract class.
-
class
selinon.builtin_predicate.NaryPredicate(children)[source]
Bases: selinon.builtin_predicate.BuiltinPredicate
N-ary predicate abstract class.
-
check()[source]
Check predicate for consistency.
-
nodes_used()[source]
Compute nodes that are used (transitively).
| Returns: | list of nodes that are used |
| Return type: | List[Node] |
-
predicates_used()[source]
Compute predicates that are used (transitively).
| Returns: | used predicates by children |
-
requires_message()[source]
Check whether any of child predicates requires results of nodes.
| Returns: | True if any of the children require results of parent task |
-
class
selinon.builtin_predicate.NotPredicate(child)[source]
Bases: selinon.builtin_predicate.UnaryPredicate
Unary or predicate representation.
-
ast()[source]
Python AST of this predicate (construct transitively for all indirect children as well).
| Returns: | AST of describing all children predicates |
-
static
create(tree, nodes_from, flow, can_inspect_results)[source]
Create Or predicate.
| Parameters: |
- tree (List) – node from which should be predicate instantiated
- nodes_from – nodes that are used in described edge
- flow (Flow) – flow to which predicate belongs to
- can_inspect_results (bool) – True if predicates in the condition can query task result
|
| Returns: | instance of cls
|
-
class
selinon.builtin_predicate.OrPredicate(children)[source]
Bases: selinon.builtin_predicate.NaryPredicate
And predicate representation.
-
ast()[source]
Python AST of this predicate (construct transitively for all indirect children as well).
| Returns: | AST of describing all children predicates |
-
static
create(tree, nodes_from, flow, can_inspect_results)[source]
Create Or predicate.
| Parameters: |
- tree (List) – node from which should be predicate instantiated
- nodes_from – nodes that are used in described edge
- flow (Flow) – flow to which predicate belongs to
- can_inspect_results (bool) – True if predicates in the condition can query task result
|
| Returns: | instance of cls
|
-
class
selinon.builtin_predicate.UnaryPredicate(child)[source]
Bases: selinon.builtin_predicate.BuiltinPredicate
Unary predicate abstract class.
-
check()[source]
Check predicate for consistency.
-
nodes_used()[source]
Compute all nodes that are used (transitively) by child/children.
| Returns: | list of nodes that are used |
| Return type: | List[Node] |
-
predicates_used()[source]
Compute all predicates that are used (transitively) by child/children.
| Returns: | used predicates by children |
-
requires_message()[source]
Check whether any of child predicate(s) requires results of nodes (transitively).
| Returns: | True if the child requires results of parent task |