transform¶
Generic AST transformation classes.
comparison |
Transformation utilities for STIX pattern comparison expressions. |
observation |
Transformation utilities for STIX pattern observation expressions. |
specials |
Some simple comparison expression normalization functions. |
-
class
ChainTransformer
(*transformers)¶ A composite transformer which consists of a sequence of sub-transformers. Applying this transformer applies all sub-transformers in sequence, as a group.
-
transform
(ast)¶ Transform the given AST and return the resulting AST.
Parameters: ast – The AST to transform Returns: A 2-tuple: the transformed AST and a boolean indicating whether the transformation actually changed anything. The change detection is useful in situations where a transformation needs to be repeated until the AST stops changing.
-
-
class
SettleTransformer
(transform)¶ A transformer that repeatedly performs a transformation until that transformation no longer changes the AST. I.e. the AST has “settled”.
-
transform
(ast)¶ Transform the given AST and return the resulting AST.
Parameters: ast – The AST to transform Returns: A 2-tuple: the transformed AST and a boolean indicating whether the transformation actually changed anything. The change detection is useful in situations where a transformation needs to be repeated until the AST stops changing.
-
-
class
Transformer
¶ Base class for AST transformers.
-
transform
(ast)¶ Transform the given AST and return the resulting AST.
Parameters: ast – The AST to transform Returns: A 2-tuple: the transformed AST and a boolean indicating whether the transformation actually changed anything. The change detection is useful in situations where a transformation needs to be repeated until the AST stops changing.
-