analyze
async_btree.analyze
Analyze definition.
Attributes
Classes
Node
Bases: NamedTuple
Resolved snapshot of a behaviour tree node, produced by analyze().
Holds the display name, resolved property values, and resolved child edges for a single node in the abstract tree.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
display name of the node. |
properties |
list[tuple[str, Any]]
|
resolved |
edges |
list[tuple[str, list[Any]]]
|
resolved |
Source code in async_btree/analyze.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
Functions
__str__()
Return the stringified tree representation of this node.
Source code in async_btree/analyze.py
34 35 36 | |
Functions
analyze(target)
Analyze target and return a Node representation of its subtree.
Works with any callable (sync or async). If target has __node_metadata,
its declared properties and edges are resolved from closure variables. Otherwise,
all closure variables are included as properties with no edges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
CallableFunction
|
callable to analyze. |
required |
Returns:
| Type | Description |
|---|---|
Node
|
resolved node tree rooted at |
Source code in async_btree/analyze.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
stringify_analyze(target, indent=0, label=None)
Stringify a Node tree into a human-readable indented representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
Node
|
node to stringify. |
required |
indent
|
int
|
current indentation level (default 0). |
0
|
label
|
Optional[str]
|
edge label to prefix the node with (default |
None
|
Returns:
| Type | Description |
|---|---|
str
|
indented string representation of the node tree. |
Source code in async_btree/analyze.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |