ripple-down-rules 0.4.4__py3-none-any.whl → 0.4.7__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/user_interface/prompt.py +2 -2
- ripple_down_rules/user_interface/template_file_creator.py +12 -8
- ripple_down_rules/utils.py +2 -1
- {ripple_down_rules-0.4.4.dist-info → ripple_down_rules-0.4.7.dist-info}/METADATA +17 -3
- {ripple_down_rules-0.4.4.dist-info → ripple_down_rules-0.4.7.dist-info}/RECORD +8 -8
- {ripple_down_rules-0.4.4.dist-info → ripple_down_rules-0.4.7.dist-info}/WHEEL +0 -0
- {ripple_down_rules-0.4.4.dist-info → ripple_down_rules-0.4.7.dist-info}/licenses/LICENSE +0 -0
- {ripple_down_rules-0.4.4.dist-info → ripple_down_rules-0.4.7.dist-info}/top_level.txt +0 -0
@@ -134,14 +134,14 @@ class UserPrompt:
|
|
134
134
|
"""
|
135
135
|
while True:
|
136
136
|
if user_input is None:
|
137
|
-
if
|
137
|
+
if self.viewer is None:
|
138
138
|
shell = IPythonShell() if shell is None else shell
|
139
139
|
shell.run()
|
140
140
|
user_input = shell.user_input
|
141
141
|
else:
|
142
142
|
app = QApplication.instance()
|
143
143
|
if app is None:
|
144
|
-
|
144
|
+
raise RuntimeError("QApplication instance is None. Please run the application first.")
|
145
145
|
self.viewer.show()
|
146
146
|
app.exec()
|
147
147
|
user_input = self.viewer.user_input
|
@@ -79,7 +79,7 @@ class TemplateFileCreator:
|
|
79
79
|
self.case_query = case_query
|
80
80
|
self.output_type = self.get_output_type()
|
81
81
|
self.user_edit_line = 0
|
82
|
-
self.func_name: str = self.get_func_name()
|
82
|
+
self.func_name: str = self.get_func_name(self.prompt_for, self.case_query)
|
83
83
|
self.func_doc: str = self.get_func_doc()
|
84
84
|
self.function_signature: str = self.get_function_signature()
|
85
85
|
self.editor: Optional[Editor] = detect_available_editor()
|
@@ -146,7 +146,7 @@ class TemplateFileCreator:
|
|
146
146
|
|
147
147
|
def get_function_signature(self) -> str:
|
148
148
|
if self.func_name is None:
|
149
|
-
self.func_name = self.get_func_name()
|
149
|
+
self.func_name = self.get_func_name(self.prompt_for, self.case_query)
|
150
150
|
output_type_hint = self.get_output_type_hint()
|
151
151
|
func_args = self.get_func_args()
|
152
152
|
return f"def {self.func_name}({func_args}){output_type_hint}:"
|
@@ -238,15 +238,19 @@ class TemplateFileCreator:
|
|
238
238
|
else:
|
239
239
|
return f"Get possible value(s) for {self.case_query.name}"
|
240
240
|
|
241
|
-
|
241
|
+
@staticmethod
|
242
|
+
def get_func_name(prompt_for, case_query) -> Optional[str]:
|
242
243
|
func_name = ""
|
243
|
-
if
|
244
|
-
func_name = f"{
|
245
|
-
case_name =
|
246
|
-
if
|
244
|
+
if prompt_for == PromptFor.Conditions:
|
245
|
+
func_name = f"{prompt_for.value.lower()}_for_"
|
246
|
+
case_name = case_query.name.replace(".", "_")
|
247
|
+
if case_query.is_function:
|
247
248
|
# convert any CamelCase word into snake_case by adding _ before each capital letter
|
248
|
-
case_name = case_name.replace(f"_{
|
249
|
+
case_name = case_name.replace(f"_{case_query.attribute_name}", "")
|
249
250
|
func_name += case_name
|
251
|
+
attr_types = [t for t in case_query.core_attribute_type if t.__module__ != "builtins" and t is not None
|
252
|
+
and t is not type(None)]
|
253
|
+
func_name += f"_of_type_{'_or_'.join(map(lambda c: c.__name__, attr_types))}"
|
250
254
|
return str_to_snake_case(func_name)
|
251
255
|
|
252
256
|
@cached_property
|
ripple_down_rules/utils.py
CHANGED
@@ -14,6 +14,7 @@ from collections import UserDict
|
|
14
14
|
from copy import deepcopy, copy
|
15
15
|
from dataclasses import is_dataclass, fields
|
16
16
|
from enum import Enum
|
17
|
+
from textwrap import dedent
|
17
18
|
from types import NoneType
|
18
19
|
|
19
20
|
import matplotlib
|
@@ -168,7 +169,7 @@ def extract_function_source(file_path: str,
|
|
168
169
|
if not include_signature:
|
169
170
|
func_lines = func_lines[1:]
|
170
171
|
line_numbers.append((node.lineno, node.end_lineno))
|
171
|
-
functions_source[node.name] = "\n".join(func_lines) if join_lines else func_lines
|
172
|
+
functions_source[node.name] = dedent("\n".join(func_lines)) if join_lines else func_lines
|
172
173
|
if len(functions_source) == len(function_names):
|
173
174
|
break
|
174
175
|
if len(functions_source) != len(function_names):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ripple_down_rules
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.7
|
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
|
@@ -677,12 +677,26 @@ License: GNU GENERAL PUBLIC LICENSE
|
|
677
677
|
the library. If this is what you want to do, use the GNU Lesser General
|
678
678
|
Public License instead of this License. But first, please read
|
679
679
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
680
|
-
Project-URL: Homepage, https://github.com/AbdelrhmanBassiouny/ripple_down_rules
|
681
680
|
Keywords: robotics,knowledge,reasoning,representation
|
682
681
|
Classifier: Programming Language :: Python :: 3
|
683
|
-
Requires-Python: >=3.10
|
684
682
|
Description-Content-Type: text/markdown
|
685
683
|
License-File: LICENSE
|
684
|
+
Requires-Dist: anytree>=2.8.0
|
685
|
+
Requires-Dist: pandas>=2.0.3
|
686
|
+
Requires-Dist: networkx>=3.1
|
687
|
+
Requires-Dist: ordered_set>=4
|
688
|
+
Requires-Dist: pygraphviz>=1.7
|
689
|
+
Requires-Dist: ucimlrepo>=0.0.7
|
690
|
+
Requires-Dist: typing-extensions>=4.12.2
|
691
|
+
Requires-Dist: matplotlib>=3.7.5
|
692
|
+
Requires-Dist: sqlalchemy
|
693
|
+
Requires-Dist: pyqt6
|
694
|
+
Requires-Dist: qtconsole
|
695
|
+
Requires-Dist: graphviz
|
696
|
+
Requires-Dist: tabulate
|
697
|
+
Requires-Dist: ipython
|
698
|
+
Requires-Dist: requests
|
699
|
+
Requires-Dist: colorama
|
686
700
|
Dynamic: license-file
|
687
701
|
|
688
702
|
# Ripple Down Rules (RDR)
|
@@ -6,7 +6,7 @@ ripple_down_rules/helpers.py,sha256=TvTJU0BA3dPcAyzvZFvAu7jZqsp8Lu0HAAwvuizlGjg,
|
|
6
6
|
ripple_down_rules/rdr.py,sha256=jxMvkyQ_2jdyxa5aKmvGRHvD-IJBKjsyOpxvvJbFLPE,45518
|
7
7
|
ripple_down_rules/rdr_decorators.py,sha256=VdmE0JrE8j89b6Af1R1tLZiKfy3h1VCvhAUefN_FLLQ,6753
|
8
8
|
ripple_down_rules/rules.py,sha256=PLNaRLn5tQbq7gNsAe-n9hTjKC80p_7MbfkZWgDxLBg,17474
|
9
|
-
ripple_down_rules/utils.py,sha256=
|
9
|
+
ripple_down_rules/utils.py,sha256=3x6BHCoqEewn40lDtUIWOMQLZ_IA0j7WnY9_YDHvs-o,49192
|
10
10
|
ripple_down_rules/datastructures/__init__.py,sha256=V2aNgf5C96Y5-IGghra3n9uiefpoIm_QdT7cc_C8cxQ,111
|
11
11
|
ripple_down_rules/datastructures/callable_expression.py,sha256=jA7424_mWPbOoPICW3eLMX0-ypxnsW6gOqxrJ7JpDbE,11610
|
12
12
|
ripple_down_rules/datastructures/case.py,sha256=oC8OSdhXvHE-Zx1IIQlad-fsKzQQqr6MZBW24c-dbeU,15191
|
@@ -16,10 +16,10 @@ ripple_down_rules/user_interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
|
|
16
16
|
ripple_down_rules/user_interface/gui.py,sha256=GlVUYGpMRikrd-FjYCAamdKFAuTAeiq21ZzQvjVKJ4g,27588
|
17
17
|
ripple_down_rules/user_interface/ipython_custom_shell.py,sha256=tc7ms80iPNElm9AYC6i1FlfMKkqHLT8wmOEXg_k9yAU,6275
|
18
18
|
ripple_down_rules/user_interface/object_diagram.py,sha256=84JlEH0nQmtGmP8Su5iRX3ZfqByYHbVwd0BQYYPuckY,4436
|
19
|
-
ripple_down_rules/user_interface/prompt.py,sha256=
|
20
|
-
ripple_down_rules/user_interface/template_file_creator.py,sha256=
|
21
|
-
ripple_down_rules-0.4.
|
22
|
-
ripple_down_rules-0.4.
|
23
|
-
ripple_down_rules-0.4.
|
24
|
-
ripple_down_rules-0.4.
|
25
|
-
ripple_down_rules-0.4.
|
19
|
+
ripple_down_rules/user_interface/prompt.py,sha256=97s5mhmsqrFTQkfmHssYFko0SPLBDxesHoLumqZO0FA,8028
|
20
|
+
ripple_down_rules/user_interface/template_file_creator.py,sha256=_CEe8H07q62YpImy1p72vXcPHkJ2_Q0n6t56K6g2gPE,12930
|
21
|
+
ripple_down_rules-0.4.7.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
|
22
|
+
ripple_down_rules-0.4.7.dist-info/METADATA,sha256=NOxEaLxlUHlfwCGv9lgu_083JZl3ls6fcknejdagcm0,43217
|
23
|
+
ripple_down_rules-0.4.7.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
24
|
+
ripple_down_rules-0.4.7.dist-info/top_level.txt,sha256=VeoLhEhyK46M1OHwoPbCQLI1EifLjChqGzhQ6WEUqeM,18
|
25
|
+
ripple_down_rules-0.4.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|