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.
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.cp315-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.cp315-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.cp315-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.cp315-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.cp315-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.cp315-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.cp315-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.cp315-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.cp315-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.cp315-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.cp315-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.cp315-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.cp315-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.cp315-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.cp315-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.cp315-win_amd64.pyd +0 -0
  148. tests/bake_eval_probe.cp315-win_amd64.pyd +0 -0
@@ -0,0 +1,492 @@
1
+ import enum
2
+ from collections.abc import Callable
3
+ from typing import Any, final, Generic, TypeVar
4
+
5
+ from .c_abc import LogicNode, LogicGroup, NodeEdgeCondition, BreakpointNode
6
+ from ..exc import NO_DEFAULT
7
+
8
+ UNARY_OP_FUNC = Callable[[Any], Any]
9
+ BINARY_OP_FUNC = Callable[[Any, Any], Any]
10
+ T = TypeVar('T')
11
+
12
+
13
+ class NodeEvalPath(list[LogicNode], Generic[T]):
14
+ def to_clipboard(self) -> str:
15
+ """Copy the evaluation path to the system clipboard as text.
16
+
17
+ Generates a json representation of the evaluation path and copies it to the clipboard for easy sharing or logging.
18
+ ``pyperclip`` module required.
19
+
20
+ Returns:
21
+ The generated text representation of the evaluation path.
22
+
23
+ Raises:
24
+ PyperclipException: If copying to clipboard fails.
25
+ """
26
+
27
+
28
+ class RootLogicNode(LogicNode):
29
+ """Entry point node for a decision graph.
30
+
31
+ This node acts as the root container for a single child node and
32
+ largely delegates evaluation and rendering to that child. It enforces
33
+ that at most one child may be appended.
34
+
35
+ Apart from a normal LogicNode, the RootLogicNode:
36
+ - contains only 1 child node, with NO_CONDITION.
37
+ - always returns True for `c_entry_check()`.
38
+ - automatically shelve and unshelve contexts entering/exiting.
39
+ - automatically triggers inspection mode on entering and restore to previous mode on exit.
40
+
41
+ With these features, the RootLogicNode is designed as the Root node of a decision tree.
42
+
43
+ Attributes:
44
+ inherit_contexts: Whether to inherit outer logic groups when entered.
45
+ eval_path: List of nodes evaluated during the last evaluation. In cython interface this is a reflected copy, In python interface this is the actual list.
46
+ """
47
+ inherit_contexts: bool
48
+ eval_path: NodeEvalPath[LogicNode]
49
+
50
+ def __init__(self, name: str = 'Entry Point', inherit_contexts: bool = False, **kwargs) -> None:
51
+ """Create a RootLogicNode.
52
+
53
+ The constructor automatically passes the kwargs to underlying base classes. If any kwargs are provided, it can mess up the normal initializing process. It is recommended to not provide any kwargs and leave as is.
54
+
55
+ Example:
56
+
57
+ >>> with RootLogicNode() as root:
58
+ ... with LogicNode() as child:
59
+ ... ...
60
+ ... # There should not be a second node appended to root
61
+
62
+ Args:
63
+ name: Optional name for the root node.
64
+ **kwargs: Implementation-specific options.
65
+ """
66
+
67
+ @final
68
+ def __enter__(self) -> RootLogicNode:
69
+ """Enter context manager for the root node, to build a new decision graph in a seperated context.
70
+
71
+ On entering:
72
+ 0. The RootLogicNode itself will be appended to active node stack.
73
+ 1. Then the LGM will be shelved to preserve outer contexts.
74
+ 2. With ``inherit_contexts`` flags, the outer LogicGroup contexts will be inherited.
75
+ 3. After shelfing, a fresh LGM will be provided, with only this RootLogicNode activated.
76
+
77
+ Then on exiting, the LGM will be restored to previous state.
78
+
79
+ The __enter__ method is not overridden actually, only the internal c hook function.
80
+
81
+ Returns:
82
+ The RootLogicNode instance.
83
+ """
84
+
85
+ def dry_run(self) -> None:
86
+ """Perform a dry run evaluation of the decision tree without executing actions.
87
+
88
+ This method traverses the decision tree starting from the root node,
89
+ evaluating conditions and logging the evaluation path without
90
+ executing any actions associated with the nodes.
91
+
92
+ Raises:
93
+ ExpressEvaluationError: If an error occurs during evaluation.
94
+ """
95
+
96
+ def get_breakpoint(self) -> BreakpointNode | None:
97
+ """Get dangling breakpoint node attached to the root, if any.
98
+ Returns:
99
+ BreakpointNode if exists, else None.
100
+ """
101
+
102
+ def append(self, child: LogicNode, condition: NodeEdgeCondition = NO_DEFAULT) -> None:
103
+ """Append a child node to the root.
104
+
105
+ Args:
106
+ child: The child logic node to append.
107
+ condition: Edge condition associated with the child (ignored for
108
+ the root; defaults to None).
109
+
110
+ Raises:
111
+ TooManyChildren: If a child is already attached to the root.
112
+ """
113
+
114
+ def to_html(self, file_name: str | None = None, with_eval: bool = True) -> None:
115
+ """Render the decision tree to an HTML file.
116
+
117
+ This method generates a standalone HTML file visualizing the
118
+ decision tree structure starting from this root node. If
119
+ ``with_eval`` is True, the evaluation results are also included
120
+ in the rendering.
121
+
122
+ Args:
123
+ file_name: Output HTML file name; when omitted, the file is named
124
+ after the root's ``repr``.
125
+ with_eval: Whether to include evaluation results in the rendering.
126
+ """
127
+
128
+ def show(self, **kwargs):
129
+ """Render and display the decision tree in a interactive web page.
130
+ This method generates an interactive visualization of the decision
131
+ tree structure starting from this root node. Additional keyword
132
+ arguments are passed to the underlying rendering flask engine.
133
+
134
+ Arguments:
135
+ **kwargs: keyword arguments passed into ``decision_graph.webui.capi.show`` method.
136
+ """
137
+
138
+ def watch(self, **kwargs):
139
+ """Continuously monitor and update the decision tree visualization in a web page.
140
+
141
+ This method sets up a live monitoring session where the decision
142
+ tree structure and evaluation results are periodically refreshed
143
+ and displayed in an interactive web page.
144
+
145
+ Arguments:
146
+ **kwargs: keyword arguments passed into ``decision_graph.webui.capi.watch`` method.
147
+ """
148
+
149
+ @property
150
+ def child(self) -> LogicNode:
151
+ """Return the single child node attached to the root.
152
+
153
+ Raises:
154
+ TooFewChildren: If no child is attached to the root.
155
+ """
156
+ ...
157
+
158
+
159
+ class ContextLogicExpression(LogicNode):
160
+ """Base class for expressions that evaluate against a logic group/context.
161
+
162
+ This class implements Python operator overloads so expressions can be
163
+ composed using normal Python syntax (e.g. a + b, a > b, a & b).
164
+
165
+ Attributes:
166
+ logic_group: The LogicGroup used as the evaluation context.
167
+ """
168
+
169
+ logic_group: LogicGroup
170
+ repr: str
171
+
172
+ def __init__(self, *, logic_group: LogicGroup = None, **kwargs) -> None:
173
+ """Create a context-aware expression.
174
+
175
+ If ``logic_group`` is omitted the current active logic group is used.
176
+
177
+ Args:
178
+ logic_group: Optional logic group or mapping providing contexts.
179
+ **kwargs: Implementation-specific keyword arguments.
180
+ """
181
+
182
+ # Mapping / attribute access
183
+ def __getitem__(self, key: str) -> AttrExpression:
184
+ """Return an attribute expression representing ``logic_group[key]``.
185
+
186
+ Args:
187
+ key: Attribute/key name.
188
+
189
+ Returns:
190
+ AttrExpression: Expression representing the attribute access.
191
+ """
192
+
193
+ def __getattr__(self, key: str) -> AttrExpression:
194
+ """Return an attribute expression representing ``logic_group.key``.
195
+
196
+ Args:
197
+ key: Attribute name.
198
+
199
+ Returns:
200
+ AttrExpression: Expression representing the attribute access.
201
+ """
202
+
203
+ # Arithmetic operators produce MathExpression
204
+ def __add__(self, other: Any) -> MathExpression: ...
205
+
206
+ def __sub__(self, other: Any) -> MathExpression: ...
207
+
208
+ def __mul__(self, other: Any) -> MathExpression: ...
209
+
210
+ def __truediv__(self, other: Any) -> MathExpression: ...
211
+
212
+ def __floordiv__(self, other: Any) -> MathExpression: ...
213
+
214
+ def __pow__(self, other: Any) -> MathExpression: ...
215
+
216
+ def __neg__(self) -> MathExpression: ...
217
+
218
+ # Comparison operators produce ComparisonExpression
219
+ def __eq__(self, other: Any) -> ComparisonExpression: ...
220
+
221
+ def __ne__(self, other: Any) -> ComparisonExpression: ...
222
+
223
+ def __gt__(self, other: Any) -> ComparisonExpression: ...
224
+
225
+ def __ge__(self, other: Any) -> ComparisonExpression: ...
226
+
227
+ def __lt__(self, other: Any) -> ComparisonExpression: ...
228
+
229
+ def __le__(self, other: Any) -> ComparisonExpression: ...
230
+
231
+ # Logical operators produce LogicalExpression
232
+ def __and__(self, other: Any) -> LogicalExpression: ...
233
+
234
+ def __or__(self, other: Any) -> LogicalExpression: ...
235
+
236
+ def __invert__(self) -> LogicalExpression: ...
237
+
238
+
239
+ class AttrExpression(ContextLogicExpression):
240
+ """Expression representing a single attribute from the logic context.
241
+
242
+ Attributes:
243
+ attr: The attribute name referred to by the expression.
244
+ """
245
+
246
+ attr: str
247
+
248
+ def __init__(self, *, attr: str, repr: str = None, **kwargs) -> None:
249
+ """Create an attribute expression.
250
+
251
+ The constructor automatically passes the kwargs to underlying base classes, if any.
252
+ See ``ContextLogicExpression`` and ``LogicNode`` for more details.
253
+
254
+ Args:
255
+ attr: Attribute name or list of nested attribute names.
256
+ repr: Optional textual representation override.
257
+ """
258
+
259
+ def __getitem__(self, key: str) -> AttrNestedExpression: ...
260
+
261
+ def __getattr__(self, key: str) -> AttrNestedExpression: ...
262
+
263
+
264
+ class AttrNestedExpression(ContextLogicExpression):
265
+ """Expression representing nested attribute access (a.b.c).
266
+
267
+ Attributes:
268
+ attrs: list of attribute path components in access order.
269
+ """
270
+
271
+ attrs: list[str]
272
+
273
+ def __init__(self, *, attrs: list[str], repr: str = None, **kwargs) -> None:
274
+ """Create a nested attribute expression.
275
+
276
+ The constructor automatically passes the kwargs to underlying base classes, if any.
277
+ See ``ContextLogicExpression`` and ``LogicNode`` for more details.
278
+
279
+ Args:
280
+ attrs: Sequence of attribute names describing the path.
281
+ """
282
+
283
+ def __getitem__(self, key: str) -> AttrNestedExpression: ...
284
+
285
+ def __getattr__(self, key: str) -> AttrNestedExpression: ...
286
+
287
+
288
+ class GetterExpression(ContextLogicExpression):
289
+ """Expression representing a single key/index access from the logic context.
290
+
291
+ Attributes:
292
+ key: The key/index referred to by the expression.
293
+ """
294
+
295
+ key: Any
296
+
297
+ def __init__(self, *, key: Any, repr: str = None, **kwargs) -> None:
298
+ """Create a getter expression.
299
+
300
+ The constructor automatically passes the kwargs to underlying base classes, if any.
301
+ See ``ContextLogicExpression`` and ``LogicNode`` for more details.
302
+
303
+ Args:
304
+ key: Key/index or list of nested keys/indexes.
305
+ repr: Optional textual representation override.
306
+ """
307
+
308
+ def __getitem__(self, key: Any) -> GetterNestedExpression: ...
309
+
310
+
311
+ class GetterNestedExpression(ContextLogicExpression):
312
+ """Expression representing nested key/index access (a[b][c]).
313
+
314
+ Attributes:
315
+ keys: list of keys/indexes in access order.
316
+ """
317
+
318
+ keys: list[Any]
319
+
320
+ def __init__(self, *, keys: list[Any], repr: str = None, **kwargs) -> None:
321
+ """Create a nested getter expression.
322
+
323
+ The constructor automatically passes the kwargs to underlying base classes, if any.
324
+ See ``ContextLogicExpression`` and ``LogicNode`` for more details.
325
+
326
+ Args:
327
+ keys: Sequence of keys/indexes describing the access path.
328
+ """
329
+
330
+ def __getitem__(self, key: Any) -> GetterNestedExpression: ...
331
+
332
+
333
+ class MathExpressionOperator(enum.StrEnum):
334
+ """A pseudo-enum class representing mathematical operators for MathExpression."""
335
+
336
+ add: MathExpressionOperator
337
+ sub: MathExpressionOperator
338
+ mul: MathExpressionOperator
339
+ truediv: MathExpressionOperator
340
+ floordiv: MathExpressionOperator
341
+ pow: MathExpressionOperator
342
+ neg: MathExpressionOperator
343
+
344
+ def to_func(self) -> UNARY_OP_FUNC | BINARY_OP_FUNC: ...
345
+
346
+ @classmethod
347
+ def from_str(cls, op_str: str) -> MathExpressionOperator: ...
348
+
349
+
350
+ class MathExpression(ContextLogicExpression):
351
+ """Expression representing an arithmetic operation.
352
+
353
+ Attributes:
354
+ left: Left operand (expression or literal).
355
+ right: Right operand or sentinel when unary.
356
+ dtype: Resulting data type (defaults to float).
357
+ op_name: Internal operator name.
358
+ op_repr: Human-readable operator symbol or function name.
359
+ """
360
+
361
+ left: Any
362
+ right: Any
363
+ op_name: str
364
+ op_repr: str
365
+
366
+ def __init__(
367
+ self,
368
+ *,
369
+ left: Any,
370
+ op: str | MathExpressionOperator | UNARY_OP_FUNC | BINARY_OP_FUNC,
371
+ right: Any = NO_DEFAULT,
372
+ **kwargs
373
+ ) -> None:
374
+ """Create a MathExpression.
375
+
376
+ The constructor automatically passes the kwargs to underlying base classes, if any.
377
+ - `repr` is automatically generated based on the operator and operands, unless overridden via kwargs.
378
+ - `dtype` defaults to float unless specified in kwargs.
379
+
380
+ Args:
381
+ left: Left operand, can be an expression or a literal.
382
+ op: Operator specifier (operator object, string, or callable).
383
+ right: Right operand or omitted for unary operators.
384
+ op_name: Optional operator name override.
385
+ op_repr: Optional operator symbol override.
386
+ """
387
+
388
+
389
+ class ComparisonExpressionOperator(enum.StrEnum):
390
+ """A pseudo-enum class representing comparison operators for ComparisonExpression."""
391
+
392
+ eq: ComparisonExpressionOperator
393
+ ne: ComparisonExpressionOperator
394
+ gt: ComparisonExpressionOperator
395
+ ge: ComparisonExpressionOperator
396
+ lt: ComparisonExpressionOperator
397
+ le: ComparisonExpressionOperator
398
+
399
+ def to_func(self) -> BINARY_OP_FUNC: ...
400
+
401
+ @classmethod
402
+ def from_str(cls, op_str: str) -> ComparisonExpressionOperator: ...
403
+
404
+ @property
405
+ def int_enum(self) -> int: ...
406
+
407
+
408
+ class ComparisonExpression(ContextLogicExpression):
409
+ """Expression representing a comparison operation, returning only boolean result."""
410
+
411
+ left: Any
412
+ right: Any
413
+ op_name: str
414
+ op_repr: str
415
+
416
+ def __init__(
417
+ self,
418
+ *,
419
+ left: Any,
420
+ op: Any,
421
+ right: Any,
422
+ **kwargs
423
+ ) -> None:
424
+ """Create a ComparisonExpression.
425
+
426
+ The constructor automatically passes the kwargs to underlying base classes, if any.
427
+ - 'repr' is automatically generated based on the operator and operands, unless overridden via kwargs.
428
+ - 'dtype' defaults to bool unless specified in kwargs.
429
+
430
+ Args:
431
+ left: Left operand.
432
+ op: Operator specifier (operator object, string, or callable).
433
+ right: Right operand.
434
+ op_name: Optional operator name override.
435
+ op_repr: Optional operator symbol override.
436
+ """
437
+
438
+
439
+ class LogicalExpressionOperator(enum.StrEnum):
440
+ """Pseudo-enum class representing logical operators for LogicalExpression."""
441
+
442
+ and_: LogicalExpressionOperator
443
+ or_: LogicalExpressionOperator
444
+ not_: LogicalExpressionOperator
445
+
446
+ def to_func(self) -> UNARY_OP_FUNC | BINARY_OP_FUNC: ...
447
+
448
+ @classmethod
449
+ def from_str(cls, op_str: str) -> LogicalExpressionOperator: ...
450
+
451
+ @property
452
+ def int_enum(self) -> int: ...
453
+
454
+
455
+ class LogicalExpression(ContextLogicExpression):
456
+ """Expression representing boolean logic operations.
457
+
458
+ Attributes:
459
+ left: Left operand (expression or literal).
460
+ right: Right operand or sentinel for unary operations.
461
+ dtype: Resulting data type (bool).
462
+ op_name: Name of the logical operator.
463
+ op_repr: Operator symbol or representation.
464
+ repr: Human-readable representation of the expression.
465
+ """
466
+
467
+ left: Any
468
+ right: Any
469
+ op_name: str
470
+ op_repr: str
471
+
472
+ def __init__(
473
+ self,
474
+ *,
475
+ left: Any,
476
+ op: Any,
477
+ right: Any = NO_DEFAULT,
478
+ **kwargs
479
+ ) -> None:
480
+ """Create a LogicalExpression.
481
+
482
+ The constructor automatically passes the kwargs to underlying base classes, if any.
483
+ - 'repr' is automatically generated based on the operator and operands, unless overridden via kwargs.
484
+ - 'dtype' defaults to bool unless specified in kwargs.
485
+
486
+ Args:
487
+ left: Left operand.
488
+ op: Logical operator specifier (operator object, string, or callable).
489
+ right: Optional right operand for binary operators.
490
+ op_name: Optional operator name override.
491
+ op_repr: Optional operator symbol override.
492
+ """