ripple-down-rules 0.4.81__tar.gz → 0.4.83__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.
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/PKG-INFO +1 -1
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/pyproject.toml +1 -1
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/rdr.py +13 -25
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/user_interface/prompt.py +7 -3
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/utils.py +2 -2
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules.egg-info/PKG-INFO +1 -1
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/LICENSE +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/README.md +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/setup.cfg +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/__init__.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/datasets.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/datastructures/__init__.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/datastructures/callable_expression.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/datastructures/case.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/datastructures/dataclasses.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/datastructures/enums.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/experts.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/failures.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/helpers.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/rdr_decorators.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/rules.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/user_interface/__init__.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/user_interface/gui.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/user_interface/ipython_custom_shell.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/user_interface/object_diagram.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/user_interface/template_file_creator.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules.egg-info/SOURCES.txt +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules.egg-info/dependency_links.txt +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules.egg-info/requires.txt +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules.egg-info/top_level.txt +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/test/test_json_serialization.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/test/test_object_diagram.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/test/test_on_mutagenic.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/test/test_rdr.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/test/test_rdr_alchemy.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/test/test_rdr_decorators.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/test/test_rdr_world.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/test/test_relational_rdr.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/test/test_relational_rdr_alchemy.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/test/test_sql_model.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/test/test_template_file_creator.py +0 -0
- {ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/test/test_utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ripple_down_rules
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.83
|
4
4
|
Summary: Implements the various versions of Ripple Down Rules (RDR) for knowledge representation and reasoning.
|
5
5
|
Author-email: Abdelrhman Bassiouny <abassiou@uni-bremen.de>
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
6
6
|
|
7
7
|
[project]
|
8
8
|
name = "ripple_down_rules"
|
9
|
-
version = "0.4.
|
9
|
+
version = "0.4.83"
|
10
10
|
description = "Implements the various versions of Ripple Down Rules (RDR) for knowledge representation and reasoning."
|
11
11
|
readme = "README.md"
|
12
12
|
authors = [{ name = "Abdelrhman Bassiouny", email = "abassiou@uni-bremen.de" }]
|
@@ -22,7 +22,7 @@ from .rules import Rule, SingleClassRule, MultiClassTopRule, MultiClassStopRule
|
|
22
22
|
from .user_interface.gui import RDRCaseViewer
|
23
23
|
from .utils import draw_tree, make_set, copy_case, \
|
24
24
|
SubclassJSONSerializer, make_list, get_type_from_string, \
|
25
|
-
is_conflicting, update_case, get_imports_from_scope, extract_function_source, extract_imports
|
25
|
+
is_conflicting, update_case, get_imports_from_scope, extract_function_source, extract_imports, get_full_class_name
|
26
26
|
|
27
27
|
|
28
28
|
class RippleDownRules(SubclassJSONSerializer, ABC):
|
@@ -45,6 +45,10 @@ class RippleDownRules(SubclassJSONSerializer, ABC):
|
|
45
45
|
"""
|
46
46
|
The name of the classifier.
|
47
47
|
"""
|
48
|
+
case_type: Optional[Type] = None
|
49
|
+
"""
|
50
|
+
The type of the case (input) to the RDR classifier.
|
51
|
+
"""
|
48
52
|
|
49
53
|
def __init__(self, start_rule: Optional[Rule] = None, viewer: Optional[RDRCaseViewer] = None):
|
50
54
|
"""
|
@@ -143,6 +147,7 @@ class RippleDownRules(SubclassJSONSerializer, ABC):
|
|
143
147
|
if case_query is None:
|
144
148
|
raise ValueError("The case query cannot be None.")
|
145
149
|
self.name = case_query.attribute_name if self.name is None else self.name
|
150
|
+
self.case_type = case_query.case_type if self.case_type is None else self.case_type
|
146
151
|
if case_query.target is None:
|
147
152
|
case_query_cp = copy(case_query)
|
148
153
|
self.classify(case_query_cp.case, modify_case=True)
|
@@ -367,16 +372,6 @@ class RDRWithCodeWriter(RippleDownRules, ABC):
|
|
367
372
|
else:
|
368
373
|
return "SCRDR"
|
369
374
|
|
370
|
-
@property
|
371
|
-
def case_type(self) -> Type:
|
372
|
-
"""
|
373
|
-
:return: The type of the case (input) to the RDR classifier.
|
374
|
-
"""
|
375
|
-
if isinstance(self.start_rule.corner_case, Case):
|
376
|
-
return self.start_rule.corner_case._obj_type
|
377
|
-
else:
|
378
|
-
return type(self.start_rule.corner_case)
|
379
|
-
|
380
375
|
@property
|
381
376
|
def conclusion_type(self) -> Tuple[Type]:
|
382
377
|
"""
|
@@ -396,7 +391,7 @@ class RDRWithCodeWriter(RippleDownRules, ABC):
|
|
396
391
|
|
397
392
|
def _to_json(self) -> Dict[str, Any]:
|
398
393
|
return {"start_rule": self.start_rule.to_json(), "generated_python_file_name": self.generated_python_file_name,
|
399
|
-
"name": self.name}
|
394
|
+
"name": self.name, "case_type": get_full_class_name(self.case_type) if self.case_type is not None else None}
|
400
395
|
|
401
396
|
@classmethod
|
402
397
|
def _from_json(cls, data: Dict[str, Any]) -> Self:
|
@@ -409,6 +404,8 @@ class RDRWithCodeWriter(RippleDownRules, ABC):
|
|
409
404
|
new_rdr.generated_python_file_name = data["generated_python_file_name"]
|
410
405
|
if "name" in data:
|
411
406
|
new_rdr.name = data["name"]
|
407
|
+
if "case_type" in data:
|
408
|
+
new_rdr.case_type = get_type_from_string(data["case_type"])
|
412
409
|
return new_rdr
|
413
410
|
|
414
411
|
@staticmethod
|
@@ -882,7 +879,8 @@ class GeneralRDR(RippleDownRules):
|
|
882
879
|
def _to_json(self) -> Dict[str, Any]:
|
883
880
|
return {"start_rules": {name: rdr.to_json() for name, rdr in self.start_rules_dict.items()}
|
884
881
|
, "generated_python_file_name": self.generated_python_file_name,
|
885
|
-
"name": self.name
|
882
|
+
"name": self.name,
|
883
|
+
"case_type": get_full_class_name(self.case_type) if self.case_type is not None else None}
|
886
884
|
|
887
885
|
@classmethod
|
888
886
|
def _from_json(cls, data: Dict[str, Any]) -> GeneralRDR:
|
@@ -897,6 +895,8 @@ class GeneralRDR(RippleDownRules):
|
|
897
895
|
new_rdr.generated_python_file_name = data["generated_python_file_name"]
|
898
896
|
if "name" in data:
|
899
897
|
new_rdr.name = data["name"]
|
898
|
+
if "case_type" in data:
|
899
|
+
new_rdr.case_type = get_type_from_string(data["case_type"])
|
900
900
|
return new_rdr
|
901
901
|
|
902
902
|
def update_from_python_file(self, package_dir: str) -> None:
|
@@ -930,18 +930,6 @@ class GeneralRDR(RippleDownRules):
|
|
930
930
|
f"{' ' * 4} case = create_case(case, max_recursion_idx=3)\n""")
|
931
931
|
f.write(f"{' ' * 4}return GeneralRDR._classify(classifiers_dict, case)\n")
|
932
932
|
|
933
|
-
@property
|
934
|
-
def case_type(self) -> Optional[Type]:
|
935
|
-
"""
|
936
|
-
:return: The type of the case (input) to the RDR classifier.
|
937
|
-
"""
|
938
|
-
if self.start_rule is None or self.start_rule.corner_case is None:
|
939
|
-
return None
|
940
|
-
if isinstance(self.start_rule.corner_case, Case):
|
941
|
-
return self.start_rule.corner_case._obj_type
|
942
|
-
else:
|
943
|
-
return type(self.start_rule.corner_case)
|
944
|
-
|
945
933
|
def get_rdr_classifier_from_python_file(self, file_path: str) -> Callable[[Any], Any]:
|
946
934
|
"""
|
947
935
|
:param file_path: The path to the file that contains the RDR classifier function.
|
{ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/user_interface/prompt.py
RENAMED
@@ -2,7 +2,11 @@ import ast
|
|
2
2
|
import logging
|
3
3
|
from _ast import AST
|
4
4
|
|
5
|
-
|
5
|
+
try:
|
6
|
+
from PyQt6.QtWidgets import QApplication
|
7
|
+
except ImportError:
|
8
|
+
QApplication = None
|
9
|
+
|
6
10
|
from colorama import Fore, Style
|
7
11
|
from pygments import highlight
|
8
12
|
from pygments.formatters.terminal import TerminalFormatter
|
@@ -11,7 +15,7 @@ from typing_extensions import Optional, Tuple
|
|
11
15
|
|
12
16
|
from ..datastructures.callable_expression import CallableExpression, parse_string_to_expression
|
13
17
|
from ..datastructures.dataclasses import CaseQuery
|
14
|
-
from ..datastructures.enums import PromptFor
|
18
|
+
from ..datastructures.enums import PromptFor
|
15
19
|
from .gui import RDRCaseViewer
|
16
20
|
from .ipython_custom_shell import IPythonShell
|
17
21
|
from ..utils import make_list
|
@@ -90,7 +94,7 @@ class UserPrompt:
|
|
90
94
|
prompt_str = f"Give conditions on when can the rule be evaluated for:"
|
91
95
|
case_query.scope.update({'case': case_query.case})
|
92
96
|
shell = None
|
93
|
-
if
|
97
|
+
if self.viewer is None:
|
94
98
|
prompt_str = self.construct_prompt_str_for_shell(case_query, prompt_for, prompt_str)
|
95
99
|
shell = IPythonShell(header=prompt_str, prompt_for=prompt_for, case_query=case_query,
|
96
100
|
code_to_modify=code_to_modify)
|
@@ -891,8 +891,8 @@ class SubclassJSONSerializer:
|
|
891
891
|
if not filename.endswith(".json"):
|
892
892
|
filename += ".json"
|
893
893
|
with open(filename, "r") as f:
|
894
|
-
|
895
|
-
deserialized_obj = cls.from_json(
|
894
|
+
rdr_json = json.load(f)
|
895
|
+
deserialized_obj = cls.from_json(rdr_json)
|
896
896
|
cls.data_class_refs.clear()
|
897
897
|
return deserialized_obj
|
898
898
|
|
{ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules.egg-info/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ripple_down_rules
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.83
|
4
4
|
Summary: Implements the various versions of Ripple Down Rules (RDR) for knowledge representation and reasoning.
|
5
5
|
Author-email: Abdelrhman Bassiouny <abassiou@uni-bremen.de>
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/datastructures/case.py
RENAMED
File without changes
|
File without changes
|
{ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/datastructures/enums.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/rdr_decorators.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules/user_interface/gui.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules.egg-info/requires.txt
RENAMED
File without changes
|
{ripple_down_rules-0.4.81 → ripple_down_rules-0.4.83}/src/ripple_down_rules.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|