ripple-down-rules 0.5.81__py3-none-any.whl → 0.5.82__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.
@@ -1,4 +1,4 @@
1
- __version__ = "0.5.81"
1
+ __version__ = "0.5.82"
2
2
 
3
3
  import logging
4
4
  logger = logging.Logger("rdr")
ripple_down_rules/rdr.py CHANGED
@@ -1147,12 +1147,16 @@ class GeneralRDR(RippleDownRules):
1147
1147
  is required in case of relative imports in the generated python file.
1148
1148
  :return: The imports needed for the generated python file.
1149
1149
  """
1150
+ all_types = set()
1151
+ # add type hints
1152
+ all_types.update({Dict, Any})
1153
+ # import rdr type
1154
+ all_types.add(general_rdr_classify)
1155
+ # add case type
1156
+ all_types.update({Case, create_case, self.case_type})
1150
1157
  # get the imports from the types
1151
- imports = get_imports_from_types([self.case_type], target_file_path=file_path, package_name=package_name)
1158
+ imports = get_imports_from_types(all_types, target_file_path=file_path, package_name=package_name)
1152
1159
  # add rdr python generated functions.
1153
- imports.append("from typing import Dict, Any")
1154
- imports.append("from ripple_down_rules.datastructures.case import Case, create_case")
1155
- imports.append("from ripple_down_rules.helpers import general_rdr_classify")
1156
1160
  for rdr_key, rdr in self.start_rules_dict.items():
1157
1161
  imports.append(
1158
1162
  f"from . import {rdr.generated_python_file_name} as {self.rdr_key_to_function_name(rdr_key)}")
@@ -798,10 +798,11 @@ def get_import_path_from_path(path: str) -> Optional[str]:
798
798
  :return: The Python import path.
799
799
  """
800
800
  package_name = os.path.abspath(path)
801
- formated_package_name = package_name.strip('./').replace('/', '.')
801
+ packages = package_name.split(os.path.sep)
802
+ # formated_package_name = package_name.replace('/', '.')
802
803
  parent_package_idx = 0
803
- packages = formated_package_name.split('.')
804
- for i, possible_pacakge in enumerate(reversed(packages)):
804
+ # packages = formated_package_name.split('.')
805
+ for i in range(len(packages)):
805
806
  if i == 0:
806
807
  current_path = package_name
807
808
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ripple_down_rules
3
- Version: 0.5.81
3
+ Version: 0.5.82
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=Hf2qy117DtlfEhbMoyreqc3k02Y_tLUwlxP1IJySXWA,100
1
+ ripple_down_rules/__init__.py,sha256=EvcK7up0E4DGl8ECDklEZACHVsRITZkFbTU1K4XIpKg,100
2
2
  ripple_down_rules/experts.py,sha256=bwozulI1rv0uyaMZQqEgapDO-s8wvW0D6Jqxmvu5fik,12610
3
3
  ripple_down_rules/helpers.py,sha256=v4oE7C5PfQUVJfSUs1FfLHEwrJXEHJLn4vJhJMvyCR8,4453
4
- ripple_down_rules/rdr.py,sha256=2gh_kRmsR58pLqY4OvhjOgHSIYIcST7tI7jjVQ8yhD4,55214
4
+ ripple_down_rules/rdr.py,sha256=C6bvlq6MsKa2Mym1wW6JUMj705aCaoihTP279TM6eT0,55218
5
5
  ripple_down_rules/rdr_decorators.py,sha256=0sk7izDB53lTKSB9fm33vQahmY_05FyCOWljyQOMB0U,9072
6
6
  ripple_down_rules/rules.py,sha256=iVevv6iZ-6L2IPI0ZYbBjxBymXEQMmJGRFhiKUS-NmA,20352
7
7
  ripple_down_rules/start-code-server.sh,sha256=otClk7VmDgBOX2TS_cjws6K0UwvgAUJhoA0ugkPCLqQ,949
8
- ripple_down_rules/utils.py,sha256=mObBszTruGrRvD4MgD8tS1AnMtoyKrPl4RCciinhzY4,60132
8
+ ripple_down_rules/utils.py,sha256=ikzlXjgBWM95dgL-idzeWcYyZs2IAwgA5BXMNRoKE2w,60144
9
9
  ripple_down_rules/datastructures/__init__.py,sha256=V2aNgf5C96Y5-IGghra3n9uiefpoIm_QdT7cc_C8cxQ,111
10
10
  ripple_down_rules/datastructures/callable_expression.py,sha256=f3wUPTrLa1INO-1qfgVz87ryrCABronfyq0_JKWoZCs,12800
11
11
  ripple_down_rules/datastructures/case.py,sha256=1zSaXUljaH6z3SgMGzYPoDyjotNam791KpYgvxuMh90,15463
@@ -17,8 +17,8 @@ ripple_down_rules/user_interface/ipython_custom_shell.py,sha256=Jrf7NxOdlrwGXH0X
17
17
  ripple_down_rules/user_interface/object_diagram.py,sha256=FEa2HaYR9QmTE6NsOwBvZ0jqmu3DKyg6mig2VE5ZP4Y,4956
18
18
  ripple_down_rules/user_interface/prompt.py,sha256=AkkltdDIaioN43lkRKDPKSjJcmdSSGZDMYz7AL7X9lE,8082
19
19
  ripple_down_rules/user_interface/template_file_creator.py,sha256=xWUt-RHRqrvoMo74o-bMLo8xNxil68wgbOZAMADZp2A,13570
20
- ripple_down_rules-0.5.81.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
21
- ripple_down_rules-0.5.81.dist-info/METADATA,sha256=P3JwR4h_dcxZ9w-S7DSflG8BS9NZvW-IrCNF1-H3-dA,48214
22
- ripple_down_rules-0.5.81.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
- ripple_down_rules-0.5.81.dist-info/top_level.txt,sha256=VeoLhEhyK46M1OHwoPbCQLI1EifLjChqGzhQ6WEUqeM,18
24
- ripple_down_rules-0.5.81.dist-info/RECORD,,
20
+ ripple_down_rules-0.5.82.dist-info/licenses/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
21
+ ripple_down_rules-0.5.82.dist-info/METADATA,sha256=tfAM6oWHtT8rHwL7tkPaZV4r_L4EOObvAzu68H9DAc4,48214
22
+ ripple_down_rules-0.5.82.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ ripple_down_rules-0.5.82.dist-info/top_level.txt,sha256=VeoLhEhyK46M1OHwoPbCQLI1EifLjChqGzhQ6WEUqeM,18
24
+ ripple_down_rules-0.5.82.dist-info/RECORD,,