PyDecisionGraph 0.3.2.post1__cp315-cp315-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- decision_graph/__infra__.pxd +1 -0
- decision_graph/__init__.pxd +1 -0
- decision_graph/__init__.py +39 -0
- decision_graph/decision_tree/__init__.pxd +2 -0
- decision_graph/decision_tree/__init__.py +85 -0
- decision_graph/decision_tree/bake/__infra__.pxd +502 -0
- decision_graph/decision_tree/bake/__init__.pxd +502 -0
- decision_graph/decision_tree/bake/__init__.py +29 -0
- decision_graph/decision_tree/bake/c_action.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/bake/c_action.h +324 -0
- decision_graph/decision_tree/bake/c_action.pxd +54 -0
- decision_graph/decision_tree/bake/c_action.pyi +126 -0
- decision_graph/decision_tree/bake/c_action.pyx +65 -0
- decision_graph/decision_tree/bake/c_allocator_protocol.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/bake/c_allocator_protocol.pxd +24 -0
- decision_graph/decision_tree/bake/c_allocator_protocol.pyi +61 -0
- decision_graph/decision_tree/bake/c_allocator_protocol.pyx +109 -0
- decision_graph/decision_tree/bake/c_bake.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/bake/c_bake.h +629 -0
- decision_graph/decision_tree/bake/c_bake.pxd +52 -0
- decision_graph/decision_tree/bake/c_bake.pyi +151 -0
- decision_graph/decision_tree/bake/c_bake.pyx +142 -0
- decision_graph/decision_tree/bake/c_collections.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/bake/c_collections.h +692 -0
- decision_graph/decision_tree/bake/c_collections.pxd +52 -0
- decision_graph/decision_tree/bake/c_collections.pyi +193 -0
- decision_graph/decision_tree/bake/c_collections.pyx +161 -0
- decision_graph/decision_tree/bake/c_const.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/bake/c_const.h +395 -0
- decision_graph/decision_tree/bake/c_const.pxd +56 -0
- decision_graph/decision_tree/bake/c_const.pyi +305 -0
- decision_graph/decision_tree/bake/c_const.pyx +278 -0
- decision_graph/decision_tree/bake/c_edge.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/bake/c_edge.h +511 -0
- decision_graph/decision_tree/bake/c_edge.pxd +117 -0
- decision_graph/decision_tree/bake/c_edge.pyi +192 -0
- decision_graph/decision_tree/bake/c_edge.pyx +270 -0
- decision_graph/decision_tree/bake/c_eval.h +848 -0
- decision_graph/decision_tree/bake/c_eval.pxd +40 -0
- decision_graph/decision_tree/bake/c_expr.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/bake/c_expr.h +1900 -0
- decision_graph/decision_tree/bake/c_expr.pxd +129 -0
- decision_graph/decision_tree/bake/c_expr.pyi +280 -0
- decision_graph/decision_tree/bake/c_expr.pyx +272 -0
- decision_graph/decision_tree/bake/c_hierarchy.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/bake/c_hierarchy.h +731 -0
- decision_graph/decision_tree/bake/c_hierarchy.pxd +71 -0
- decision_graph/decision_tree/bake/c_hierarchy.pyi +409 -0
- decision_graph/decision_tree/bake/c_hierarchy.pyx +277 -0
- decision_graph/decision_tree/bake/c_logic_group.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/bake/c_logic_group.h +1226 -0
- decision_graph/decision_tree/bake/c_logic_group.pxd +162 -0
- decision_graph/decision_tree/bake/c_logic_group.pyi +264 -0
- decision_graph/decision_tree/bake/c_logic_group.pyx +308 -0
- decision_graph/decision_tree/bake/c_node.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/bake/c_node.h +2660 -0
- decision_graph/decision_tree/bake/c_node.pxd +381 -0
- decision_graph/decision_tree/bake/c_node.pyi +438 -0
- decision_graph/decision_tree/bake/c_node.pyx +639 -0
- decision_graph/decision_tree/bake/c_reconstruct.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/bake/c_reconstruct.pxd +63 -0
- decision_graph/decision_tree/bake/c_reconstruct.pyi +60 -0
- decision_graph/decision_tree/bake/c_reconstruct.pyx +252 -0
- decision_graph/decision_tree/bake/c_var.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/bake/c_var.h +2054 -0
- decision_graph/decision_tree/bake/c_var.pxd +205 -0
- decision_graph/decision_tree/bake/c_var.pyi +271 -0
- decision_graph/decision_tree/bake/c_var.pyx +228 -0
- decision_graph/decision_tree/capi/__infra__.pxd +33 -0
- decision_graph/decision_tree/capi/__init__.pxd +33 -0
- decision_graph/decision_tree/capi/__init__.py +57 -0
- decision_graph/decision_tree/capi/c_abc.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/capi/c_abc.pxd +246 -0
- decision_graph/decision_tree/capi/c_abc.pyi +770 -0
- decision_graph/decision_tree/capi/c_abc.pyx +1532 -0
- decision_graph/decision_tree/capi/c_collection.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/capi/c_collection.pxd +22 -0
- decision_graph/decision_tree/capi/c_collection.pyi +245 -0
- decision_graph/decision_tree/capi/c_collection.pyx +138 -0
- decision_graph/decision_tree/capi/c_node.cp315-win_amd64.pyd +0 -0
- decision_graph/decision_tree/capi/c_node.pxd +95 -0
- decision_graph/decision_tree/capi/c_node.pyi +492 -0
- decision_graph/decision_tree/capi/c_node.pyx +551 -0
- decision_graph/decision_tree/exc.py +189 -0
- decision_graph/decision_tree/native/__init__.py +57 -0
- decision_graph/decision_tree/native/abc.py +1167 -0
- decision_graph/decision_tree/native/collection.py +134 -0
- decision_graph/decision_tree/native/node.py +521 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_action.c +16320 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_action.h +324 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_allocator_protocol.c +12473 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_bake.c +16485 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_bake.h +629 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_collections.c +17381 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_collections.h +692 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_const.c +20815 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_const.h +395 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_edge.c +20696 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_edge.h +511 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_eval.h +848 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_expr.c +22065 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_expr.h +1900 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_hierarchy.c +23267 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_hierarchy.h +731 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_logic_group.c +22434 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_logic_group.h +1226 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_node.c +28385 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_node.h +2660 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_reconstruct.c +15955 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_var.c +16881 -0
- decision_graph/includes/decision_graph/decision_tree/bake/c_var.h +2054 -0
- decision_graph/includes/decision_graph/decision_tree/capi/c_abc.c +59196 -0
- decision_graph/includes/decision_graph/decision_tree/capi/c_collection.c +19967 -0
- decision_graph/includes/decision_graph/decision_tree/capi/c_node.c +39229 -0
- decision_graph/logic_group/__init__.py +25 -0
- decision_graph/logic_group/base.py +100 -0
- decision_graph/logic_group/pending_request.py +384 -0
- decision_graph/webui/__init__.py +24 -0
- decision_graph/webui/bake/__init__.py +65 -0
- decision_graph/webui/bake/app.py +488 -0
- decision_graph/webui/bake/static/d3.v7.min.js +2 -0
- decision_graph/webui/bake/static/script.js +1440 -0
- decision_graph/webui/bake/static/style.css +920 -0
- decision_graph/webui/bake/templates/index.html +183 -0
- decision_graph/webui/bake/templates/offline.html +184 -0
- decision_graph/webui/capi/__init__.py +54 -0
- decision_graph/webui/capi/app.py +366 -0
- decision_graph/webui/capi/main.py +53 -0
- decision_graph/webui/capi/static/d3.v7.min.js +2 -0
- decision_graph/webui/capi/static/script.js +1026 -0
- decision_graph/webui/capi/static/style.css +656 -0
- decision_graph/webui/capi/templates/index.html +93 -0
- decision_graph/webui/capi/templates/offline.html +94 -0
- decision_graph/webui/native/__init__.py +54 -0
- decision_graph/webui/native/app.py +366 -0
- decision_graph/webui/native/main.py +53 -0
- decision_graph/webui/native/static/d3.v7.min.js +2 -0
- decision_graph/webui/native/static/script.js +1026 -0
- decision_graph/webui/native/static/style.css +656 -0
- decision_graph/webui/native/templates/index.html +93 -0
- decision_graph/webui/native/templates/offline.html +94 -0
- pydecisiongraph-0.3.2.post1.dist-info/METADATA +136 -0
- pydecisiongraph-0.3.2.post1.dist-info/RECORD +148 -0
- pydecisiongraph-0.3.2.post1.dist-info/WHEEL +5 -0
- pydecisiongraph-0.3.2.post1.dist-info/licenses/LICENSE +373 -0
- pydecisiongraph-0.3.2.post1.dist-info/top_level.txt +2 -0
- tests/bake_c_evaluator.cp315-win_amd64.pyd +0 -0
- tests/bake_eval_probe.cp315-win_amd64.pyd +0 -0
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
from libc.stdint cimport uint32_t, uint64_t, uintptr_t
|
|
2
|
+
from libc.stdio cimport FILE
|
|
3
|
+
from libcpp cimport bool as c_bool
|
|
4
|
+
|
|
5
|
+
from cbase.allocator_protocol cimport allocator_protocol
|
|
6
|
+
from cbase.bytemap cimport BoundByteMap, bytemap
|
|
7
|
+
|
|
8
|
+
from .c_edge cimport dcg_node_edge_condition, NodeEdgeCondition
|
|
9
|
+
from .c_var cimport dcg_ret_code, dcg_var_t
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
cdef extern from "decision_graph/decision_tree/bake/c_node.h":
|
|
13
|
+
const int DCG_NODE_STRING_MAXLEN
|
|
14
|
+
const int DCG_NODE_RENDER_MAX_DEPTH
|
|
15
|
+
const char* DCG_DEF_REPR_NOACTION
|
|
16
|
+
|
|
17
|
+
ctypedef enum dcg_node_type:
|
|
18
|
+
DCG_NODE_INPUT
|
|
19
|
+
DCG_NODE_TRUE
|
|
20
|
+
DCG_NODE_FALSE
|
|
21
|
+
DCG_NODE_DOUBLE
|
|
22
|
+
DCG_NODE_STRING
|
|
23
|
+
DCG_NODE_INT
|
|
24
|
+
DCG_NODE_VARIABLE
|
|
25
|
+
DCG_NODE_OP
|
|
26
|
+
DCG_NODE_UNARY
|
|
27
|
+
DCG_NODE_BINARY
|
|
28
|
+
DCG_NODE_TERNARY
|
|
29
|
+
DCG_NODE_CALL
|
|
30
|
+
DCG_NODE_ACTION
|
|
31
|
+
DCG_NODE_NOACTION
|
|
32
|
+
DCG_NODE_LONGACTION
|
|
33
|
+
DCG_NODE_SHORTACTION
|
|
34
|
+
DCG_NODE_CANCELACTION
|
|
35
|
+
DCG_NODE_CLEARACTION
|
|
36
|
+
DCG_NODE_PLACEHOLDER
|
|
37
|
+
DCG_NODE_SPECIAL
|
|
38
|
+
DCG_NODE_ROOT
|
|
39
|
+
DCG_NODE_BREAKPOINT
|
|
40
|
+
|
|
41
|
+
ctypedef enum dcg_node_mask:
|
|
42
|
+
DCG_NODE_FAMILY_MASK
|
|
43
|
+
DCG_NODE_VARIANT_MASK
|
|
44
|
+
|
|
45
|
+
ctypedef enum dcg_node_flag:
|
|
46
|
+
DCG_NODE_FLAG_NONE
|
|
47
|
+
DCG_NODE_FLAG_FROZEN
|
|
48
|
+
DCG_NODE_FLAG_VISITED
|
|
49
|
+
DCG_NODE_FLAG_PRUNED
|
|
50
|
+
|
|
51
|
+
ctypedef struct dcg_node_label:
|
|
52
|
+
const char* label
|
|
53
|
+
c_bool owned
|
|
54
|
+
dcg_node_label* next
|
|
55
|
+
|
|
56
|
+
ctypedef enum dcg_eval_flag:
|
|
57
|
+
DCG_EVAL_FLAG_NONE
|
|
58
|
+
DCG_EVAL_FLAG_SKIP_CHILDREN
|
|
59
|
+
DCG_EVAL_FLAG_CACHED
|
|
60
|
+
DCG_EVAL_FLAG_BREAKPOINT
|
|
61
|
+
DCG_EVAL_FLAG_TRACE
|
|
62
|
+
|
|
63
|
+
ctypedef enum dcg_eval_stage:
|
|
64
|
+
DCG_EVAL_STAGE_NONE
|
|
65
|
+
DCG_EVAL_STAGE_PRE_EVAL
|
|
66
|
+
DCG_EVAL_STAGE_EVAL
|
|
67
|
+
DCG_EVAL_STAGE_POST_EVAL
|
|
68
|
+
DCG_EVAL_STAGE_DONE
|
|
69
|
+
DCG_EVAL_STAGE_HOOK
|
|
70
|
+
DCG_EVAL_STAGE_TYPE_RULE
|
|
71
|
+
DCG_EVAL_STAGE_BUILTIN
|
|
72
|
+
|
|
73
|
+
ctypedef enum dcg_node_hook_type:
|
|
74
|
+
DCG_HOOK_PRE_EVAL
|
|
75
|
+
DCG_HOOK_EVAL
|
|
76
|
+
DCG_HOOK_POST_EVAL
|
|
77
|
+
|
|
78
|
+
ctypedef int (*dcg_node_hook_fn)(dcg_node* node, void* user_data) noexcept
|
|
79
|
+
|
|
80
|
+
ctypedef struct dcg_node_eval_ctx:
|
|
81
|
+
dcg_node_hook_fn pre_eval_fn
|
|
82
|
+
dcg_node_hook_fn eval_fn
|
|
83
|
+
dcg_node_hook_fn post_eval_fn
|
|
84
|
+
dcg_node_hook_fn type_eval_fn
|
|
85
|
+
void* user_data
|
|
86
|
+
void* run
|
|
87
|
+
uint64_t flags
|
|
88
|
+
dcg_ret_code err_code
|
|
89
|
+
dcg_eval_stage stage
|
|
90
|
+
uint64_t eval_seq_id
|
|
91
|
+
size_t depth
|
|
92
|
+
size_t visits
|
|
93
|
+
|
|
94
|
+
ctypedef enum dcg_node_event:
|
|
95
|
+
DCG_NODE_EVENT_CHILD_ADDED
|
|
96
|
+
DCG_NODE_EVENT_CHILD_UPDATED
|
|
97
|
+
DCG_NODE_EVENT_CHILD_REMOVED
|
|
98
|
+
DCG_NODE_EVENT_CHILD_CLEARED
|
|
99
|
+
DCG_NODE_EVENT_MODIFIED
|
|
100
|
+
DCG_NODE_EVENT_EVALUATED
|
|
101
|
+
|
|
102
|
+
ctypedef void (*dcg_node_callback_fn)(dcg_node_event event, dcg_node* self, dcg_node* subject, uint64_t seq_id, void* user_data) noexcept
|
|
103
|
+
|
|
104
|
+
ctypedef struct dcg_node_callback_ctx:
|
|
105
|
+
dcg_node_callback_fn fn
|
|
106
|
+
void* user_data
|
|
107
|
+
uintptr_t id
|
|
108
|
+
dcg_node_callback_ctx* next
|
|
109
|
+
|
|
110
|
+
ctypedef unsigned char uuid_t[16]
|
|
111
|
+
|
|
112
|
+
ctypedef struct dcg_node_ctx_ops:
|
|
113
|
+
int (*enter_fn)(dcg_node* node, dcg_logic_group_manager* mgr)
|
|
114
|
+
int (*exit_fn)(dcg_node* node, dcg_logic_group_manager* mgr)
|
|
115
|
+
|
|
116
|
+
ctypedef struct dcg_node:
|
|
117
|
+
dcg_node_eval_ctx eval_ctx
|
|
118
|
+
dcg_node_ctx_ops ctx_ops
|
|
119
|
+
dcg_var_t out
|
|
120
|
+
dcg_node_type ntype
|
|
121
|
+
const char* repr
|
|
122
|
+
uuid_t uid
|
|
123
|
+
dcg_node_label* labels
|
|
124
|
+
c_bool autogen
|
|
125
|
+
uint32_t flags
|
|
126
|
+
void* user_payload
|
|
127
|
+
dcg_node_callback_ctx* callbacks
|
|
128
|
+
const dcg_node_edge_condition* condition_to_parent
|
|
129
|
+
dcg_node* parent
|
|
130
|
+
dcg_node* children
|
|
131
|
+
dcg_node* next_sibling
|
|
132
|
+
dcg_node* prev_sibling
|
|
133
|
+
|
|
134
|
+
ctypedef struct dcg_validate_report:
|
|
135
|
+
dcg_ret_code code
|
|
136
|
+
dcg_node* node
|
|
137
|
+
size_t errors
|
|
138
|
+
size_t warnings
|
|
139
|
+
size_t nodes
|
|
140
|
+
size_t depth
|
|
141
|
+
|
|
142
|
+
ctypedef enum dcg_render_style:
|
|
143
|
+
DCG_RENDER_ASCII
|
|
144
|
+
DCG_RENDER_UNICODE
|
|
145
|
+
|
|
146
|
+
ctypedef struct dcg_render_opts:
|
|
147
|
+
dcg_render_style style
|
|
148
|
+
size_t max_depth
|
|
149
|
+
c_bool show_uid
|
|
150
|
+
c_bool show_labels
|
|
151
|
+
c_bool show_condition
|
|
152
|
+
c_bool show_out
|
|
153
|
+
c_bool show_flags
|
|
154
|
+
c_bool show_hooks
|
|
155
|
+
c_bool show_children
|
|
156
|
+
c_bool show_address
|
|
157
|
+
|
|
158
|
+
ctypedef struct dcg_strbuf:
|
|
159
|
+
char* data
|
|
160
|
+
size_t cap
|
|
161
|
+
size_t used
|
|
162
|
+
|
|
163
|
+
const char* c_dcg_node_type_name(dcg_node_type ntype) noexcept nogil
|
|
164
|
+
c_bool c_dcg_node_type_is_input(dcg_node_type ntype) noexcept nogil
|
|
165
|
+
c_bool c_dcg_node_type_is_op(dcg_node_type ntype) noexcept nogil
|
|
166
|
+
c_bool c_dcg_node_type_is_flat(dcg_node_type ntype) noexcept nogil
|
|
167
|
+
c_bool c_dcg_node_type_is_action(dcg_node_type ntype) noexcept nogil
|
|
168
|
+
c_bool c_dcg_node_type_is_special(dcg_node_type ntype) noexcept nogil
|
|
169
|
+
size_t c_dcg_node_type_arity(dcg_node_type ntype) noexcept nogil
|
|
170
|
+
uint64_t c_dcg_node_gen_seq_id(const void* ptr) noexcept nogil
|
|
171
|
+
void c_dcg_node_unlink(dcg_node* node) noexcept nogil
|
|
172
|
+
void c_dcg_node_adopt_condition(dcg_node* node, const dcg_node_edge_condition* condition) noexcept nogil
|
|
173
|
+
|
|
174
|
+
int c_dcg_node_init(dcg_node* node, dcg_node_type ntype, const char* repr) noexcept nogil
|
|
175
|
+
dcg_node* c_dcg_node_new(dcg_node_type ntype, const char* repr, allocator_protocol* allocator) noexcept nogil
|
|
176
|
+
void c_dcg_node_dealloc(dcg_node* node) noexcept nogil
|
|
177
|
+
void c_dcg_node_free(dcg_node* node) noexcept nogil
|
|
178
|
+
|
|
179
|
+
int c_dcg_node_set_repr(dcg_node* node, const char* repr) noexcept nogil
|
|
180
|
+
int c_dcg_node_set_string(dcg_node* node, const char* value) noexcept nogil
|
|
181
|
+
|
|
182
|
+
int c_dcg_node_register_eval_hook(dcg_node* node, dcg_node_hook_type hook, dcg_node_hook_fn fn, void* user_data) noexcept nogil
|
|
183
|
+
void c_dcg_node_unregister_eval_hooks(dcg_node* node) noexcept nogil
|
|
184
|
+
int c_dcg_node_register_callback(dcg_node* node, dcg_node_callback_fn fn, void* user_data, uintptr_t* out_id) noexcept nogil
|
|
185
|
+
int c_dcg_node_unregister_callback(dcg_node* node, uintptr_t callback_id) noexcept nogil
|
|
186
|
+
void c_dcg_node_invoke_callbacks(dcg_node* node, dcg_node_event event, dcg_node* subject, uint64_t seq_id) noexcept nogil
|
|
187
|
+
size_t c_dcg_node_callback_count(const dcg_node* node) noexcept nogil
|
|
188
|
+
|
|
189
|
+
int c_dcg_node_append(dcg_node* parent, dcg_node* child, const dcg_node_edge_condition* condition) noexcept nogil
|
|
190
|
+
int c_dcg_node_append_auto(dcg_node* parent, dcg_node* child) noexcept nogil
|
|
191
|
+
int c_dcg_node_append_at(dcg_node* parent, dcg_node* child, const dcg_node_edge_condition* condition, size_t index) noexcept nogil
|
|
192
|
+
int c_dcg_node_append_at_binary(dcg_node* parent, dcg_node* child, c_bool condition, size_t index) noexcept nogil
|
|
193
|
+
int c_dcg_node_detach(dcg_node* node) noexcept nogil
|
|
194
|
+
int c_dcg_node_replace(dcg_node* old_node, dcg_node* new_node) noexcept nogil
|
|
195
|
+
int c_dcg_node_replace_shared(dcg_node* old_node, dcg_node* new_node) noexcept nogil
|
|
196
|
+
dcg_node* c_dcg_node_new_placeholder(allocator_protocol* allocator) noexcept nogil
|
|
197
|
+
size_t c_dcg_node_consolidate_placeholder(dcg_node* node) noexcept nogil
|
|
198
|
+
dcg_node* c_dcg_node_get_placeholder(dcg_node* node) noexcept nogil
|
|
199
|
+
|
|
200
|
+
size_t c_dcg_node_child_count(const dcg_node* node) noexcept nogil
|
|
201
|
+
dcg_node* c_dcg_node_first_child(const dcg_node* node) noexcept nogil
|
|
202
|
+
dcg_node* c_dcg_node_last_child(const dcg_node* node) noexcept nogil
|
|
203
|
+
dcg_node* c_dcg_node_child_at(const dcg_node* node, size_t index) noexcept nogil
|
|
204
|
+
ssize_t c_dcg_node_child_index(const dcg_node* node) noexcept nogil
|
|
205
|
+
dcg_node* c_dcg_node_child_by_condition(const dcg_node* node, const dcg_node_edge_condition* condition) noexcept nogil
|
|
206
|
+
dcg_node* c_dcg_node_next_sibling(const dcg_node* node) noexcept nogil
|
|
207
|
+
dcg_node* c_dcg_node_prev_sibling(const dcg_node* node) noexcept nogil
|
|
208
|
+
dcg_node* c_dcg_node_root(dcg_node* node) noexcept nogil
|
|
209
|
+
size_t c_dcg_node_depth(const dcg_node* node) noexcept nogil
|
|
210
|
+
size_t c_dcg_node_height(const dcg_node* node) noexcept nogil
|
|
211
|
+
size_t c_dcg_node_subtree_size(const dcg_node* node) noexcept nogil
|
|
212
|
+
size_t c_dcg_node_leaf_count(const dcg_node* node) noexcept nogil
|
|
213
|
+
c_bool c_dcg_node_is_leaf(const dcg_node* node) noexcept nogil
|
|
214
|
+
c_bool c_dcg_node_is_root(const dcg_node* node) noexcept nogil
|
|
215
|
+
c_bool c_dcg_node_is_ancestor(const dcg_node* node, const dcg_node* descendant) noexcept nogil
|
|
216
|
+
dcg_node* c_dcg_node_find_by_uid(const dcg_node* root, const uuid_t uid) noexcept nogil
|
|
217
|
+
size_t c_dcg_node_collect_leaves(const dcg_node* root, dcg_node** out, size_t cap) noexcept nogil
|
|
218
|
+
size_t c_dcg_node_collect_descendants(const dcg_node* root, dcg_node** out, size_t cap) noexcept nogil
|
|
219
|
+
size_t c_dcg_node_path_to(const dcg_node* node, const dcg_node** out, size_t cap) noexcept nogil
|
|
220
|
+
|
|
221
|
+
int c_dcg_node_add_label(dcg_node* node, const char* label) noexcept nogil
|
|
222
|
+
c_bool c_dcg_node_has_label(const dcg_node* node, const char* label) noexcept nogil
|
|
223
|
+
int c_dcg_node_remove_label(dcg_node* node, const char* label) noexcept nogil
|
|
224
|
+
size_t c_dcg_node_label_count(const dcg_node* node) noexcept nogil
|
|
225
|
+
|
|
226
|
+
c_bool c_dcg_node_validate(const dcg_node* root, dcg_validate_report* report) noexcept nogil
|
|
227
|
+
int c_dcg_node_validate_print(const dcg_node* root, FILE* stream) noexcept nogil
|
|
228
|
+
|
|
229
|
+
void c_dcg_render_opts_default(dcg_render_opts* opts) noexcept nogil
|
|
230
|
+
int c_dcg_node_render(const dcg_node* node, FILE* stream, const dcg_render_opts* opts) noexcept nogil
|
|
231
|
+
int c_dcg_node_print(const dcg_node* node) noexcept nogil
|
|
232
|
+
int c_dcg_node_render_to_string(const dcg_node* node, char* out, size_t cap, const dcg_render_opts* opts) noexcept nogil
|
|
233
|
+
void c_dcg_node_arm_uuid(dcg_node* node) noexcept nogil
|
|
234
|
+
int c_dcg_node_format_uid(const uuid_t uid, char* out, size_t cap) noexcept nogil
|
|
235
|
+
uint64_t c_dcg_node_getpid() noexcept nogil
|
|
236
|
+
void c_dcg_sb_init(dcg_strbuf* buf, char* data, size_t cap) noexcept nogil
|
|
237
|
+
void c_dcg_sb_puts(dcg_strbuf* buf, const char* text) noexcept nogil
|
|
238
|
+
void c_dcg_sb_printf(dcg_strbuf* buf, const char* fmt, ...) noexcept nogil
|
|
239
|
+
const dcg_node_edge_condition* c_dcg_node_infer_condition(const dcg_node* parent) noexcept nogil
|
|
240
|
+
int c_dcg_node_link(dcg_node* parent, dcg_node* child, const dcg_node_edge_condition* condition, dcg_node* anchor) noexcept nogil
|
|
241
|
+
void c_dcg_validate_fail(dcg_validate_report* report, dcg_node* node, dcg_ret_code err, c_bool* valid) noexcept nogil
|
|
242
|
+
c_bool c_dcg_node_validate_walk(const dcg_node* node, dcg_validate_report* report, size_t depth) noexcept nogil
|
|
243
|
+
int c_dcg_node_format_flags(uint32_t flags, char* out, size_t cap) noexcept nogil
|
|
244
|
+
int c_dcg_node_format_line(const dcg_node* node, char* out, size_t cap, const dcg_render_opts* opts) noexcept nogil
|
|
245
|
+
int c_dcg_node_render_walk(const dcg_node* node, FILE* stream, const dcg_render_opts* opts, const char* prefix, c_bool is_last, size_t depth) noexcept nogil
|
|
246
|
+
size_t c_dcg_node_collect_leaves_walk(const dcg_node* node, dcg_node** out, size_t cap, size_t* written) noexcept nogil
|
|
247
|
+
size_t c_dcg_node_collect_descendants_walk(const dcg_node* node, dcg_node** out, size_t cap, size_t* written) noexcept nogil
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
cdef extern from "decision_graph/decision_tree/bake/c_hierarchy.h":
|
|
251
|
+
void c_dcg_node_free_generic(dcg_node* node) noexcept nogil
|
|
252
|
+
|
|
253
|
+
ctypedef struct dcg_node_eval_path:
|
|
254
|
+
dcg_node** node
|
|
255
|
+
dcg_var_t* eval_val
|
|
256
|
+
size_t capacity
|
|
257
|
+
size_t n_nodes
|
|
258
|
+
dcg_ret_code code
|
|
259
|
+
dcg_node* leaf
|
|
260
|
+
dcg_node* failed
|
|
261
|
+
uint64_t seq_id
|
|
262
|
+
|
|
263
|
+
ctypedef struct dcg_root_node:
|
|
264
|
+
dcg_node base
|
|
265
|
+
dcg_node_eval_path eval_path
|
|
266
|
+
c_bool inherit_contexts
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
cdef extern from "decision_graph/decision_tree/bake/c_eval.h":
|
|
270
|
+
ctypedef struct dcg_eval_run:
|
|
271
|
+
uint64_t seq_id
|
|
272
|
+
dcg_ret_code code
|
|
273
|
+
dcg_node* failed
|
|
274
|
+
dcg_node* leaf
|
|
275
|
+
size_t visited
|
|
276
|
+
size_t depth
|
|
277
|
+
c_bool inplace
|
|
278
|
+
|
|
279
|
+
int c_dcg_node_eval(dcg_node* node) noexcept nogil
|
|
280
|
+
int c_dcg_node_dryrun(dcg_node* node, dcg_var_t* out) noexcept nogil
|
|
281
|
+
int c_dcg_node_eval_graph(dcg_node* node, dcg_node_eval_path* path) noexcept nogil
|
|
282
|
+
int c_dcg_root_node_eval(dcg_root_node* root) noexcept nogil
|
|
283
|
+
|
|
284
|
+
dcg_node_eval_path* c_dcg_node_eval_path_new(size_t capacity, allocator_protocol* allocator) noexcept nogil
|
|
285
|
+
void c_dcg_node_eval_path_free(dcg_node_eval_path* path) noexcept nogil
|
|
286
|
+
int c_dcg_root_node_eval_path_reserve(dcg_root_node* root, size_t capacity) noexcept nogil
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
cdef extern from "decision_graph/decision_tree/bake/c_logic_group.h":
|
|
290
|
+
ctypedef struct dcg_logic_group_manager:
|
|
291
|
+
pass
|
|
292
|
+
|
|
293
|
+
int c_dcg_lgm_enter_node(dcg_logic_group_manager* mgr, dcg_node* node) noexcept nogil
|
|
294
|
+
int c_dcg_lgm_exit_node(dcg_logic_group_manager* mgr, dcg_node* node) noexcept nogil
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
cdef enum dcg_eval_override_flag:
|
|
298
|
+
DCG_EVAL_CDEF_OVERRIDE = 1 << 0 # The Cython hook (c_pre_eval, ...) is overridden.
|
|
299
|
+
DCG_EVAL_PY_OVERRIDE = 1 << 3 # The Python hook (pre_eval, ...) is overridden.
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
cdef class LogicNode:
|
|
303
|
+
cdef dcg_node* header
|
|
304
|
+
cdef bint owner
|
|
305
|
+
cdef uintptr_t callback_id
|
|
306
|
+
cdef uint32_t eval_hook_flags
|
|
307
|
+
cdef object c_eval_exception
|
|
308
|
+
|
|
309
|
+
cdef readonly LogicNode parent
|
|
310
|
+
cdef readonly dict children
|
|
311
|
+
cdef readonly NodeEdgeCondition condition_to_parent
|
|
312
|
+
|
|
313
|
+
@staticmethod
|
|
314
|
+
cdef inline LogicNode c_from_header(dcg_node* header, bint owner=?)
|
|
315
|
+
|
|
316
|
+
@staticmethod
|
|
317
|
+
cdef inline dcg_logic_group_manager* c_get_manager()
|
|
318
|
+
|
|
319
|
+
@staticmethod
|
|
320
|
+
cdef LogicNode c_dcg_node_reconstruct(dcg_node* header, bint owner=?)
|
|
321
|
+
|
|
322
|
+
@staticmethod
|
|
323
|
+
cdef void c_node_callback_event_adaptor(dcg_node_event event, dcg_node* node, dcg_node* subject, uint64_t seq_id, void* user_data) noexcept
|
|
324
|
+
|
|
325
|
+
@staticmethod
|
|
326
|
+
cdef inline int c_pre_eval_callback_adaptor(dcg_node* node, void* user_data) noexcept
|
|
327
|
+
|
|
328
|
+
@staticmethod
|
|
329
|
+
cdef inline int c_eval_fn_callback_adaptor(dcg_node* node, void* user_data) noexcept
|
|
330
|
+
|
|
331
|
+
@staticmethod
|
|
332
|
+
cdef inline int c_post_eval_callback_adaptor(dcg_node* node, void* user_data) noexcept
|
|
333
|
+
|
|
334
|
+
cdef inline void c_register_node(self)
|
|
335
|
+
|
|
336
|
+
cdef int c_pre_eval_fn(self)
|
|
337
|
+
|
|
338
|
+
cdef int c_eval_fn(self)
|
|
339
|
+
|
|
340
|
+
cdef int c_post_eval_fn(self)
|
|
341
|
+
|
|
342
|
+
cdef void c_bind_eval_callback(self)
|
|
343
|
+
|
|
344
|
+
@staticmethod
|
|
345
|
+
cdef list c_eval_stage_name_list(dcg_eval_stage stage)
|
|
346
|
+
|
|
347
|
+
@staticmethod
|
|
348
|
+
cdef str c_eval_stage_names(dcg_eval_stage stage)
|
|
349
|
+
|
|
350
|
+
@staticmethod
|
|
351
|
+
cdef str c_eval_failed_stage_name(dcg_eval_stage stage)
|
|
352
|
+
|
|
353
|
+
@staticmethod
|
|
354
|
+
cdef str c_eval_source_name(dcg_eval_stage stage)
|
|
355
|
+
|
|
356
|
+
cdef void c_check_eval_code(self, int ret_code, dcg_node* subject=?)
|
|
357
|
+
|
|
358
|
+
cdef void c_append(self, dcg_node* child, dcg_node_edge_condition* condition)
|
|
359
|
+
|
|
360
|
+
cdef void c_replace(self, dcg_node* old_node, dcg_node* new_node)
|
|
361
|
+
|
|
362
|
+
cdef void c_detach(self)
|
|
363
|
+
|
|
364
|
+
cdef str c_render(self, int max_depth, bint show_labels, bint show_out, str style)
|
|
365
|
+
|
|
366
|
+
cdef void c_eval(self)
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
cdef class PlaceholderNode(LogicNode):
|
|
370
|
+
pass
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
cdef class LogicNodeRegistry(BoundByteMap):
|
|
374
|
+
cdef void* _ws_key_buf
|
|
375
|
+
|
|
376
|
+
@staticmethod
|
|
377
|
+
cdef LogicNodeRegistry c_from_header(bytemap* header, bint owner=?)
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
cdef dcg_logic_group_manager* C_LGM
|
|
381
|
+
cdef LogicNodeRegistry NODE_REGISTRY
|