ripple-down-rules 0.6.45__py3-none-any.whl → 0.6.47__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/failures.py +4 -0
- ripple_down_rules/rdr.py +4 -4
- ripple_down_rules/rdr_decorators.py +1 -3
- ripple_down_rules/utils.py +5 -0
- {ripple_down_rules-0.6.45.dist-info → ripple_down_rules-0.6.47.dist-info}/METADATA +1 -1
- {ripple_down_rules-0.6.45.dist-info → ripple_down_rules-0.6.47.dist-info}/RECORD +10 -9
- {ripple_down_rules-0.6.45.dist-info → ripple_down_rules-0.6.47.dist-info}/WHEEL +0 -0
- {ripple_down_rules-0.6.45.dist-info → ripple_down_rules-0.6.47.dist-info}/licenses/LICENSE +0 -0
- {ripple_down_rules-0.6.45.dist-info → ripple_down_rules-0.6.47.dist-info}/top_level.txt +0 -0
ripple_down_rules/__init__.py
CHANGED
ripple_down_rules/rdr.py
CHANGED
@@ -15,6 +15,7 @@ from types import NoneType, ModuleType
|
|
15
15
|
|
16
16
|
from ripple_down_rules.datastructures.dataclasses import CaseFactoryMetaData
|
17
17
|
from . import logger
|
18
|
+
from .failures import RDRLoadError
|
18
19
|
|
19
20
|
try:
|
20
21
|
from matplotlib import pyplot as plt
|
@@ -217,17 +218,16 @@ class RippleDownRules(SubclassJSONSerializer, ABC):
|
|
217
218
|
if os.path.exists(json_file + ".json"):
|
218
219
|
rdr = cls.from_json_file(json_file)
|
219
220
|
try:
|
220
|
-
acronym = cls.get_acronym().lower()
|
221
|
-
python_file_name = get_file_that_ends_with(model_dir, f"_{acronym}.py")
|
222
|
-
python_file_path = os.path.join(model_dir, python_file_name)
|
223
221
|
if rdr is None:
|
224
|
-
rdr = cls.from_python(model_dir, parent_package_name=package_name
|
222
|
+
rdr = cls.from_python(model_dir, parent_package_name=package_name)
|
225
223
|
else:
|
226
224
|
rdr.update_from_python(model_dir, package_name=package_name)
|
227
225
|
rdr.to_json_file(json_file)
|
228
226
|
except (FileNotFoundError, ValueError, SyntaxError, ModuleNotFoundError) as e:
|
229
227
|
logger.warning(f"Could not load the python file for the model {model_name} from {model_dir}. "
|
230
228
|
f"Make sure the file exists and is valid.")
|
229
|
+
if rdr is None:
|
230
|
+
raise RDRLoadError(f"Could not load the rdr model {model_name} from {model_dir}, error is {e}")
|
231
231
|
rdr.save(save_dir=load_dir, model_name=model_name, package_name=package_name)
|
232
232
|
rdr.save_dir = load_dir
|
233
233
|
rdr.model_name = model_name
|
@@ -213,9 +213,7 @@ class RDRDecorator:
|
|
213
213
|
"""
|
214
214
|
self.rdr = None
|
215
215
|
if self.model_name is not None:
|
216
|
-
|
217
|
-
if os.path.exists(os.path.join(self.rdr_models_dir, model_path)):
|
218
|
-
self.rdr = GeneralRDR.load(self.rdr_models_dir, self.model_name, package_name=self.package_name)
|
216
|
+
self.rdr = GeneralRDR.load(self.rdr_models_dir, self.model_name, package_name=self.package_name)
|
219
217
|
if self.rdr is None:
|
220
218
|
self.rdr = GeneralRDR(save_dir=self.rdr_models_dir, model_name=self.model_name)
|
221
219
|
|
ripple_down_rules/utils.py
CHANGED
@@ -177,6 +177,11 @@ def extract_imports(file_path: Optional[str] = None, tree: Optional[ast.AST] = N
|
|
177
177
|
try:
|
178
178
|
if node.level > 0: # Handle relative imports
|
179
179
|
package_name = get_import_path_from_path(Path(os.path.join(file_path, *['..'] * node.level)).resolve())
|
180
|
+
if package_name is not None and node.level > 0: # Handle relative imports
|
181
|
+
module_rel_path = Path(os.path.join(file_path, *['..'] * node.level, module_name)).resolve()
|
182
|
+
idx = str(module_rel_path).rfind(package_name)
|
183
|
+
if idx != -1:
|
184
|
+
module_name = str(module_rel_path)[idx:].replace(os.path.sep, '.')
|
180
185
|
try:
|
181
186
|
module = importlib.import_module(module_name, package=package_name)
|
182
187
|
except ModuleNotFoundError:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ripple_down_rules
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.47
|
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,12 @@
|
|
1
|
-
ripple_down_rules/__init__.py,sha256=
|
1
|
+
ripple_down_rules/__init__.py,sha256=eA36n1YXRokHKFHwQGjTQGszPb5BH0eP82R866uCMOA,99
|
2
2
|
ripple_down_rules/experts.py,sha256=KXwWCmDrCffu9HW3yNewqWc1e5rnPI5Rnc981w_5M7U,17896
|
3
|
+
ripple_down_rules/failures.py,sha256=ZPypPwKjyVcJkY9YG6p538ld8ZzpdW6CrC1RmJi44Ek,42
|
3
4
|
ripple_down_rules/helpers.py,sha256=X1psHOqrb4_xYN4ssQNB8S9aRKKsqgihAyWJurN0dqk,5499
|
4
|
-
ripple_down_rules/rdr.py,sha256=
|
5
|
-
ripple_down_rules/rdr_decorators.py,sha256=
|
5
|
+
ripple_down_rules/rdr.py,sha256=pG7Sn3WeKVrCwoBuroO31_d9R2vVSCw6BfbtYU1H6wE,83228
|
6
|
+
ripple_down_rules/rdr_decorators.py,sha256=ehK9YFYCh21fnbuzOX000yBwVDXL-QqYuEfKoWNYyDU,11468
|
6
7
|
ripple_down_rules/rules.py,sha256=L4Ws-x3g5ljE0GrDt4LAib2qtR1C1_Ra4cRcIB-IQDI,28702
|
7
8
|
ripple_down_rules/start-code-server.sh,sha256=otClk7VmDgBOX2TS_cjws6K0UwvgAUJhoA0ugkPCLqQ,949
|
8
|
-
ripple_down_rules/utils.py,sha256=
|
9
|
+
ripple_down_rules/utils.py,sha256=5UL4h-m5Q4l7RyCYqmUmDDxUAkFqPYpFa3QldDYoJUE,80752
|
9
10
|
ripple_down_rules/datastructures/__init__.py,sha256=V2aNgf5C96Y5-IGghra3n9uiefpoIm_QdT7cc_C8cxQ,111
|
10
11
|
ripple_down_rules/datastructures/callable_expression.py,sha256=rzMrpD5oztaCRlt3hQ2B_xZ09cSuJNkYOCePndfQJRA,13684
|
11
12
|
ripple_down_rules/datastructures/case.py,sha256=dfLnrjsHIVF2bgbz-4ID7OdQvw68V71btCeTK372P-g,15667
|
@@ -17,8 +18,8 @@ ripple_down_rules/user_interface/ipython_custom_shell.py,sha256=RLdPqPxx-a0Sh74U
|
|
17
18
|
ripple_down_rules/user_interface/object_diagram.py,sha256=FEa2HaYR9QmTE6NsOwBvZ0jqmu3DKyg6mig2VE5ZP4Y,4956
|
18
19
|
ripple_down_rules/user_interface/prompt.py,sha256=WPbw_8_-8SpF2ISyRZRuFwPKBEuGC4HaX3lbCPFHhh8,10314
|
19
20
|
ripple_down_rules/user_interface/template_file_creator.py,sha256=uSbosZS15MOR3Nv7M3MrFuoiKXyP4cBId-EK3I6stHM,13660
|
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.
|
21
|
+
ripple_down_rules-0.6.47.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
|
22
|
+
ripple_down_rules-0.6.47.dist-info/METADATA,sha256=8kqMXzC6_vZ_vwdXOWFaV4L9AIhKIMJ3D9o8e6r5ur4,48294
|
23
|
+
ripple_down_rules-0.6.47.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
24
|
+
ripple_down_rules-0.6.47.dist-info/top_level.txt,sha256=VeoLhEhyK46M1OHwoPbCQLI1EifLjChqGzhQ6WEUqeM,18
|
25
|
+
ripple_down_rules-0.6.47.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|