jijmodeling 0.13.2__cp39-cp39-win_amd64.whl → 1.11.0__cp39-cp39-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.

Potentially problematic release.


This version of jijmodeling might be problematic. Click here for more details.

Files changed (234) hide show
  1. jijmodeling/__init__.py +1 -154
  2. jijmodeling/__init__.pyi +5152 -0
  3. jijmodeling/_jijmodeling.cp39-win_amd64.pyd +0 -0
  4. jijmodeling/dataset.py +5 -0
  5. jijmodeling/dataset.pyi +106 -0
  6. jijmodeling/experimental.py +13 -0
  7. jijmodeling/experimental.pyi +302 -0
  8. jijmodeling/py.typed +0 -0
  9. jijmodeling/range/__init__.py +14 -0
  10. jijmodeling/range/__init__.pyi +56 -0
  11. jijmodeling/range/size.py +14 -0
  12. jijmodeling/range/size.pyi +54 -0
  13. jijmodeling/range/value.py +14 -0
  14. jijmodeling/range/value.pyi +54 -0
  15. jijmodeling-1.11.0.dist-info/METADATA +235 -0
  16. jijmodeling-1.11.0.dist-info/RECORD +18 -0
  17. {jijmodeling-0.13.2.dist-info → jijmodeling-1.11.0.dist-info}/WHEEL +1 -2
  18. {jijmodeling-0.13.2.dist-info → jijmodeling-1.11.0.dist-info/licenses}/LICENSE.txt +1 -1
  19. jijmodeling/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  20. jijmodeling/__pycache__/__init__.cpython-39.pyc +0 -0
  21. jijmodeling/__pycache__/_version.cpython-39.opt-1.pyc +0 -0
  22. jijmodeling/__pycache__/_version.cpython-39.pyc +0 -0
  23. jijmodeling/_version.py +0 -4
  24. jijmodeling/deprecation/__init__.py +0 -11
  25. jijmodeling/deprecation/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  26. jijmodeling/deprecation/__pycache__/__init__.cpython-39.pyc +0 -0
  27. jijmodeling/deprecation/__pycache__/deprecation.cpython-39.opt-1.pyc +0 -0
  28. jijmodeling/deprecation/__pycache__/deprecation.cpython-39.pyc +0 -0
  29. jijmodeling/deprecation/deprecation.py +0 -108
  30. jijmodeling/exceptions/__init__.py +0 -26
  31. jijmodeling/exceptions/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  32. jijmodeling/exceptions/__pycache__/__init__.cpython-39.pyc +0 -0
  33. jijmodeling/exceptions/__pycache__/exceptions.cpython-39.opt-1.pyc +0 -0
  34. jijmodeling/exceptions/__pycache__/exceptions.cpython-39.pyc +0 -0
  35. jijmodeling/exceptions/exceptions.py +0 -37
  36. jijmodeling/expression/__init__.py +0 -76
  37. jijmodeling/expression/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  38. jijmodeling/expression/__pycache__/__init__.cpython-39.pyc +0 -0
  39. jijmodeling/expression/__pycache__/condition.cpython-39.opt-1.pyc +0 -0
  40. jijmodeling/expression/__pycache__/condition.cpython-39.pyc +0 -0
  41. jijmodeling/expression/__pycache__/constraint.cpython-39.opt-1.pyc +0 -0
  42. jijmodeling/expression/__pycache__/constraint.cpython-39.pyc +0 -0
  43. jijmodeling/expression/__pycache__/expression.cpython-39.opt-1.pyc +0 -0
  44. jijmodeling/expression/__pycache__/expression.cpython-39.pyc +0 -0
  45. jijmodeling/expression/__pycache__/extract.cpython-39.opt-1.pyc +0 -0
  46. jijmodeling/expression/__pycache__/extract.cpython-39.pyc +0 -0
  47. jijmodeling/expression/__pycache__/from_old_serializable.cpython-39.opt-1.pyc +0 -0
  48. jijmodeling/expression/__pycache__/from_old_serializable.cpython-39.pyc +0 -0
  49. jijmodeling/expression/__pycache__/mathfunc.cpython-39.opt-1.pyc +0 -0
  50. jijmodeling/expression/__pycache__/mathfunc.cpython-39.pyc +0 -0
  51. jijmodeling/expression/__pycache__/prod.cpython-39.opt-1.pyc +0 -0
  52. jijmodeling/expression/__pycache__/prod.cpython-39.pyc +0 -0
  53. jijmodeling/expression/__pycache__/serializable.cpython-39.opt-1.pyc +0 -0
  54. jijmodeling/expression/__pycache__/serializable.cpython-39.pyc +0 -0
  55. jijmodeling/expression/__pycache__/sum.cpython-39.opt-1.pyc +0 -0
  56. jijmodeling/expression/__pycache__/sum.cpython-39.pyc +0 -0
  57. jijmodeling/expression/__pycache__/type_annotations.cpython-39.opt-1.pyc +0 -0
  58. jijmodeling/expression/__pycache__/type_annotations.cpython-39.pyc +0 -0
  59. jijmodeling/expression/__pycache__/utils.cpython-39.opt-1.pyc +0 -0
  60. jijmodeling/expression/__pycache__/utils.cpython-39.pyc +0 -0
  61. jijmodeling/expression/condition.py +0 -378
  62. jijmodeling/expression/constraint.py +0 -428
  63. jijmodeling/expression/expression.py +0 -768
  64. jijmodeling/expression/extract.py +0 -186
  65. jijmodeling/expression/from_old_serializable.py +0 -137
  66. jijmodeling/expression/mathfunc.py +0 -335
  67. jijmodeling/expression/prod.py +0 -172
  68. jijmodeling/expression/serializable.py +0 -142
  69. jijmodeling/expression/sum.py +0 -261
  70. jijmodeling/expression/type_annotations.py +0 -50
  71. jijmodeling/expression/utils.py +0 -202
  72. jijmodeling/expression/variables/__init__.py +0 -39
  73. jijmodeling/expression/variables/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  74. jijmodeling/expression/variables/__pycache__/__init__.cpython-39.pyc +0 -0
  75. jijmodeling/expression/variables/__pycache__/deci_vars.cpython-39.opt-1.pyc +0 -0
  76. jijmodeling/expression/variables/__pycache__/deci_vars.cpython-39.pyc +0 -0
  77. jijmodeling/expression/variables/__pycache__/jagged_array.cpython-39.opt-1.pyc +0 -0
  78. jijmodeling/expression/variables/__pycache__/jagged_array.cpython-39.pyc +0 -0
  79. jijmodeling/expression/variables/__pycache__/placeholders.cpython-39.opt-1.pyc +0 -0
  80. jijmodeling/expression/variables/__pycache__/placeholders.cpython-39.pyc +0 -0
  81. jijmodeling/expression/variables/__pycache__/variable.cpython-39.opt-1.pyc +0 -0
  82. jijmodeling/expression/variables/__pycache__/variable.cpython-39.pyc +0 -0
  83. jijmodeling/expression/variables/deci_vars.py +0 -212
  84. jijmodeling/expression/variables/jagged_array.py +0 -81
  85. jijmodeling/expression/variables/placeholders.py +0 -132
  86. jijmodeling/expression/variables/variable.py +0 -524
  87. jijmodeling/latex_repr/__init__.py +0 -11
  88. jijmodeling/latex_repr/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  89. jijmodeling/latex_repr/__pycache__/__init__.cpython-39.pyc +0 -0
  90. jijmodeling/latex_repr/__pycache__/latex_repr.cpython-39.opt-1.pyc +0 -0
  91. jijmodeling/latex_repr/__pycache__/latex_repr.cpython-39.pyc +0 -0
  92. jijmodeling/latex_repr/__pycache__/problem_latex_repr.cpython-39.opt-1.pyc +0 -0
  93. jijmodeling/latex_repr/__pycache__/problem_latex_repr.cpython-39.pyc +0 -0
  94. jijmodeling/latex_repr/latex_repr.py +0 -243
  95. jijmodeling/latex_repr/problem_latex_repr.py +0 -210
  96. jijmodeling/marker/__marker__.cp39-win_amd64.pyd +0 -0
  97. jijmodeling/match/__init__.py +0 -19
  98. jijmodeling/match/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  99. jijmodeling/match/__pycache__/__init__.cpython-39.pyc +0 -0
  100. jijmodeling/match/__pycache__/condition_same.cpython-39.opt-1.pyc +0 -0
  101. jijmodeling/match/__pycache__/condition_same.cpython-39.pyc +0 -0
  102. jijmodeling/match/__pycache__/constraint_same.cpython-39.opt-1.pyc +0 -0
  103. jijmodeling/match/__pycache__/constraint_same.cpython-39.pyc +0 -0
  104. jijmodeling/match/__pycache__/expand.cpython-39.opt-1.pyc +0 -0
  105. jijmodeling/match/__pycache__/expand.cpython-39.pyc +0 -0
  106. jijmodeling/match/__pycache__/expr_same.cpython-39.opt-1.pyc +0 -0
  107. jijmodeling/match/__pycache__/expr_same.cpython-39.pyc +0 -0
  108. jijmodeling/match/__pycache__/is_same_expr.cpython-39.opt-1.pyc +0 -0
  109. jijmodeling/match/__pycache__/is_same_expr.cpython-39.pyc +0 -0
  110. jijmodeling/match/__pycache__/penalty_same.cpython-39.opt-1.pyc +0 -0
  111. jijmodeling/match/__pycache__/penalty_same.cpython-39.pyc +0 -0
  112. jijmodeling/match/__pycache__/problem_same.cpython-39.opt-1.pyc +0 -0
  113. jijmodeling/match/__pycache__/problem_same.cpython-39.pyc +0 -0
  114. jijmodeling/match/__pycache__/replace.cpython-39.opt-1.pyc +0 -0
  115. jijmodeling/match/__pycache__/replace.cpython-39.pyc +0 -0
  116. jijmodeling/match/condition_same.py +0 -44
  117. jijmodeling/match/constraint_same.py +0 -53
  118. jijmodeling/match/expand.py +0 -84
  119. jijmodeling/match/expr_same.py +0 -32
  120. jijmodeling/match/is_same_expr.py +0 -306
  121. jijmodeling/match/penalty_same.py +0 -31
  122. jijmodeling/match/problem_same.py +0 -44
  123. jijmodeling/match/replace.py +0 -249
  124. jijmodeling/problem/__init__.py +0 -9
  125. jijmodeling/problem/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  126. jijmodeling/problem/__pycache__/__init__.cpython-39.pyc +0 -0
  127. jijmodeling/problem/__pycache__/problem.cpython-39.opt-1.pyc +0 -0
  128. jijmodeling/problem/__pycache__/problem.cpython-39.pyc +0 -0
  129. jijmodeling/problem/problem.py +0 -186
  130. jijmodeling/protobuf/__init__.py +0 -8
  131. jijmodeling/protobuf/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  132. jijmodeling/protobuf/__pycache__/__init__.cpython-39.pyc +0 -0
  133. jijmodeling/protobuf/__pycache__/from_protobuf.cpython-39.opt-1.pyc +0 -0
  134. jijmodeling/protobuf/__pycache__/from_protobuf.cpython-39.pyc +0 -0
  135. jijmodeling/protobuf/__pycache__/to_protobuf.cpython-39.opt-1.pyc +0 -0
  136. jijmodeling/protobuf/__pycache__/to_protobuf.cpython-39.pyc +0 -0
  137. jijmodeling/protobuf/__pycache__/type_annotations.cpython-39.opt-1.pyc +0 -0
  138. jijmodeling/protobuf/__pycache__/type_annotations.cpython-39.pyc +0 -0
  139. jijmodeling/protobuf/from_protobuf.py +0 -336
  140. jijmodeling/protobuf/pb2/__init__.py +0 -42
  141. jijmodeling/protobuf/pb2/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  142. jijmodeling/protobuf/pb2/__pycache__/__init__.cpython-39.pyc +0 -0
  143. jijmodeling/protobuf/pb2/__pycache__/array_length_pb2.cpython-39.opt-1.pyc +0 -0
  144. jijmodeling/protobuf/pb2/__pycache__/array_length_pb2.cpython-39.pyc +0 -0
  145. jijmodeling/protobuf/pb2/__pycache__/binary_op_pb2.cpython-39.opt-1.pyc +0 -0
  146. jijmodeling/protobuf/pb2/__pycache__/binary_op_pb2.cpython-39.pyc +0 -0
  147. jijmodeling/protobuf/pb2/__pycache__/commutative_op_pb2.cpython-39.opt-1.pyc +0 -0
  148. jijmodeling/protobuf/pb2/__pycache__/commutative_op_pb2.cpython-39.pyc +0 -0
  149. jijmodeling/protobuf/pb2/__pycache__/constraint_pb2.cpython-39.opt-1.pyc +0 -0
  150. jijmodeling/protobuf/pb2/__pycache__/constraint_pb2.cpython-39.pyc +0 -0
  151. jijmodeling/protobuf/pb2/__pycache__/custom_penalty_term_pb2.cpython-39.opt-1.pyc +0 -0
  152. jijmodeling/protobuf/pb2/__pycache__/custom_penalty_term_pb2.cpython-39.pyc +0 -0
  153. jijmodeling/protobuf/pb2/__pycache__/decision_var_pb2.cpython-39.opt-1.pyc +0 -0
  154. jijmodeling/protobuf/pb2/__pycache__/decision_var_pb2.cpython-39.pyc +0 -0
  155. jijmodeling/protobuf/pb2/__pycache__/element_pb2.cpython-39.opt-1.pyc +0 -0
  156. jijmodeling/protobuf/pb2/__pycache__/element_pb2.cpython-39.pyc +0 -0
  157. jijmodeling/protobuf/pb2/__pycache__/expression_pb2.cpython-39.opt-1.pyc +0 -0
  158. jijmodeling/protobuf/pb2/__pycache__/expression_pb2.cpython-39.pyc +0 -0
  159. jijmodeling/protobuf/pb2/__pycache__/forall_pb2.cpython-39.opt-1.pyc +0 -0
  160. jijmodeling/protobuf/pb2/__pycache__/forall_pb2.cpython-39.pyc +0 -0
  161. jijmodeling/protobuf/pb2/__pycache__/header_pb2.cpython-39.opt-1.pyc +0 -0
  162. jijmodeling/protobuf/pb2/__pycache__/header_pb2.cpython-39.pyc +0 -0
  163. jijmodeling/protobuf/pb2/__pycache__/index_pb2.cpython-39.opt-1.pyc +0 -0
  164. jijmodeling/protobuf/pb2/__pycache__/index_pb2.cpython-39.pyc +0 -0
  165. jijmodeling/protobuf/pb2/__pycache__/number_lit_pb2.cpython-39.opt-1.pyc +0 -0
  166. jijmodeling/protobuf/pb2/__pycache__/number_lit_pb2.cpython-39.pyc +0 -0
  167. jijmodeling/protobuf/pb2/__pycache__/placeholder_pb2.cpython-39.opt-1.pyc +0 -0
  168. jijmodeling/protobuf/pb2/__pycache__/placeholder_pb2.cpython-39.pyc +0 -0
  169. jijmodeling/protobuf/pb2/__pycache__/problem_pb2.cpython-39.opt-1.pyc +0 -0
  170. jijmodeling/protobuf/pb2/__pycache__/problem_pb2.cpython-39.pyc +0 -0
  171. jijmodeling/protobuf/pb2/__pycache__/reduction_op_pb2.cpython-39.opt-1.pyc +0 -0
  172. jijmodeling/protobuf/pb2/__pycache__/reduction_op_pb2.cpython-39.pyc +0 -0
  173. jijmodeling/protobuf/pb2/__pycache__/subscript_pb2.cpython-39.opt-1.pyc +0 -0
  174. jijmodeling/protobuf/pb2/__pycache__/subscript_pb2.cpython-39.pyc +0 -0
  175. jijmodeling/protobuf/pb2/__pycache__/unary_op_pb2.cpython-39.opt-1.pyc +0 -0
  176. jijmodeling/protobuf/pb2/__pycache__/unary_op_pb2.cpython-39.pyc +0 -0
  177. jijmodeling/protobuf/pb2/array_length_pb2.py +0 -27
  178. jijmodeling/protobuf/pb2/binary_op_pb2.py +0 -27
  179. jijmodeling/protobuf/pb2/commutative_op_pb2.py +0 -27
  180. jijmodeling/protobuf/pb2/constraint_pb2.py +0 -31
  181. jijmodeling/protobuf/pb2/custom_penalty_term_pb2.py +0 -31
  182. jijmodeling/protobuf/pb2/decision_var_pb2.py +0 -31
  183. jijmodeling/protobuf/pb2/element_pb2.py +0 -31
  184. jijmodeling/protobuf/pb2/expression_pb2.py +0 -39
  185. jijmodeling/protobuf/pb2/forall_pb2.py +0 -29
  186. jijmodeling/protobuf/pb2/header_pb2.py +0 -31
  187. jijmodeling/protobuf/pb2/index_pb2.py +0 -25
  188. jijmodeling/protobuf/pb2/number_lit_pb2.py +0 -27
  189. jijmodeling/protobuf/pb2/placeholder_pb2.py +0 -25
  190. jijmodeling/protobuf/pb2/problem_pb2.py +0 -40
  191. jijmodeling/protobuf/pb2/reduction_op_pb2.py +0 -30
  192. jijmodeling/protobuf/pb2/subscript_pb2.py +0 -27
  193. jijmodeling/protobuf/pb2/unary_op_pb2.py +0 -27
  194. jijmodeling/protobuf/to_protobuf.py +0 -631
  195. jijmodeling/protobuf/type_annotations.py +0 -52
  196. jijmodeling/sampleset/__init__.py +0 -33
  197. jijmodeling/sampleset/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  198. jijmodeling/sampleset/__pycache__/__init__.cpython-39.pyc +0 -0
  199. jijmodeling/sampleset/__pycache__/evaluation.cpython-39.opt-1.pyc +0 -0
  200. jijmodeling/sampleset/__pycache__/evaluation.cpython-39.pyc +0 -0
  201. jijmodeling/sampleset/__pycache__/measuring_time.cpython-39.opt-1.pyc +0 -0
  202. jijmodeling/sampleset/__pycache__/measuring_time.cpython-39.pyc +0 -0
  203. jijmodeling/sampleset/__pycache__/record.cpython-39.opt-1.pyc +0 -0
  204. jijmodeling/sampleset/__pycache__/record.cpython-39.pyc +0 -0
  205. jijmodeling/sampleset/__pycache__/sampleset.cpython-39.opt-1.pyc +0 -0
  206. jijmodeling/sampleset/__pycache__/sampleset.cpython-39.pyc +0 -0
  207. jijmodeling/sampleset/__pycache__/solving_time.cpython-39.opt-1.pyc +0 -0
  208. jijmodeling/sampleset/__pycache__/solving_time.cpython-39.pyc +0 -0
  209. jijmodeling/sampleset/__pycache__/system_time.cpython-39.opt-1.pyc +0 -0
  210. jijmodeling/sampleset/__pycache__/system_time.cpython-39.pyc +0 -0
  211. jijmodeling/sampleset/evaluation.py +0 -289
  212. jijmodeling/sampleset/measuring_time.py +0 -59
  213. jijmodeling/sampleset/record.py +0 -158
  214. jijmodeling/sampleset/sampleset.py +0 -389
  215. jijmodeling/sampleset/solving_time.py +0 -38
  216. jijmodeling/sampleset/system_time.py +0 -48
  217. jijmodeling/type_annotations/__init__.py +0 -44
  218. jijmodeling/type_annotations/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  219. jijmodeling/type_annotations/__pycache__/__init__.cpython-39.pyc +0 -0
  220. jijmodeling/type_annotations/__pycache__/type_annotations.cpython-39.opt-1.pyc +0 -0
  221. jijmodeling/type_annotations/__pycache__/type_annotations.cpython-39.pyc +0 -0
  222. jijmodeling/type_annotations/type_annotations.py +0 -54
  223. jijmodeling/utils/__init__.py +0 -28
  224. jijmodeling/utils/__pycache__/__init__.cpython-39.opt-1.pyc +0 -0
  225. jijmodeling/utils/__pycache__/__init__.cpython-39.pyc +0 -0
  226. jijmodeling/utils/__pycache__/deprecated.cpython-39.opt-1.pyc +0 -0
  227. jijmodeling/utils/__pycache__/deprecated.cpython-39.pyc +0 -0
  228. jijmodeling/utils/__pycache__/utils.cpython-39.opt-1.pyc +0 -0
  229. jijmodeling/utils/__pycache__/utils.cpython-39.pyc +0 -0
  230. jijmodeling/utils/deprecated.py +0 -17
  231. jijmodeling/utils/utils.py +0 -146
  232. jijmodeling-0.13.2.dist-info/METADATA +0 -60
  233. jijmodeling-0.13.2.dist-info/RECORD +0 -219
  234. jijmodeling-0.13.2.dist-info/top_level.txt +0 -1
@@ -1,378 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import abc as _abc
4
- import typing as tp
5
- import uuid
6
-
7
- from abc import abstractmethod
8
-
9
- import jijmodeling.exceptions.exceptions as _exceptions
10
- import jijmodeling.expression.expression as _expression
11
- import jijmodeling.expression.serializable as _serializable
12
-
13
-
14
- class Condition(metaclass=_serializable.Serializable):
15
- """Super class for Conditions."""
16
-
17
- def __init__(self) -> None:
18
- self._uuid = uuid.uuid4().hex
19
-
20
- def __and__(self, other):
21
- return AndOperator(self, other)
22
-
23
- def __xor__(self, other):
24
- return XorOperator(self, other)
25
-
26
- def __or__(self, other):
27
- return OrOperator(self, other)
28
-
29
- def __bool__(self):
30
- raise TypeError(
31
- "Cannot convert jm.Condition to bool to avoid unexpected bahavior. Consider using `jm.expr_same` instead in order to compare `jm.Condition` objects."
32
- )
33
-
34
- @abstractmethod
35
- def expressions(self) -> tp.List[_expression.Expression]:
36
- pass
37
-
38
- @property
39
- def uuid(self) -> str:
40
- return self._uuid
41
-
42
-
43
- class NoneCondition(Condition):
44
- """NoneCondition is a special condition that always returns None."""
45
-
46
- def expressions(self) -> tp.List[_expression.Expression]:
47
- return []
48
-
49
- @classmethod
50
- def operation(cls) -> bool:
51
- return True
52
-
53
- def _make_latex(self) -> str:
54
- """
55
- Outputs a latex representation.
56
-
57
- If `self._latex_repr` is not None, it
58
- will take precedence. If you want to get the latex representation of
59
- child objects in `_default_repr_latex_` of each class, use the method.
60
-
61
- Returns:
62
- str: latex representation.
63
- """
64
- return ""
65
-
66
-
67
- class CompareCondition(Condition, metaclass=_abc.ABCMeta):
68
- mark = ""
69
-
70
- def __init__(
71
- self,
72
- left: tp.Union[_expression.Expression, _expression.NumericValue],
73
- right: tp.Union[_expression.Expression, _expression.NumericValue],
74
- uuid: tp.Optional[str] = None,
75
- ) -> None:
76
- _left: _expression.Expression = (
77
- left
78
- if isinstance(left, _expression.Expression)
79
- else _expression.Number(left)
80
- )
81
- _right: _expression.Expression = (
82
- right
83
- if isinstance(right, _expression.Expression)
84
- else _expression.Number(right)
85
- )
86
-
87
- super().__init__()
88
- if not _left.is_operatable():
89
- raise _exceptions.ModelingError(f"{_left} is not operatable.")
90
- if not _right.is_operatable():
91
- raise _exceptions.ModelingError(f"{_right} is not operatable.")
92
-
93
- self._left = _left
94
- self._right = _right
95
- # Set uuid
96
- if uuid is not None:
97
- self._uuid = uuid
98
-
99
- def __repr__(self) -> str:
100
- return str(self.left) + self.mark + str(self.right)
101
-
102
- def _make_latex(self) -> str:
103
- """
104
- Outputs a latex representation.
105
-
106
- If `self._latex_repr` is not None, it
107
- will take precedence. If you want to get the latex representation of
108
- child objects in `_default_repr_latex_` of each class, use the method.
109
-
110
- Returns:
111
- str: latex representation.
112
- """
113
- latex_str = r"{} {} {}".format(
114
- self.left._make_latex(), self.mark, self.right._make_latex()
115
- )
116
- return latex_str
117
-
118
- def _repr_latex_(self) -> str:
119
- """
120
- Latex representation for Jupyter notebook.
121
-
122
- Returns:
123
- str: latex string
124
- """
125
- return f"${self._make_latex()}$"
126
-
127
- @property
128
- def left(self) -> _expression.Expression:
129
- return self._left
130
-
131
- @property
132
- def right(self) -> _expression.Expression:
133
- return self._right
134
-
135
- def expressions(self) -> tp.List[_expression.Expression]:
136
- return [self.left, self.right]
137
-
138
- @classmethod
139
- @abstractmethod
140
- def operation(cls, left, right) -> bool:
141
- pass
142
-
143
-
144
- class Equal(CompareCondition):
145
- """Equal condition."""
146
-
147
- mark = "="
148
-
149
- def __init__(
150
- self,
151
- left: tp.Union[_expression.Expression, _expression.NumericValue],
152
- right: tp.Union[_expression.Expression, _expression.NumericValue],
153
- uuid: tp.Optional[str] = None,
154
- ) -> None:
155
- _left = (
156
- left
157
- if isinstance(left, _expression.Expression)
158
- else _expression.Number(left)
159
- )
160
- _right = (
161
- right
162
- if isinstance(right, _expression.Expression)
163
- else _expression.Number(right)
164
- )
165
- super().__init__(_left, _right, uuid)
166
-
167
- @classmethod
168
- def operation(cls, left: tp.Any, right: tp.Any) -> bool:
169
- equal: bool = left == right
170
- return equal
171
-
172
-
173
- class NotEqual(CompareCondition):
174
- """NotEqual condition."""
175
-
176
- mark = "!="
177
-
178
- def __init__(
179
- self,
180
- left: tp.Union[_expression.Expression, _expression.NumericValue],
181
- right: tp.Union[_expression.Expression, _expression.NumericValue],
182
- uuid: tp.Optional[str] = None,
183
- ) -> None:
184
- super().__init__(left, right, uuid)
185
-
186
- def _make_latex(self) -> str:
187
- """
188
- Outputs a latex representation.
189
-
190
- If `self._latex_repr` is not None, it
191
- will take precedence. If you want to get the latex representation of
192
- child objects in `_default_repr_latex_` of each class, use the method.
193
-
194
- Returns:
195
- str: latex representation.
196
- """
197
- latex_str = r"{} \neq {}".format(
198
- self.left._make_latex(), self.right._make_latex()
199
- )
200
- return latex_str
201
-
202
- @classmethod
203
- def operation(cls, left, right) -> bool:
204
- not_eq: bool = left != right
205
- return not_eq
206
-
207
-
208
- class LessThan(CompareCondition):
209
- mark = "<"
210
-
211
- def __init__(
212
- self,
213
- left: tp.Union[_expression.Expression, _expression.NumericValue],
214
- right: tp.Union[_expression.Expression, _expression.NumericValue],
215
- uuid: tp.Optional[str] = None,
216
- ) -> None:
217
- super().__init__(left, right, uuid)
218
-
219
- @classmethod
220
- def operation(cls, left, right) -> bool:
221
- less_than: bool = left < right
222
- return less_than
223
-
224
-
225
- class LessThanEqual(CompareCondition):
226
- mark = "<="
227
-
228
- def __init__(
229
- self,
230
- left: tp.Union[_expression.Expression, _expression.NumericValue],
231
- right: tp.Union[_expression.Expression, _expression.NumericValue],
232
- uuid: tp.Optional[str] = None,
233
- ) -> None:
234
- super().__init__(left, right, uuid)
235
-
236
- def _make_latex(self) -> str:
237
- """
238
- Outputs a latex representation.
239
-
240
- If `self._latex_repr` is not None, it
241
- will take precedence. If you want to get the latex representation of
242
- child objects in `_default_repr_latex_` of each class, use the method.
243
-
244
- Returns:
245
- str: latex representation.
246
- """
247
- latex_str = r"{} \leq {}".format(
248
- self.left._make_latex(), self.right._make_latex()
249
- )
250
- return latex_str
251
-
252
- @classmethod
253
- def operation(cls, left, right) -> bool:
254
- less_than_eq: bool = left <= right
255
- return less_than_eq
256
-
257
-
258
- def equal(left: _expression.Expression, right: _expression.Expression) -> Equal:
259
- """
260
- Creadion an Equality condition object (Equal).
261
-
262
- The equality operator `==` can also be used to generate an equality condition object.
263
- Args:
264
- left (Expression): left hand side expression
265
- right (Expression): right hand side expression
266
-
267
- Returns:
268
- Equal: left `==` right
269
- """
270
- return Equal(left, right)
271
-
272
-
273
- def eq(left: _expression.Expression, right: _expression.Expression) -> Equal:
274
- """
275
- Creadion an Equality condition object (Equal).
276
- """
277
- return equal(left, right)
278
-
279
-
280
- def neq(left: _expression.Expression, right: _expression.Expression) -> NotEqual:
281
- """
282
- Creadion a Non Equality condition object (NotEqual) The non equality.
283
-
284
- operator `!=` can also be used to generate a non equality condition object.
285
-
286
- Args:
287
- left (Expression): left hand side expression
288
- right (Expression): right hand side expression
289
-
290
- Returns:
291
- NotEqual: left `!=` right
292
- """
293
- return NotEqual(left, right)
294
-
295
-
296
- class ConditionOperator(Condition, metaclass=_abc.ABCMeta):
297
- def __init__(
298
- self,
299
- left: Condition,
300
- right: Condition,
301
- uuid: tp.Optional[str] = None,
302
- ) -> None:
303
- super().__init__()
304
- self._left = left
305
- self._right = right
306
- # Set uuid
307
- if uuid is not None:
308
- self._uuid = uuid
309
-
310
- @property
311
- def left(self) -> Condition:
312
- return self._left
313
-
314
- @property
315
- def right(self) -> Condition:
316
- return self._right
317
-
318
- def expressions(self) -> tp.List[_expression.Expression]:
319
- return self.left.expressions() + self.right.expressions()
320
-
321
- @classmethod
322
- @abstractmethod
323
- def operation(cls, left: bool, right: bool) -> bool:
324
- pass
325
-
326
-
327
- class AndOperator(ConditionOperator):
328
- def __init__(
329
- self,
330
- left: Condition,
331
- right: Condition,
332
- uuid: tp.Optional[str] = None,
333
- ) -> None:
334
- super().__init__(left, right, uuid)
335
-
336
- @classmethod
337
- def operation(cls, left: bool, right: bool) -> bool:
338
- and_ope: bool = left & right
339
- return and_ope
340
-
341
- def __repr__(self) -> str:
342
- return "(" + str(self.left) + ") & (" + str(self.right) + ")"
343
-
344
-
345
- class XorOperator(ConditionOperator):
346
- def __init__(
347
- self,
348
- left: Condition,
349
- right: Condition,
350
- uuid: tp.Optional[str] = None,
351
- ) -> None:
352
- super().__init__(left, right, uuid)
353
-
354
- @classmethod
355
- def operation(cls, left, right) -> bool:
356
- xor: bool = left ^ right
357
- return xor
358
-
359
- def __repr__(self) -> str:
360
- return str(self.left) + " xor " + str(self.right)
361
-
362
-
363
- class OrOperator(ConditionOperator):
364
- def __init__(
365
- self,
366
- left: Condition,
367
- right: Condition,
368
- uuid: tp.Optional[str] = None,
369
- ) -> None:
370
- super().__init__(left, right, uuid)
371
-
372
- @classmethod
373
- def operation(cls, left, right) -> bool:
374
- or_bool: bool = left | right
375
- return or_bool
376
-
377
- def __repr__(self) -> str:
378
- return str(self.left) + " | " + str(self.right)