rule-engine-core 0.0.1__tar.gz → 0.0.2__tar.gz
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.
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/PKG-INFO +2 -2
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/README.md +1 -1
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core/entity_base.py +4 -4
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core/parser.py +2 -2
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core.egg-info/PKG-INFO +2 -2
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/setup.py +1 -1
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/pyproject.toml +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core/__init__.py +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core/entity_dao.py +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core/entity_types.py +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core/filter.py +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core/metadata_store.py +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core/rule.py +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core.egg-info/SOURCES.txt +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core.egg-info/dependency_links.txt +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core.egg-info/requires.txt +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core.egg-info/top_level.txt +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/setup.cfg +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/tests/test_rule_creation_storage.py +0 -0
- {rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/tests/test_rule_evaluation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rule-engine-core
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: A rule engine core library for Python.
|
|
5
5
|
Home-page: https://github.com/temp-noob/rule-engine
|
|
6
6
|
Author: Mohit Tripathi
|
|
@@ -24,7 +24,7 @@ Dynamic: summary
|
|
|
24
24
|
## Build
|
|
25
25
|
-> create venv and activate
|
|
26
26
|
(install meta)
|
|
27
|
-
-> pip install
|
|
27
|
+
-> pip install setuptools wheel twine
|
|
28
28
|
(build package)
|
|
29
29
|
-> python setup.py sdist bdist_wheel
|
|
30
30
|
-> pip install dist/rule-engine-core-0.1.0-py3-none-any.whl
|
|
@@ -18,7 +18,7 @@ class EntityBase(ABC):
|
|
|
18
18
|
Initializes the entity with an expression string and parses it into an expression tree.
|
|
19
19
|
"""
|
|
20
20
|
self.expression = expression
|
|
21
|
-
self.
|
|
21
|
+
self.expression_tree: Node = self._parse_expression(expression)
|
|
22
22
|
self.node_type = node_type
|
|
23
23
|
self.name = name
|
|
24
24
|
|
|
@@ -27,7 +27,7 @@ class EntityBase(ABC):
|
|
|
27
27
|
Validates whether the operands of the entity are valid.
|
|
28
28
|
_validate_node must be implemented by subclasses
|
|
29
29
|
"""
|
|
30
|
-
return self._validate_node(self.
|
|
30
|
+
return self._validate_node(self.expression_tree)
|
|
31
31
|
|
|
32
32
|
@abstractmethod
|
|
33
33
|
def _validate_node(self, node: Node) -> bool:
|
|
@@ -57,7 +57,7 @@ class EntityBase(ABC):
|
|
|
57
57
|
entity_eval_cache: Dictionary of cached evaluation results for entities. We do a dfs sort of thing and keep on populating the cache with the results.
|
|
58
58
|
entity_cache: Dictionary of cached entities. This is used to get entity object by entity id.
|
|
59
59
|
"""
|
|
60
|
-
return self._evaluate_node(EntityNode(self.
|
|
60
|
+
return self._evaluate_node(EntityNode(self.expression_tree, self.node_type), pos_data, entity_eval_cache, entity_cache)
|
|
61
61
|
|
|
62
62
|
def _parse_expression(self, expression: str) -> Node:
|
|
63
63
|
"""
|
|
@@ -87,7 +87,7 @@ class EntityBase(ABC):
|
|
|
87
87
|
'expression': self.expression,
|
|
88
88
|
'node_type': self.node_type,
|
|
89
89
|
'name': self.name,
|
|
90
|
-
'expression_tree': self.
|
|
90
|
+
'expression_tree': self.expression_tree,
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
|
|
@@ -66,7 +66,7 @@ class Parser:
|
|
|
66
66
|
def tokenize(self, text: str):
|
|
67
67
|
# Define token specifications.
|
|
68
68
|
token_spec = [
|
|
69
|
-
('NUMBER', r'
|
|
69
|
+
('NUMBER', r'-?\d+(\.\d+)?'), # Integer or decimal number
|
|
70
70
|
('RELOP', r'(<=|>=|<|>)'), # Relational operators
|
|
71
71
|
('IDENT', r'[A-Za-z_]\w*'), # Identifiers (operands)
|
|
72
72
|
('OP', r'[+\-*/&|!]'), # Other operators
|
|
@@ -219,4 +219,4 @@ class Parser:
|
|
|
219
219
|
_logger.error(errMsg)
|
|
220
220
|
raise RuntimeError(errMsg)
|
|
221
221
|
return node
|
|
222
|
-
|
|
222
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rule-engine-core
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: A rule engine core library for Python.
|
|
5
5
|
Home-page: https://github.com/temp-noob/rule-engine
|
|
6
6
|
Author: Mohit Tripathi
|
|
@@ -24,7 +24,7 @@ Dynamic: summary
|
|
|
24
24
|
## Build
|
|
25
25
|
-> create venv and activate
|
|
26
26
|
(install meta)
|
|
27
|
-
-> pip install
|
|
27
|
+
-> pip install setuptools wheel twine
|
|
28
28
|
(build package)
|
|
29
29
|
-> python setup.py sdist bdist_wheel
|
|
30
30
|
-> pip install dist/rule-engine-core-0.1.0-py3-none-any.whl
|
|
@@ -14,7 +14,7 @@ def parse_requirements(filename):
|
|
|
14
14
|
path = os.path.join(os.getenv('BUILD_PATH'), "requirements.txt")
|
|
15
15
|
setup(
|
|
16
16
|
name="rule-engine-core",
|
|
17
|
-
version="0.0.
|
|
17
|
+
version="0.0.2",
|
|
18
18
|
author="Mohit Tripathi",
|
|
19
19
|
author_email="tripathimohit051@gmail.com",
|
|
20
20
|
description="A rule engine core library for Python.",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{rule_engine_core-0.0.1 → rule_engine_core-0.0.2}/rule_engine_core.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|