ripple-down-rules 0.6.21__py3-none-any.whl → 0.6.23__py3-none-any.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.
- ripple_down_rules/__init__.py +1 -1
- ripple_down_rules/rdr.py +9 -6
- ripple_down_rules/rdr_decorators.py +2 -2
- ripple_down_rules/rules.py +10 -0
- ripple_down_rules/utils.py +1 -1
- {ripple_down_rules-0.6.21.dist-info → ripple_down_rules-0.6.23.dist-info}/METADATA +1 -1
- {ripple_down_rules-0.6.21.dist-info → ripple_down_rules-0.6.23.dist-info}/RECORD +10 -10
- {ripple_down_rules-0.6.21.dist-info → ripple_down_rules-0.6.23.dist-info}/WHEEL +0 -0
- {ripple_down_rules-0.6.21.dist-info → ripple_down_rules-0.6.23.dist-info}/licenses/LICENSE +0 -0
- {ripple_down_rules-0.6.21.dist-info → ripple_down_rules-0.6.23.dist-info}/top_level.txt +0 -0
ripple_down_rules/__init__.py
CHANGED
ripple_down_rules/rdr.py
CHANGED
@@ -92,7 +92,7 @@ class RippleDownRules(SubclassJSONSerializer, ABC):
|
|
92
92
|
self.start_rule = start_rule
|
93
93
|
self.fig: Optional[Figure] = None
|
94
94
|
self.viewer: Optional[RDRCaseViewer] = viewer
|
95
|
-
if viewer is None:
|
95
|
+
if viewer is None and RDRCaseViewer is not None:
|
96
96
|
if len(RDRCaseViewer.instances) > 0:
|
97
97
|
self.viewer = RDRCaseViewer.instances[0]
|
98
98
|
logger.error("No viewer was provided, but there is already an existing viewer. "
|
@@ -108,11 +108,14 @@ class RippleDownRules(SubclassJSONSerializer, ABC):
|
|
108
108
|
if value is not None:
|
109
109
|
value.set_save_function(self.save)
|
110
110
|
|
111
|
-
def render_evaluated_rule_tree(self, filename: str) -> None:
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
111
|
+
def render_evaluated_rule_tree(self, filename: str, show_full_tree: bool = False) -> None:
|
112
|
+
if show_full_tree:
|
113
|
+
render_tree(self.start_rule, use_dot_exporter=True, filename=filename)
|
114
|
+
else:
|
115
|
+
evaluated_rules = self.get_evaluated_rule_tree()
|
116
|
+
if evaluated_rules is not None and len(evaluated_rules) > 0:
|
117
|
+
render_tree(evaluated_rules[0], use_dot_exporter=True, filename=filename,
|
118
|
+
only_nodes=evaluated_rules)
|
116
119
|
|
117
120
|
def get_evaluated_rule_tree(self) -> List[Rule]:
|
118
121
|
"""
|
@@ -120,7 +120,7 @@ class RDRDecorator:
|
|
120
120
|
if self.generate_dot_file:
|
121
121
|
eval_rule_tree = self.rdr.get_evaluated_rule_tree()
|
122
122
|
if not self.not_none_output_found or (eval_rule_tree and len(eval_rule_tree) > 1):
|
123
|
-
self.rdr.render_evaluated_rule_tree(self.rdr_models_dir + f'/{self.model_name}')
|
123
|
+
self.rdr.render_evaluated_rule_tree(self.rdr_models_dir + f'/{self.model_name}', show_full_tree=True)
|
124
124
|
if eval_rule_tree and len(eval_rule_tree) > 1:
|
125
125
|
self.not_none_output_found = True
|
126
126
|
|
@@ -181,7 +181,7 @@ class RDRDecorator:
|
|
181
181
|
return Case(dict, id(case_dict), case_name, case_dict, **case_dict), case_dict
|
182
182
|
|
183
183
|
def initialize_rdr_model_name_and_load(self, func: Callable) -> None:
|
184
|
-
self.viewer = RDRCaseViewer.instances[0] if len(RDRCaseViewer.instances) > 0 else self.viewer
|
184
|
+
self.viewer = RDRCaseViewer.instances[0] if RDRCaseViewer is not None and len(RDRCaseViewer.instances) > 0 else self.viewer
|
185
185
|
model_file_name = get_func_rdr_model_name(func, include_file_name=True)
|
186
186
|
self.model_name = str_to_snake_case(model_file_name)
|
187
187
|
self.load()
|
ripple_down_rules/rules.py
CHANGED
@@ -60,6 +60,16 @@ class Rule(NodeMixin, SubclassJSONSerializer, ABC):
|
|
60
60
|
self.evaluated: bool = False
|
61
61
|
self._user_defined_name: Optional[str] = None
|
62
62
|
|
63
|
+
@property
|
64
|
+
def color(self) -> str:
|
65
|
+
if self.evaluated:
|
66
|
+
if self.fired:
|
67
|
+
return "green"
|
68
|
+
else:
|
69
|
+
return "red"
|
70
|
+
else:
|
71
|
+
return "white"
|
72
|
+
|
63
73
|
@property
|
64
74
|
def user_defined_name(self) -> Optional[str]:
|
65
75
|
"""
|
ripple_down_rules/utils.py
CHANGED
@@ -1934,7 +1934,7 @@ def render_tree(root: Node, use_dot_exporter: bool = False,
|
|
1934
1934
|
include_nodes=only_nodes,
|
1935
1935
|
nodenamefunc=unique_node_names,
|
1936
1936
|
edgeattrfunc=edge_attr_setter,
|
1937
|
-
nodeattrfunc=lambda node: f'style=filled, fillcolor={
|
1937
|
+
nodeattrfunc=lambda node: f'style=filled, fillcolor={node.color}'
|
1938
1938
|
)
|
1939
1939
|
de.to_dotfile(f"{filename}{'.dot'}")
|
1940
1940
|
# de.to_picture(f"{filename}{'.png'}")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ripple_down_rules
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.23
|
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
|
@@ -1,11 +1,11 @@
|
|
1
|
-
ripple_down_rules/__init__.py,sha256=
|
1
|
+
ripple_down_rules/__init__.py,sha256=Y8dJbmLSU5jLm9E0jiReo5eIcp03jmLvx6sNfRfi49M,100
|
2
2
|
ripple_down_rules/experts.py,sha256=4-dMIVeMzFXCLYl_XBG_P7_Xs4sZih9-vZxCIPri6dA,12958
|
3
3
|
ripple_down_rules/helpers.py,sha256=RUdfiSWMZjGwCxuCy44TcEJf2UNAFlPJusgHzuAs6qI,4583
|
4
|
-
ripple_down_rules/rdr.py,sha256=
|
5
|
-
ripple_down_rules/rdr_decorators.py,sha256=
|
6
|
-
ripple_down_rules/rules.py,sha256=
|
4
|
+
ripple_down_rules/rdr.py,sha256=sibe0amvb2MuVFRGjADgel6a-K0bp8fpJQRLnRuYW-k,57803
|
5
|
+
ripple_down_rules/rdr_decorators.py,sha256=0xVM-yRZJ6BrpyMfQNBuFUKT_-me6tbd4UTgG5Exx2g,11809
|
6
|
+
ripple_down_rules/rules.py,sha256=2d2Fgo5urVvUoIJWdRyaojcFBj_lfhLZaBVrXwb5KLA,23764
|
7
7
|
ripple_down_rules/start-code-server.sh,sha256=otClk7VmDgBOX2TS_cjws6K0UwvgAUJhoA0ugkPCLqQ,949
|
8
|
-
ripple_down_rules/utils.py,sha256=
|
8
|
+
ripple_down_rules/utils.py,sha256=VM8vrshOJIqXAY48dghu86KSGpYQoGGDMEiq3GrLXsQ,73319
|
9
9
|
ripple_down_rules/datastructures/__init__.py,sha256=V2aNgf5C96Y5-IGghra3n9uiefpoIm_QdT7cc_C8cxQ,111
|
10
10
|
ripple_down_rules/datastructures/callable_expression.py,sha256=ysK-4JmZ4oSUTJC7zpo_o77g4ONxPDEcIpSWggsnx3c,13320
|
11
11
|
ripple_down_rules/datastructures/case.py,sha256=PJ7_-AdxYic6BO5z816piFODj6nU5J6Jt1YzTFH-dds,15510
|
@@ -17,8 +17,8 @@ ripple_down_rules/user_interface/ipython_custom_shell.py,sha256=yp-F8YRWGhj1PLB3
|
|
17
17
|
ripple_down_rules/user_interface/object_diagram.py,sha256=FEa2HaYR9QmTE6NsOwBvZ0jqmu3DKyg6mig2VE5ZP4Y,4956
|
18
18
|
ripple_down_rules/user_interface/prompt.py,sha256=JceEUGYsd0lIvd-v2y3D3swoo96_C0lxfp3CxM7Vfts,8900
|
19
19
|
ripple_down_rules/user_interface/template_file_creator.py,sha256=kwBbFLyN6Yx2NTIHPSwOoytWgbJDYhgrUOVFw_jkDQ4,13522
|
20
|
-
ripple_down_rules-0.6.
|
21
|
-
ripple_down_rules-0.6.
|
22
|
-
ripple_down_rules-0.6.
|
23
|
-
ripple_down_rules-0.6.
|
24
|
-
ripple_down_rules-0.6.
|
20
|
+
ripple_down_rules-0.6.23.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
|
21
|
+
ripple_down_rules-0.6.23.dist-info/METADATA,sha256=5B9P3h5EyJEZvyuj7CtFVNeJxQOg8kjG7pQJfoVlAqs,48294
|
22
|
+
ripple_down_rules-0.6.23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
ripple_down_rules-0.6.23.dist-info/top_level.txt,sha256=VeoLhEhyK46M1OHwoPbCQLI1EifLjChqGzhQ6WEUqeM,18
|
24
|
+
ripple_down_rules-0.6.23.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|