PyDecisionGraph 0.3.2.post1__cp315-cp315t-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.
Files changed (148) hide show
  1. decision_graph/__infra__.pxd +1 -0
  2. decision_graph/__init__.pxd +1 -0
  3. decision_graph/__init__.py +39 -0
  4. decision_graph/decision_tree/__init__.pxd +2 -0
  5. decision_graph/decision_tree/__init__.py +85 -0
  6. decision_graph/decision_tree/bake/__infra__.pxd +502 -0
  7. decision_graph/decision_tree/bake/__init__.pxd +502 -0
  8. decision_graph/decision_tree/bake/__init__.py +29 -0
  9. decision_graph/decision_tree/bake/c_action.cp315t-win_amd64.pyd +0 -0
  10. decision_graph/decision_tree/bake/c_action.h +324 -0
  11. decision_graph/decision_tree/bake/c_action.pxd +54 -0
  12. decision_graph/decision_tree/bake/c_action.pyi +126 -0
  13. decision_graph/decision_tree/bake/c_action.pyx +65 -0
  14. decision_graph/decision_tree/bake/c_allocator_protocol.cp315t-win_amd64.pyd +0 -0
  15. decision_graph/decision_tree/bake/c_allocator_protocol.pxd +24 -0
  16. decision_graph/decision_tree/bake/c_allocator_protocol.pyi +61 -0
  17. decision_graph/decision_tree/bake/c_allocator_protocol.pyx +109 -0
  18. decision_graph/decision_tree/bake/c_bake.cp315t-win_amd64.pyd +0 -0
  19. decision_graph/decision_tree/bake/c_bake.h +629 -0
  20. decision_graph/decision_tree/bake/c_bake.pxd +52 -0
  21. decision_graph/decision_tree/bake/c_bake.pyi +151 -0
  22. decision_graph/decision_tree/bake/c_bake.pyx +142 -0
  23. decision_graph/decision_tree/bake/c_collections.cp315t-win_amd64.pyd +0 -0
  24. decision_graph/decision_tree/bake/c_collections.h +692 -0
  25. decision_graph/decision_tree/bake/c_collections.pxd +52 -0
  26. decision_graph/decision_tree/bake/c_collections.pyi +193 -0
  27. decision_graph/decision_tree/bake/c_collections.pyx +161 -0
  28. decision_graph/decision_tree/bake/c_const.cp315t-win_amd64.pyd +0 -0
  29. decision_graph/decision_tree/bake/c_const.h +395 -0
  30. decision_graph/decision_tree/bake/c_const.pxd +56 -0
  31. decision_graph/decision_tree/bake/c_const.pyi +305 -0
  32. decision_graph/decision_tree/bake/c_const.pyx +278 -0
  33. decision_graph/decision_tree/bake/c_edge.cp315t-win_amd64.pyd +0 -0
  34. decision_graph/decision_tree/bake/c_edge.h +511 -0
  35. decision_graph/decision_tree/bake/c_edge.pxd +117 -0
  36. decision_graph/decision_tree/bake/c_edge.pyi +192 -0
  37. decision_graph/decision_tree/bake/c_edge.pyx +270 -0
  38. decision_graph/decision_tree/bake/c_eval.h +848 -0
  39. decision_graph/decision_tree/bake/c_eval.pxd +40 -0
  40. decision_graph/decision_tree/bake/c_expr.cp315t-win_amd64.pyd +0 -0
  41. decision_graph/decision_tree/bake/c_expr.h +1900 -0
  42. decision_graph/decision_tree/bake/c_expr.pxd +129 -0
  43. decision_graph/decision_tree/bake/c_expr.pyi +280 -0
  44. decision_graph/decision_tree/bake/c_expr.pyx +272 -0
  45. decision_graph/decision_tree/bake/c_hierarchy.cp315t-win_amd64.pyd +0 -0
  46. decision_graph/decision_tree/bake/c_hierarchy.h +731 -0
  47. decision_graph/decision_tree/bake/c_hierarchy.pxd +71 -0
  48. decision_graph/decision_tree/bake/c_hierarchy.pyi +409 -0
  49. decision_graph/decision_tree/bake/c_hierarchy.pyx +277 -0
  50. decision_graph/decision_tree/bake/c_logic_group.cp315t-win_amd64.pyd +0 -0
  51. decision_graph/decision_tree/bake/c_logic_group.h +1226 -0
  52. decision_graph/decision_tree/bake/c_logic_group.pxd +162 -0
  53. decision_graph/decision_tree/bake/c_logic_group.pyi +264 -0
  54. decision_graph/decision_tree/bake/c_logic_group.pyx +308 -0
  55. decision_graph/decision_tree/bake/c_node.cp315t-win_amd64.pyd +0 -0
  56. decision_graph/decision_tree/bake/c_node.h +2660 -0
  57. decision_graph/decision_tree/bake/c_node.pxd +381 -0
  58. decision_graph/decision_tree/bake/c_node.pyi +438 -0
  59. decision_graph/decision_tree/bake/c_node.pyx +639 -0
  60. decision_graph/decision_tree/bake/c_reconstruct.cp315t-win_amd64.pyd +0 -0
  61. decision_graph/decision_tree/bake/c_reconstruct.pxd +63 -0
  62. decision_graph/decision_tree/bake/c_reconstruct.pyi +60 -0
  63. decision_graph/decision_tree/bake/c_reconstruct.pyx +252 -0
  64. decision_graph/decision_tree/bake/c_var.cp315t-win_amd64.pyd +0 -0
  65. decision_graph/decision_tree/bake/c_var.h +2054 -0
  66. decision_graph/decision_tree/bake/c_var.pxd +205 -0
  67. decision_graph/decision_tree/bake/c_var.pyi +271 -0
  68. decision_graph/decision_tree/bake/c_var.pyx +228 -0
  69. decision_graph/decision_tree/capi/__infra__.pxd +33 -0
  70. decision_graph/decision_tree/capi/__init__.pxd +33 -0
  71. decision_graph/decision_tree/capi/__init__.py +57 -0
  72. decision_graph/decision_tree/capi/c_abc.cp315t-win_amd64.pyd +0 -0
  73. decision_graph/decision_tree/capi/c_abc.pxd +246 -0
  74. decision_graph/decision_tree/capi/c_abc.pyi +770 -0
  75. decision_graph/decision_tree/capi/c_abc.pyx +1532 -0
  76. decision_graph/decision_tree/capi/c_collection.cp315t-win_amd64.pyd +0 -0
  77. decision_graph/decision_tree/capi/c_collection.pxd +22 -0
  78. decision_graph/decision_tree/capi/c_collection.pyi +245 -0
  79. decision_graph/decision_tree/capi/c_collection.pyx +138 -0
  80. decision_graph/decision_tree/capi/c_node.cp315t-win_amd64.pyd +0 -0
  81. decision_graph/decision_tree/capi/c_node.pxd +95 -0
  82. decision_graph/decision_tree/capi/c_node.pyi +492 -0
  83. decision_graph/decision_tree/capi/c_node.pyx +551 -0
  84. decision_graph/decision_tree/exc.py +189 -0
  85. decision_graph/decision_tree/native/__init__.py +57 -0
  86. decision_graph/decision_tree/native/abc.py +1167 -0
  87. decision_graph/decision_tree/native/collection.py +134 -0
  88. decision_graph/decision_tree/native/node.py +521 -0
  89. decision_graph/includes/decision_graph/decision_tree/bake/c_action.c +16320 -0
  90. decision_graph/includes/decision_graph/decision_tree/bake/c_action.h +324 -0
  91. decision_graph/includes/decision_graph/decision_tree/bake/c_allocator_protocol.c +12473 -0
  92. decision_graph/includes/decision_graph/decision_tree/bake/c_bake.c +16485 -0
  93. decision_graph/includes/decision_graph/decision_tree/bake/c_bake.h +629 -0
  94. decision_graph/includes/decision_graph/decision_tree/bake/c_collections.c +17381 -0
  95. decision_graph/includes/decision_graph/decision_tree/bake/c_collections.h +692 -0
  96. decision_graph/includes/decision_graph/decision_tree/bake/c_const.c +20815 -0
  97. decision_graph/includes/decision_graph/decision_tree/bake/c_const.h +395 -0
  98. decision_graph/includes/decision_graph/decision_tree/bake/c_edge.c +20696 -0
  99. decision_graph/includes/decision_graph/decision_tree/bake/c_edge.h +511 -0
  100. decision_graph/includes/decision_graph/decision_tree/bake/c_eval.h +848 -0
  101. decision_graph/includes/decision_graph/decision_tree/bake/c_expr.c +22065 -0
  102. decision_graph/includes/decision_graph/decision_tree/bake/c_expr.h +1900 -0
  103. decision_graph/includes/decision_graph/decision_tree/bake/c_hierarchy.c +23267 -0
  104. decision_graph/includes/decision_graph/decision_tree/bake/c_hierarchy.h +731 -0
  105. decision_graph/includes/decision_graph/decision_tree/bake/c_logic_group.c +22434 -0
  106. decision_graph/includes/decision_graph/decision_tree/bake/c_logic_group.h +1226 -0
  107. decision_graph/includes/decision_graph/decision_tree/bake/c_node.c +28385 -0
  108. decision_graph/includes/decision_graph/decision_tree/bake/c_node.h +2660 -0
  109. decision_graph/includes/decision_graph/decision_tree/bake/c_reconstruct.c +15955 -0
  110. decision_graph/includes/decision_graph/decision_tree/bake/c_var.c +16881 -0
  111. decision_graph/includes/decision_graph/decision_tree/bake/c_var.h +2054 -0
  112. decision_graph/includes/decision_graph/decision_tree/capi/c_abc.c +59196 -0
  113. decision_graph/includes/decision_graph/decision_tree/capi/c_collection.c +19967 -0
  114. decision_graph/includes/decision_graph/decision_tree/capi/c_node.c +39229 -0
  115. decision_graph/logic_group/__init__.py +25 -0
  116. decision_graph/logic_group/base.py +100 -0
  117. decision_graph/logic_group/pending_request.py +384 -0
  118. decision_graph/webui/__init__.py +24 -0
  119. decision_graph/webui/bake/__init__.py +65 -0
  120. decision_graph/webui/bake/app.py +488 -0
  121. decision_graph/webui/bake/static/d3.v7.min.js +2 -0
  122. decision_graph/webui/bake/static/script.js +1440 -0
  123. decision_graph/webui/bake/static/style.css +920 -0
  124. decision_graph/webui/bake/templates/index.html +183 -0
  125. decision_graph/webui/bake/templates/offline.html +184 -0
  126. decision_graph/webui/capi/__init__.py +54 -0
  127. decision_graph/webui/capi/app.py +366 -0
  128. decision_graph/webui/capi/main.py +53 -0
  129. decision_graph/webui/capi/static/d3.v7.min.js +2 -0
  130. decision_graph/webui/capi/static/script.js +1026 -0
  131. decision_graph/webui/capi/static/style.css +656 -0
  132. decision_graph/webui/capi/templates/index.html +93 -0
  133. decision_graph/webui/capi/templates/offline.html +94 -0
  134. decision_graph/webui/native/__init__.py +54 -0
  135. decision_graph/webui/native/app.py +366 -0
  136. decision_graph/webui/native/main.py +53 -0
  137. decision_graph/webui/native/static/d3.v7.min.js +2 -0
  138. decision_graph/webui/native/static/script.js +1026 -0
  139. decision_graph/webui/native/static/style.css +656 -0
  140. decision_graph/webui/native/templates/index.html +93 -0
  141. decision_graph/webui/native/templates/offline.html +94 -0
  142. pydecisiongraph-0.3.2.post1.dist-info/METADATA +136 -0
  143. pydecisiongraph-0.3.2.post1.dist-info/RECORD +148 -0
  144. pydecisiongraph-0.3.2.post1.dist-info/WHEEL +5 -0
  145. pydecisiongraph-0.3.2.post1.dist-info/licenses/LICENSE +373 -0
  146. pydecisiongraph-0.3.2.post1.dist-info/top_level.txt +2 -0
  147. tests/bake_c_evaluator.cp315t-win_amd64.pyd +0 -0
  148. tests/bake_eval_probe.cp315t-win_amd64.pyd +0 -0
@@ -0,0 +1,189 @@
1
+ __all__ = [
2
+ 'NO_DEFAULT',
3
+ 'EmptyBlock', 'BreakBlock',
4
+ 'NodeError', 'TooManyChildren', 'TooFewChildren', 'NodeNotFountError', 'NodeValueError', 'NodeTypeError', 'NodeContextError',
5
+ 'EdgeValueError',
6
+ 'EvalFailureError',
7
+ 'BakeFailureError',
8
+ 'ResolutionError', 'ExpressFalse', 'ExpressEvaluationError', 'ContextsNotFound'
9
+ ]
10
+
11
+ NO_DEFAULT = object()
12
+
13
+
14
+ class EmptyBlock(Exception):
15
+ """Raised when a SkippableContextBlock is empty."""
16
+ pass
17
+
18
+
19
+ class BreakBlock(Exception):
20
+ """Base exception for skipping a SkippableContextBlock. Internal use only."""
21
+ pass
22
+
23
+
24
+ class NodeError(Exception):
25
+ """Base exception for node-related errors."""
26
+ pass
27
+
28
+
29
+ class TooManyChildren(NodeError):
30
+ """Raised when a node has too many children or when trying to add a child node exceeding its limits, and other exception situations related to or caused by too many child nodes."""
31
+ pass
32
+
33
+
34
+ class TooFewChildren(NodeError):
35
+ """Raised when a node has too few children."""
36
+ pass
37
+
38
+
39
+ class NodeNotFountError(NodeError):
40
+ """Raised when a specified node cannot be found."""
41
+ pass
42
+
43
+
44
+ class NodeValueError(NodeError):
45
+ """Raised when a node has an invalid value."""
46
+ pass
47
+
48
+
49
+ class NodeTypeError(NodeError):
50
+ """Raised when a node has an invalid type."""
51
+ pass
52
+
53
+
54
+ class NodeContextError(NodeError):
55
+ """Raised when errors occur in the LogicNode context manager protocol."""
56
+ pass
57
+
58
+
59
+ class EdgeValueError(NodeError):
60
+ """Raised when a NodeEdgeCondition has an invalid value."""
61
+ pass
62
+
63
+
64
+ class EvalFailureError(RuntimeError, NodeError):
65
+ """Raised when a node cannot produce a value.
66
+
67
+ It is what an evaluation fails with, whichever door asked for it: one node's
68
+ ``eval``, a dry run, or a walk from a root. It answers the three questions a
69
+ caller has about a failure that a bare code cannot - WHICH node refused, at
70
+ which of the three stages, and what was running when it did (the built-in rule
71
+ for the node's type, the rule its type installed, or a hook somebody put
72
+ there).
73
+
74
+ A hook may raise it too, and with a ``code`` of its own: the node then ends
75
+ with that code rather than with the generic ``DCG_ERR_HOOK``, which is how a
76
+ Python hook says what went wrong the way a Cython hook says it by returning
77
+ the code. A hook that raises anything else ends the node with ``DCG_ERR_HOOK``
78
+ and has its own exception attached as ``__cause__`` - the failure is the
79
+ hook's to describe, and nothing here replaces the description with a code.
80
+
81
+ Attributes:
82
+ code: The ``DCG_ERR_*`` code the node ended with.
83
+ code_name: That code's stable name (``'MATH'``, ``'UNBOUND'``, ...).
84
+ node: The wrapper of the node that refused, when the layer has one.
85
+ node_type: The failing node's type name.
86
+ node_repr: Its display text.
87
+ address: The C block's address.
88
+ source: What was running: ``'builtin'``, ``'type_rule'``, ``'hook'``,
89
+ ``'pre_hook'``, ``'post_hook'``, or None.
90
+ failed_at: The stage that failed - ``'pre'``, ``'eval'`` or ``'post'``.
91
+ stages: The stages that completed, by name.
92
+ run_id: The run the failure happened in; 0 when it was not a run.
93
+ """
94
+
95
+ def __init__(
96
+ self,
97
+ message: str,
98
+ *,
99
+ code: int = 0,
100
+ code_name: str | None = None,
101
+ node: object = None,
102
+ node_type: str | None = None,
103
+ node_repr: str | None = None,
104
+ address: int | None = None,
105
+ source: str | None = None,
106
+ failed_at: str | None = None,
107
+ stages: tuple[str, ...] = (),
108
+ run_id: int = 0,
109
+ ) -> None:
110
+ """Initialize the failure.
111
+
112
+ Args:
113
+ message: What to say about it - the layer composes its own, naming the
114
+ node, the code and the stages.
115
+ code: The ``DCG_ERR_*`` code the node ended with. A hook raising this
116
+ gives the code it wants the node to end with.
117
+ code_name: That code's stable name.
118
+ node: The wrapper of the node that refused.
119
+ node_type: The failing node's type name.
120
+ node_repr: Its display text.
121
+ address: The C block's address.
122
+ source: What was running when it failed.
123
+ failed_at: The stage that failed.
124
+ stages: The stages that completed.
125
+ run_id: The run the failure happened in.
126
+ """
127
+ super().__init__(message)
128
+ self.code = code
129
+ self.code_name = code_name
130
+ self.node = node
131
+ self.node_type = node_type
132
+ self.node_repr = node_repr
133
+ self.address = address
134
+ self.source = source
135
+ self.failed_at = failed_at
136
+ self.stages = stages
137
+ self.run_id = run_id
138
+
139
+
140
+ class BakeFailureError(RuntimeError, NodeError):
141
+ """Raised when a graph cannot be baked.
142
+
143
+ A bake is the pass that makes a built graph ready to be walked: it verifies
144
+ what an evaluation assumes, locks what it verified, and prepares the record a
145
+ walk fills. What it refuses is a graph that is not walkable - an operand slot
146
+ with no component behind it, an operator the node's arity does not apply, a
147
+ node with no evaluation at all - and it refuses BEFORE anything is locked, so
148
+ the graph a failed bake leaves behind is exactly the graph it was handed.
149
+
150
+ The report travels with the failure rather than being replaced by the
151
+ exception: it says which node refused, with which code, how many problems the
152
+ pass found, and (since a failed bake changes nothing) that nothing was
153
+ locked, sealed or prepared.
154
+
155
+ Attributes:
156
+ report: The ``BakeReport`` the pass filled.
157
+ """
158
+
159
+ def __init__(self, message: str, *, report: object = None) -> None:
160
+ """Initialize the failure.
161
+
162
+ Args:
163
+ message: What to say about it - the layer composes its own, naming
164
+ the node that refused and the code it ended with.
165
+ report: The bake report, holding the code, the node that produced it,
166
+ the problems found and what the pass affected.
167
+ """
168
+ super().__init__(message)
169
+ self.report = report
170
+
171
+
172
+ class ResolutionError(NodeError):
173
+ """Raised when an error occurs during resolution."""
174
+ pass
175
+
176
+
177
+ class ExpressFalse(Exception):
178
+ """Custom exception raised when a LogicExpression evaluates to False."""
179
+ pass
180
+
181
+
182
+ class ExpressEvaluationError(Exception):
183
+ """Raised when an error occurs during the evaluation of a LogicExpression."""
184
+ pass
185
+
186
+
187
+ class ContextsNotFound(Exception):
188
+ """Raised when required contexts of ``LogicGroup`` are not found."""
189
+ pass
@@ -0,0 +1,57 @@
1
+ import logging
2
+
3
+ from .. import LOGGER
4
+
5
+ LOGGER = LOGGER.getChild('Native')
6
+
7
+ from .abc import (
8
+ Singleton,
9
+ NodeEdgeCondition, ConditionElse, ConditionAny, ConditionAuto, BinaryCondition, ConditionTrue, ConditionFalse,
10
+ NO_CONDITION, ELSE_CONDITION, AUTO_CONDITION, TRUE_CONDITION, FALSE_CONDITION,
11
+ SkipContextsBlock, LogicExpression, LogicNode,
12
+ LogicGroupManager, LGM, LogicGroup,
13
+ ActionNode, BreakpointNode, PlaceholderNode,
14
+ NoAction, LongAction, ShortAction, CancelAction
15
+ )
16
+
17
+ from .node import (
18
+ RootLogicNode, ContextLogicExpression,
19
+ AttrExpression, AttrNestedExpression,
20
+ GetterExpression, GetterNestedExpression,
21
+ MathExpressionOperator, MathExpression,
22
+ ComparisonExpressionOperator, ComparisonExpression,
23
+ LogicalExpressionOperator, LogicalExpression,
24
+ )
25
+
26
+ from .collection import (
27
+ LogicMapping,
28
+ LogicSequence,
29
+ LogicGenerator,
30
+ )
31
+
32
+
33
+ def set_logger(logger: logging.Logger):
34
+ global LOGGER
35
+ LOGGER = logger
36
+ abc.LOGGER = logger.getChild('abc')
37
+
38
+
39
+ __all__ = [
40
+ 'LOGGER', 'set_logger',
41
+ 'Singleton',
42
+ 'NodeEdgeCondition', 'ConditionElse', 'ConditionAny', 'ConditionAuto', 'BinaryCondition', 'ConditionTrue', 'ConditionFalse',
43
+ 'NO_CONDITION', 'ELSE_CONDITION', 'AUTO_CONDITION', 'TRUE_CONDITION', 'FALSE_CONDITION',
44
+ 'SkipContextsBlock', 'LogicExpression', 'LogicNode',
45
+ 'LogicGroupManager', 'LGM', 'LogicGroup',
46
+ 'ActionNode', 'BreakpointNode', 'PlaceholderNode',
47
+ 'NoAction', 'LongAction', 'ShortAction', 'CancelAction',
48
+
49
+ 'RootLogicNode', 'ContextLogicExpression',
50
+ 'AttrExpression', 'AttrNestedExpression',
51
+ 'GetterExpression', 'GetterNestedExpression',
52
+ 'MathExpressionOperator', 'MathExpression',
53
+ 'ComparisonExpressionOperator', 'ComparisonExpression',
54
+ 'LogicalExpressionOperator', 'LogicalExpression',
55
+
56
+ 'LogicMapping', 'LogicSequence', 'LogicGenerator'
57
+ ]