selinon.predicate module¶
Predicate interface - predicate for building conditions.
-
class
selinon.predicate.
Predicate
[source]¶ Bases:
object
An abstract predicate representation.
-
ast
()[source]¶ Python AST of this predicate (construct transitively for all indirect children as well).
Returns: AST of describing all children predicates
-
check
()[source]¶ Recursively/transitively check predicate correctness.
Raises: ValueError – if predicate is not correct
-
static
construct
(tree, nodes_from, flow, can_inspect_results=True)[source]¶ Top-down creation of predicates - recursively called to construct predicates.
Parameters: Return type:
-
static
construct_condition_name
(flow_name, idx)[source]¶ Create condition name for a dump.
Parameters: Returns: condition function representation
-
static
construct_default
(flow)[source]¶ Construct default predicate for edge.
Parameters: flow (Flow) – flow to which predicate belongs to Return type: Predicate
-
static
construct_default_dict
()[source]¶ Construct default predicate definition as it would be written in the configuration file.
-
classmethod
create
(tree, nodes_from, flow, can_inspect_results)[source]¶ Create the predicate.
Parameters: 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]
-