ripple-down-rules 0.4.0__tar.gz → 0.4.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.
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/PKG-INFO +1 -1
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/pyproject.toml +1 -1
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/user_interface/gui.py +17 -12
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/user_interface/object_diagram.py +7 -2
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/utils.py +5 -1
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules.egg-info/PKG-INFO +1 -1
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/test/test_rdr_world.py +1 -1
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/LICENSE +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/README.md +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/setup.cfg +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/__init__.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/datasets.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/datastructures/__init__.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/datastructures/callable_expression.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/datastructures/case.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/datastructures/dataclasses.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/datastructures/enums.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/experts.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/failures.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/helpers.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/rdr.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/rdr_decorators.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/rules.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/user_interface/__init__.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/user_interface/ipython_custom_shell.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/user_interface/prompt.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/user_interface/template_file_creator.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules.egg-info/SOURCES.txt +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules.egg-info/dependency_links.txt +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules.egg-info/top_level.txt +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/test/test_json_serialization.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/test/test_object_diagram.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/test/test_on_mutagenic.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/test/test_rdr.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/test/test_rdr_alchemy.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/test/test_rdr_decorators.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/test/test_relational_rdr.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/test/test_relational_rdr_alchemy.py +0 -0
- {ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/test/test_sql_model.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.2
|
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.2"
|
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" }]
|
{ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/user_interface/gui.py
RENAMED
@@ -155,10 +155,23 @@ class CollapsibleBox(QWidget):
|
|
155
155
|
|
156
156
|
def toggle(self):
|
157
157
|
is_expanded = self.toggle_button.isChecked()
|
158
|
+
self.update_object_diagram(is_expanded)
|
158
159
|
self.toggle_button.setArrowType(
|
159
160
|
Qt.ArrowType.DownArrow if is_expanded else Qt.ArrowType.RightArrow
|
160
161
|
)
|
161
162
|
self.content_area.setVisible(is_expanded)
|
163
|
+
|
164
|
+
self.update_object_diagram(is_expanded)
|
165
|
+
|
166
|
+
# toggle children
|
167
|
+
if not is_expanded:
|
168
|
+
for i in range(self.content_layout.count()):
|
169
|
+
item = self.content_layout.itemAt(i)
|
170
|
+
if isinstance(item.widget(), CollapsibleBox):
|
171
|
+
item.widget().toggle_button.setChecked(False)
|
172
|
+
item.widget().toggle()
|
173
|
+
|
174
|
+
def update_object_diagram(self, is_expanded):
|
162
175
|
if is_expanded and self.viewer is not None:
|
163
176
|
self.viewer.included_attrs.append(self.chain_name)
|
164
177
|
main_obj_name = self.chain_name.split('.')[0]
|
@@ -173,15 +186,7 @@ class CollapsibleBox(QWidget):
|
|
173
186
|
main_obj_name = self.chain_name.split('.')[0]
|
174
187
|
main_obj = self.main_obj.get(main_obj_name)
|
175
188
|
self.viewer.update_object_diagram(
|
176
|
-
main_obj, main_obj_name
|
177
|
-
)
|
178
|
-
# toggle children
|
179
|
-
if not is_expanded:
|
180
|
-
for i in range(self.content_layout.count()):
|
181
|
-
item = self.content_layout.itemAt(i)
|
182
|
-
if isinstance(item.widget(), CollapsibleBox):
|
183
|
-
item.widget().toggle_button.setChecked(False)
|
184
|
-
item.widget().toggle()
|
189
|
+
main_obj, main_obj_name)
|
185
190
|
|
186
191
|
def add_widget(self, widget):
|
187
192
|
self.content_layout.addWidget(widget)
|
@@ -400,15 +405,15 @@ class RDRCaseViewer(QMainWindow):
|
|
400
405
|
if isinstance(item.widget(), CollapsibleBox):
|
401
406
|
self.expand_collapse_all(item.widget(), expand=False)
|
402
407
|
|
403
|
-
def expand_collapse_all(self, widget, expand=True):
|
408
|
+
def expand_collapse_all(self, widget, expand=True, curr_depth=0, max_depth=2):
|
404
409
|
widget.toggle_button.setChecked(expand)
|
405
410
|
widget.toggle()
|
406
|
-
if expand:
|
411
|
+
if expand and curr_depth < max_depth:
|
407
412
|
# do it for recursive children
|
408
413
|
for i in range(widget.content_layout.count()):
|
409
414
|
item = widget.content_layout.itemAt(i)
|
410
415
|
if isinstance(item.widget(), CollapsibleBox):
|
411
|
-
self.expand_collapse_all(item.widget(), expand=True)
|
416
|
+
self.expand_collapse_all(item.widget(), expand=True, curr_depth=curr_depth + 1, max_depth=max_depth)
|
412
417
|
|
413
418
|
|
414
419
|
|
@@ -28,11 +28,11 @@ def get_colored_value(value):
|
|
28
28
|
|
29
29
|
|
30
30
|
def generate_object_graph(obj, name='root', seen=None, graph=None, current_depth=0, max_depth=3, chain_name=None,
|
31
|
-
included_attrs=None):
|
31
|
+
included_attrs=None, iterable_limit=3):
|
32
32
|
if seen is None:
|
33
33
|
seen = set()
|
34
34
|
if graph is None:
|
35
|
-
graph = graphviz.Digraph(format='svg'
|
35
|
+
graph = graphviz.Digraph(format='svg')
|
36
36
|
graph.attr('node', shape='plaintext')
|
37
37
|
|
38
38
|
obj_id = id(obj)
|
@@ -49,9 +49,13 @@ def generate_object_graph(obj, name='root', seen=None, graph=None, current_depth
|
|
49
49
|
|
50
50
|
if isinstance(obj, (list, tuple, set, dict)):
|
51
51
|
items = obj.items() if isinstance(obj, dict) else enumerate(obj)
|
52
|
+
i = 0
|
52
53
|
for idx, item in items:
|
53
54
|
if idx == "scope":
|
54
55
|
continue
|
56
|
+
if i >= iterable_limit:
|
57
|
+
rows.append(f'<TR><TD ALIGN="LEFT" PORT="{idx}">...</TD><TD ALIGN="LEFT">...</TD></TR>')
|
58
|
+
break
|
55
59
|
# Represent items as attr = index + type (for the label)
|
56
60
|
if is_simple(item):
|
57
61
|
val_colored = get_colored_value(item)
|
@@ -61,6 +65,7 @@ def generate_object_graph(obj, name='root', seen=None, graph=None, current_depth
|
|
61
65
|
rows.append(
|
62
66
|
f'<TR><TD ALIGN="LEFT" PORT="{idx}">[{idx}]</TD><TD ALIGN="LEFT"><I>{type_name}</I></TD></TR>')
|
63
67
|
non_simple_attrs.append((str(idx), item))
|
68
|
+
i += 1
|
64
69
|
|
65
70
|
else:
|
66
71
|
for attr in dir(obj):
|
@@ -977,7 +977,11 @@ def copy_case(case: Union[Case, SQLTable]) -> Union[Case, SQLTable, Any]:
|
|
977
977
|
continue
|
978
978
|
attr_value = getattr(case, attr)
|
979
979
|
if is_iterable(attr_value):
|
980
|
-
|
980
|
+
try:
|
981
|
+
setattr(case_copy, attr, copy(attr_value))
|
982
|
+
except AttributeError as e:
|
983
|
+
# if the attribute is not settable, just skip it
|
984
|
+
pass
|
981
985
|
return case_copy
|
982
986
|
|
983
987
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ripple_down_rules
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.2
|
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
|
@@ -119,7 +119,7 @@ class TestRDRWorld(TestCase):
|
|
119
119
|
cls.viewer = RDRCaseViewer()
|
120
120
|
|
121
121
|
def test_view_rdr(self):
|
122
|
-
self.get_view_rdr(use_loaded_answers=
|
122
|
+
self.get_view_rdr(use_loaded_answers=False, save_answers=False, append=False)
|
123
123
|
|
124
124
|
def test_save_and_load_view_rdr(self):
|
125
125
|
view_rdr = self.get_view_rdr(use_loaded_answers=True, save_answers=False, append=False)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/datastructures/__init__.py
RENAMED
File without changes
|
File without changes
|
{ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/datastructures/case.py
RENAMED
File without changes
|
File without changes
|
{ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/datastructures/enums.py
RENAMED
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.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/user_interface/__init__.py
RENAMED
File without changes
|
File without changes
|
{ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules/user_interface/prompt.py
RENAMED
File without changes
|
File without changes
|
{ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/src/ripple_down_rules.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{ripple_down_rules-0.4.0 → ripple_down_rules-0.4.2}/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
|