ripple-down-rules 0.5.58__py3-none-any.whl → 0.5.59__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 +2 -1
- ripple_down_rules/utils.py +21 -18
- {ripple_down_rules-0.5.58.dist-info → ripple_down_rules-0.5.59.dist-info}/METADATA +1 -1
- {ripple_down_rules-0.5.58.dist-info → ripple_down_rules-0.5.59.dist-info}/RECORD +8 -8
- {ripple_down_rules-0.5.58.dist-info → ripple_down_rules-0.5.59.dist-info}/WHEEL +0 -0
- {ripple_down_rules-0.5.58.dist-info → ripple_down_rules-0.5.59.dist-info}/licenses/LICENSE +0 -0
- {ripple_down_rules-0.5.58.dist-info → ripple_down_rules-0.5.59.dist-info}/top_level.txt +0 -0
ripple_down_rules/__init__.py
CHANGED
ripple_down_rules/rdr.py
CHANGED
@@ -493,7 +493,8 @@ class RDRWithCodeWriter(RippleDownRules, ABC):
|
|
493
493
|
return self.start_rule.conclusion_name
|
494
494
|
|
495
495
|
def _to_json(self) -> Dict[str, Any]:
|
496
|
-
return {"start_rule": self.start_rule.to_json(),
|
496
|
+
return {"start_rule": self.start_rule.to_json(),
|
497
|
+
"generated_python_file_name": self.generated_python_file_name,
|
497
498
|
"name": self.name,
|
498
499
|
"case_type": get_full_class_name(self.case_type) if self.case_type is not None else None,
|
499
500
|
"case_name": self.case_name}
|
ripple_down_rules/utils.py
CHANGED
@@ -497,21 +497,8 @@ def serialize_dataclass(obj: Any, seen=None) -> Any:
|
|
497
497
|
value = getattr(obj, f.name)
|
498
498
|
result['fields'][f.name] = serialize_dataclass(value, seen)
|
499
499
|
return result
|
500
|
-
elif isinstance(obj, list):
|
501
|
-
return [serialize_dataclass(v, seen) for v in obj]
|
502
|
-
elif isinstance(obj, dict):
|
503
|
-
serialized_dict = {}
|
504
|
-
for k, v in obj.items():
|
505
|
-
if not isinstance(k, (str, int, bool, float, type(None))):
|
506
|
-
continue
|
507
|
-
serialized_dict[k] = serialize_dataclass(v, seen)
|
508
|
-
return serialized_dict
|
509
500
|
else:
|
510
|
-
|
511
|
-
json.dumps(obj) # Check if the object is JSON serializable
|
512
|
-
return obj
|
513
|
-
except TypeError:
|
514
|
-
return None
|
501
|
+
return SubclassJSONSerializer.to_json_static(obj, seen)
|
515
502
|
|
516
503
|
|
517
504
|
def deserialize_dataclass(data: Any, refs: Optional[Dict[str, Any]] = None) -> Any:
|
@@ -875,10 +862,26 @@ class SubclassJSONSerializer:
|
|
875
862
|
return data
|
876
863
|
|
877
864
|
@staticmethod
|
878
|
-
def to_json_static(obj) ->
|
879
|
-
if
|
880
|
-
return
|
881
|
-
|
865
|
+
def to_json_static(obj, seen=None) -> Any:
|
866
|
+
if isinstance(obj, SubclassJSONSerializer):
|
867
|
+
return {"_type": get_full_class_name(obj.__class__), **obj._to_json()}
|
868
|
+
elif is_dataclass(obj):
|
869
|
+
return serialize_dataclass(obj, seen)
|
870
|
+
elif isinstance(obj, list):
|
871
|
+
return [SubclassJSONSerializer.to_json_static(v, seen) for v in obj]
|
872
|
+
elif isinstance(obj, dict):
|
873
|
+
serialized_dict = {}
|
874
|
+
for k, v in obj.items():
|
875
|
+
if not isinstance(k, (str, int, bool, float, type(None))):
|
876
|
+
continue
|
877
|
+
serialized_dict[k] = SubclassJSONSerializer.to_json_static(v, seen)
|
878
|
+
return serialized_dict
|
879
|
+
else:
|
880
|
+
try:
|
881
|
+
json.dumps(obj) # Check if the object is JSON serializable
|
882
|
+
return obj
|
883
|
+
except TypeError:
|
884
|
+
return None
|
882
885
|
|
883
886
|
def to_json(self) -> Dict[str, Any]:
|
884
887
|
return self.to_json_static(self)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: ripple_down_rules
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.59
|
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=B7Eu1dTZ_vwgcvPoR4pAqnxwQQ6bT8WDK-ftMsFm3IE,100
|
2
2
|
ripple_down_rules/experts.py,sha256=8p5tFOWuQWgp9gt-6Yr6MFFphOTmpI9IJ3iepUyy3FY,12266
|
3
3
|
ripple_down_rules/helpers.py,sha256=TvTJU0BA3dPcAyzvZFvAu7jZqsp8Lu0HAAwvuizlGjg,2018
|
4
|
-
ripple_down_rules/rdr.py,sha256=
|
4
|
+
ripple_down_rules/rdr.py,sha256=oArXOfPichP9U-w2NqZtsdiDPO0_JQy9I8ZaCB9rpA8,48880
|
5
5
|
ripple_down_rules/rdr_decorators.py,sha256=pYCKLgMKgQ6x_252WQtF2t4ZNjWPBxnaWtJ6TpGdcc0,7820
|
6
6
|
ripple_down_rules/rules.py,sha256=TPNVMqW9T-_46BS4WemrspLg5uG8kP6tsPvWWBAzJxg,17515
|
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=N5Rgz7wb9oKrVLZiJG2P-irnsjhy7VR3Vqyggf4Mq7I,51564
|
9
9
|
ripple_down_rules/datastructures/__init__.py,sha256=V2aNgf5C96Y5-IGghra3n9uiefpoIm_QdT7cc_C8cxQ,111
|
10
10
|
ripple_down_rules/datastructures/callable_expression.py,sha256=w6Gpo1o-xnFvTaPrzJ2w7VgCjSr1xqp8LQG0jAl-mfc,12718
|
11
11
|
ripple_down_rules/datastructures/case.py,sha256=r8kjL9xP_wk84ThXusspgPMrAoed2bGQmKi54fzhmH8,15258
|
@@ -17,8 +17,8 @@ ripple_down_rules/user_interface/ipython_custom_shell.py,sha256=24MIFwqnAhC6ofOb
|
|
17
17
|
ripple_down_rules/user_interface/object_diagram.py,sha256=tsB6iuLNEbHxp5lR2WjyejjWbnAX_nHF9xS8jNPOQVk,4548
|
18
18
|
ripple_down_rules/user_interface/prompt.py,sha256=AkkltdDIaioN43lkRKDPKSjJcmdSSGZDMYz7AL7X9lE,8082
|
19
19
|
ripple_down_rules/user_interface/template_file_creator.py,sha256=FGtLfYBfr4310c7Dfa9b2qiOWLNzHk1q3kdhD70Ilg4,13804
|
20
|
-
ripple_down_rules-0.5.
|
21
|
-
ripple_down_rules-0.5.
|
22
|
-
ripple_down_rules-0.5.
|
23
|
-
ripple_down_rules-0.5.
|
24
|
-
ripple_down_rules-0.5.
|
20
|
+
ripple_down_rules-0.5.59.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
|
21
|
+
ripple_down_rules-0.5.59.dist-info/METADATA,sha256=H-f6jFY9wnjFtKoYkhPf5dNyQU1k3egp0v8PSNraBEo,48189
|
22
|
+
ripple_down_rules-0.5.59.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
23
|
+
ripple_down_rules-0.5.59.dist-info/top_level.txt,sha256=VeoLhEhyK46M1OHwoPbCQLI1EifLjChqGzhQ6WEUqeM,18
|
24
|
+
ripple_down_rules-0.5.59.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|