intxeger package¶
IntXeger is a Python library for generating strings from regular expressions.
-
intxeger.
build
(regex: str, use_optimization: bool = True, max_repeat: int = 10) → intxeger.core.base.Node[source]¶ Parse the regex and return the root node.
This parses the regex into an internal tree structure and returns the root node; the root node can then be used to generate samples.
- Parameters
regex – The regular expression string.
use_optimization – Whether to apply the optimization routine.
max_repeat – The maximum number of repeats when using the zero-or-more (
*
) or one-or-more (+
) operators in the regex.
- Returns
The root node of the tree.
Subpackages¶
Submodules¶
intxeger.intxeger module¶
-
intxeger.intxeger.
build
(regex: str, use_optimization: bool = True, max_repeat: int = 10) → intxeger.core.base.Node[source]¶ Parse the regex and return the root node.
This parses the regex into an internal tree structure and returns the root node; the root node can then be used to generate samples.
- Parameters
regex – The regular expression string.
use_optimization – Whether to apply the optimization routine.
max_repeat – The maximum number of repeats when using the zero-or-more (
*
) or one-or-more (+
) operators in the regex.
- Returns
The root node of the tree.
intxeger.optimize module¶
-
intxeger.optimize.
optimize
(node: intxeger.core.base.Node, level=10)[source]¶ Traverse the tree return an optimized copy.
This traverses the tree and applies transforms which are designed to improve the sampling speed. Examples of transforms include removing unnecessary operations, flattening small nodes, and more.
- Parameters
node – The root node.
level – The optimization level (higher = more optimization loops).
- Returns
The root node of the optimized tree.