finesse.script.graph module
Graph represening a parsed kat script file.
- class finesse.script.graph.KatGraph(*args, backend=None, **kwargs)[source]
Bases:
DiGraphKat script graph.
- argument(argument_node, adapter)[source]
Get argument corresponding to node argument_node.
This returns the argument object for a syntax graph node. It is useful for retrieving the names for positional arguments during parsing, but works for keyword arguments too.
Returns
BoundArgumentThe argument specified in the script corresponding to argument_node.
Raises
- TypeError
When argument_node corresponds to a positional argument that doesn’t exist in the setter signature defined in adapter.
- argument_node_order(node)[source]
Get the order attribute of the edge linking argument node to its parent.
- classmethod branch_base(path, reference)[source]
The branch base node name for path, relative to reference.
- dependent_arguments_edge_data(parent, data)[source]
Get mapping of dependent argument nodes to the value of the data attribute on the edge connecting them to parent.
- is_independent(node)[source]
Check if the node has no external dependencies.
A node is independent if it is a terminal type or if its arguments have no non- argument incoming edges.
- merge(other)[source]
Merge other graph into this graph, rewriting paths in other if there are name collisions.
Merging two identical graphs kat –> kat.0 –> kat.0.1, the result would be:
kat --> kat.0 --> kat.0.1 --> kat.1 --> kat.1.1
Notes
self and other must be trees (
is_tree()returns True).
- class finesse.script.graph.KatNodeType(*values)[source]
Bases:
Flag- ARRAY = 32
- COMPILER_TERMINAL_NODES = 1152
- CONSTANT = 512
- DEPENDENT_NODES = 256
- DIRECTIVE_NODES = 6
- ELEMENT = 2
- EXPRESSION = 8
- FUNCTION = 4
- GENERATOR_TERMINAL_NODES = 1920
- GROUPED_EXPRESSION = 16
- KEYWORD = 1024
- NUMERICAL_ARRAY = 64
- REFERENCE = 256
- ROOT = 1
- VALUE = 128