ripple-down-rules 0.5.81__tar.gz → 0.5.83__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.
Files changed (151) hide show
  1. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/PKG-INFO +1 -1
  2. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/__init__.py +1 -1
  3. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/rdr.py +8 -4
  4. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/rdr_decorators.py +8 -4
  5. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/utils.py +4 -3
  6. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules.egg-info/PKG-INFO +1 -1
  7. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/conf/world/handles_and_containers.py +3 -4
  8. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/conftest.py +2 -2
  9. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/datasets.py +4 -2
  10. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/factories/world/handles_and_containers.py +2 -2
  11. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_helpers/helpers.py +1 -1
  12. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_json_serialization.py +2 -2
  13. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_object_diagram.py +1 -1
  14. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_rdr.py +3 -3
  15. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_rdr_alchemy.py +2 -2
  16. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_rdr_decorators.py +1 -1
  17. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_rdr_world/conftest.py +2 -2
  18. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_rdr_world/test_rdr_world.py +1 -1
  19. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_relational_rdr.py +1 -1
  20. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_results/datasets_physical_object_is_a_robot/physical_object_is_a_robot_output__scrdr_defs.py +1 -1
  21. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_results/datasets_physical_object_is_a_robot/physical_object_is_a_robot_rdr.py +1 -2
  22. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_results/datasets_physical_object_is_a_robot/rdr_metadata/datasets_physical_object_is_a_robot.json +4 -4
  23. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_results/datasets_physical_object_select_objects_that_are_parts_of_robot/physical_object_select_objects_that_are_parts_of_robot_output__mcrdr_defs.py +1 -1
  24. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_results/datasets_physical_object_select_objects_that_are_parts_of_robot/physical_object_select_objects_that_are_parts_of_robot_rdr.py +1 -2
  25. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_results/datasets_physical_object_select_objects_that_are_parts_of_robot/rdr_metadata/datasets_physical_object_select_objects_that_are_parts_of_robot.json +5 -5
  26. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_sql_model.py +1 -1
  27. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_template_file_creator.py +3 -3
  28. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_user_interface/test_prompt.py +1 -1
  29. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_user_interface/test_qt_gui_inline.py +3 -3
  30. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_utils.py +2 -2
  31. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/.github/workflows/build_and_deploy_doc.yml +0 -0
  32. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/.github/workflows/ci.yml +0 -0
  33. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/.github/workflows/publish-to-test-pypi.yml +0 -0
  34. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/.idea/shelf/Uncommitted_changes_before_Checkout_at_2_4_25,_6_32_PM_[Changes]/shelved.patch +0 -0
  35. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/.idea/shelf/Uncommitted_changes_before_Checkout_at_2_4_25,_6_32_PM_[Changes]1/shelved.patch +0 -0
  36. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/LICENSE +0 -0
  37. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/README.md +0 -0
  38. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/doc/_config.yml +0 -0
  39. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/doc/_toc.yml +0 -0
  40. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/doc/bibliography.md +0 -0
  41. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/doc/intro.md +0 -0
  42. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/doc/references.bib +0 -0
  43. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/doc/requirements.txt +0 -0
  44. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/examples/__init__.py +0 -0
  45. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/examples/animal_species.py +0 -0
  46. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/examples/part_containment_rdr/__init__.py +0 -0
  47. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/examples/part_containment_rdr/rdr_metadata/part_containment_rdr.json +0 -0
  48. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/examples/part_containment_rdr/robot_contained_objects_mcrdr.py +0 -0
  49. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/examples/part_containment_rdr/robot_contained_objects_mcrdr_defs.py +0 -0
  50. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/examples/part_containment_rdr/robot_rdr.py +0 -0
  51. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/examples/relational_example.py +0 -0
  52. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/images/scrdr.dot +0 -0
  53. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/images/scrdr.png +0 -0
  54. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/images/thinking_pr2.jpg +0 -0
  55. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/pyproject.toml +0 -0
  56. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/pytest.ini +0 -0
  57. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/requirements-dev-ci.txt +0 -0
  58. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/requirements-dev.txt +0 -0
  59. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/requirements-gui.txt +0 -0
  60. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/requirements-viz.txt +0 -0
  61. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/requirements.txt +0 -0
  62. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/complete_mcrdr_extra.dot +0 -0
  63. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/complete_mcrdr_extra.png +0 -0
  64. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/complete_mcrdr_stop_only.dot +0 -0
  65. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/complete_mcrdr_stop_only.png +0 -0
  66. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/complete_mcrdr_stop_plus_rule.dot +0 -0
  67. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/complete_mcrdr_stop_plus_rule.png +0 -0
  68. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/complete_scrdr.dot +0 -0
  69. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/complete_scrdr.png +0 -0
  70. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/complete_scrdr_2.dot +0 -0
  71. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/complete_scrdr_2.png +0 -0
  72. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/complete_scrdr_3.dot +0 -0
  73. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/complete_scrdr_3.png +0 -0
  74. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/grdr_Habitat.dot +0 -0
  75. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/grdr_Habitat.png +0 -0
  76. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/grdr_Species.dot +0 -0
  77. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/grdr_Species.png +0 -0
  78. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/mcrdr_extra.dot +0 -0
  79. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/mcrdr_extra.png +0 -0
  80. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/mcrdr_extra_classify.dot +0 -0
  81. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/mcrdr_extra_classify.png +0 -0
  82. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/mcrdr_stop_plus_rule_combined.dot +0 -0
  83. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/mcrdr_stop_plus_rule_combined.png +0 -0
  84. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/partial_mcrdr_extra.dot +0 -0
  85. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/partial_mcrdr_extra.png +0 -0
  86. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/relational_scrdr_classify.dot +0 -0
  87. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/results/relational_scrdr_classify.png +0 -0
  88. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/setup.cfg +0 -0
  89. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/datastructures/__init__.py +0 -0
  90. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/datastructures/callable_expression.py +0 -0
  91. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/datastructures/case.py +0 -0
  92. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/datastructures/dataclasses.py +0 -0
  93. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/datastructures/enums.py +0 -0
  94. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/experts.py +0 -0
  95. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/helpers.py +0 -0
  96. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/rules.py +0 -0
  97. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/start-code-server.sh +0 -0
  98. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/user_interface/__init__.py +0 -0
  99. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/user_interface/gui.py +0 -0
  100. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/user_interface/ipython_custom_shell.py +0 -0
  101. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/user_interface/object_diagram.py +0 -0
  102. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/user_interface/prompt.py +0 -0
  103. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules/user_interface/template_file_creator.py +0 -0
  104. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules.egg-info/SOURCES.txt +0 -0
  105. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules.egg-info/dependency_links.txt +0 -0
  106. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules.egg-info/requires.txt +0 -0
  107. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/src/ripple_down_rules.egg-info/top_level.txt +0 -0
  108. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/__init__.py +0 -0
  109. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/conf/__init__.py +0 -0
  110. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/conf/world/__init__.py +0 -0
  111. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/conf/world/base_config.py +0 -0
  112. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/factories/__init__.py +0 -0
  113. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/factories/world/__init__.py +0 -0
  114. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/correct_drawer_rdr_expert_answers_fit.json +0 -0
  115. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/drawer_cabinet_expert_answers_fit.json +0 -0
  116. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/grdr_expert_answers_classify.json +0 -0
  117. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/grdr_expert_answers_fit.json +0 -0
  118. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/grdr_expert_answers_fit_extra.json +0 -0
  119. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/grdr_expert_answers_fit_no_targets.json +0 -0
  120. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/mcrdr_expert_answers_classify.json +0 -0
  121. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/mcrdr_expert_answers_fit_no_targets.json +0 -0
  122. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/mcrdr_expert_answers_stop_only_fit.json +0 -0
  123. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/mcrdr_extra_expert_answers_classify.json +0 -0
  124. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/mcrdr_extra_expert_answers_fit.json +0 -0
  125. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/mcrdr_multi_line_expert_answers_fit.json +0 -0
  126. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/mcrdr_stop_only_answers_fit.json +0 -0
  127. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/mcrdr_stop_plus_rule_answers_fit.json +0 -0
  128. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/mcrdr_stop_plus_rule_combined_expert_answers_fit.json +0 -0
  129. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/mcrdr_stop_plus_rule_expert_answers_fit.json +0 -0
  130. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/mutagenic_expert_answers.json +0 -0
  131. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/relational_scrdr_expert_answers_classify.json +0 -0
  132. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/scrdr_expert_answers_classify.json +0 -0
  133. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/scrdr_expert_answers_fit.json +0 -0
  134. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/scrdr_expert_answers_fit_no_targets.json +0 -0
  135. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/scrdr_multi_line_expert_answers_fit.json +0 -0
  136. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_expert_answers/scrdr_world_expert_answers_fit.json +0 -0
  137. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_generated_rdrs/__init__.py +0 -0
  138. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_helpers/__init__.py +0 -0
  139. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_helpers/object_diagram_case_query.png +0 -0
  140. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_helpers/object_diagram_person.png +0 -0
  141. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_on_mutagenic.py +0 -0
  142. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_rdr_helpers_rdrs.py +0 -0
  143. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_rdr_world/__init__.py +0 -0
  144. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_relational_rdr_alchemy.py +0 -0
  145. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_results/datasets_physical_object_is_a_robot/__init__.py +0 -0
  146. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_results/datasets_physical_object_is_a_robot/physical_object_is_a_robot_output__scrdr.py +0 -0
  147. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_results/datasets_physical_object_select_objects_that_are_parts_of_robot/__init__.py +0 -0
  148. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_results/datasets_physical_object_select_objects_that_are_parts_of_robot/physical_object_select_objects_that_are_parts_of_robot_output__mcrdr.py +0 -0
  149. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_user_interface/__init__.py +0 -0
  150. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_user_interface/test_ipython.py +0 -0
  151. {ripple_down_rules-0.5.81 → ripple_down_rules-0.5.83}/test/test_user_interface/test_ipython_copilot.py +0 -0
@@ -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.83
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,4 +1,4 @@
1
- __version__ = "0.5.81"
1
+ __version__ = "0.5.83"
2
2
 
3
3
  import logging
4
4
  logger = logging.Logger("rdr")
@@ -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)}")
@@ -31,7 +31,8 @@ class RDRDecorator:
31
31
  expert: Optional[Expert] = None,
32
32
  ask_always: bool = False,
33
33
  update_existing_rules: bool = True,
34
- viewer: Optional[RDRCaseViewer] = None):
34
+ viewer: Optional[RDRCaseViewer] = None,
35
+ package_name: Optional[str] = None):
35
36
  """
36
37
  :param models_dir: The directory to save/load the RDR models.
37
38
  :param output_type: The type of the output. This is used to create the RDR model.
@@ -46,6 +47,8 @@ class RDRDecorator:
46
47
  :param ask_always: If True, the function will ask the user for a target if it doesn't exist.
47
48
  :param update_existing_rules: If True, the function will update the existing RDR rules
48
49
  even if they gave an output.
50
+ :param viewer: The viewer to use for the RDR model. If None, no viewer will be used.
51
+ :param package_name: The package name to use for relative imports in the RDR model.
49
52
  :return: A decorator to use a GeneralRDR as a classifier that monitors and modifies the function's output.
50
53
  """
51
54
  self.rdr_models_dir = models_dir
@@ -59,6 +62,7 @@ class RDRDecorator:
59
62
  self.ask_always = ask_always
60
63
  self.update_existing_rules = update_existing_rules
61
64
  self.viewer = viewer
65
+ self.package_name = package_name
62
66
  self.load()
63
67
 
64
68
  def decorator(self, func: Callable) -> Callable:
@@ -166,7 +170,7 @@ class RDRDecorator:
166
170
  """
167
171
  Save the RDR model to the specified directory.
168
172
  """
169
- self.rdr.save(self.rdr_models_dir)
173
+ self.rdr.save(self.rdr_models_dir, package_name=self.package_name)
170
174
 
171
175
  def load(self):
172
176
  """
@@ -176,7 +180,7 @@ class RDRDecorator:
176
180
  if self.model_name is not None:
177
181
  model_path = os.path.join(self.rdr_models_dir, self.model_name + f"/rdr_metadata/{self.model_name}.json")
178
182
  if os.path.exists(os.path.join(self.rdr_models_dir, model_path)):
179
- self.rdr = GeneralRDR.load(self.rdr_models_dir, self.model_name)
183
+ self.rdr = GeneralRDR.load(self.rdr_models_dir, self.model_name, package_name=self.package_name)
180
184
  self.rdr.set_viewer(self.viewer)
181
185
  if self.rdr is None:
182
186
  self.rdr = GeneralRDR(save_dir=self.rdr_models_dir, model_name=self.model_name,
@@ -186,4 +190,4 @@ class RDRDecorator:
186
190
  """
187
191
  Update the RDR model from a python file.
188
192
  """
189
- self.rdr.update_from_python(self.rdr_models_dir, self.model_name)
193
+ self.rdr.update_from_python(self.rdr_models_dir, self.model_name, package_name=self.package_name)
@@ -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.83
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,13 +1,12 @@
1
1
  # ===================== Possible World Configurations ========================
2
2
  from dataclasses import dataclass, field
3
3
 
4
- from jedi.inference.gradual.typing import Callable
5
- from typing_extensions import List
4
+ from typing_extensions import List, Callable
6
5
 
7
- from conf.world.base_config import WorldConf, BodyConf, Connection, FixedConnectionConf, PrismaticConnectionConf, \
6
+ from .base_config import WorldConf, BodyConf, Connection, FixedConnectionConf, PrismaticConnectionConf, \
8
7
  ContainerConf, HandleConf
9
8
 
10
- from factories.world.handles_and_containers import create_world_with_handles_and_containers
9
+ from ...factories.world.handles_and_containers import create_world_with_handles_and_containers
11
10
 
12
11
 
13
12
  @dataclass
@@ -11,8 +11,8 @@ except ImportError as e:
11
11
  QApplication = None
12
12
  RDRCaseViewer = None
13
13
 
14
- from conf.world.handles_and_containers import HandlesAndContainersWorld
15
- from datasets import *
14
+ from .conf.world.handles_and_containers import HandlesAndContainersWorld
15
+ from .datasets import *
16
16
  from ripple_down_rules.datastructures.dataclasses import CaseQuery
17
17
  from ripple_down_rules.experts import Human
18
18
  from ripple_down_rules.helpers import is_matching
@@ -132,11 +132,13 @@ class PhysicalObject:
132
132
  """
133
133
  The directory where the RDR serialized JSON files are stored.
134
134
  """
135
- _is_a_robot_rdr: RDRDecorator = RDRDecorator(_rdr_json_dir, (bool,), True)
135
+ _is_a_robot_rdr: RDRDecorator = RDRDecorator(_rdr_json_dir, (bool,), True,
136
+ package_name="test")
136
137
  """
137
138
  The RDR decorator that is used to determine if the object is a robot or not.
138
139
  """
139
- _select_parts_rdr: RDRDecorator = RDRDecorator(_rdr_json_dir, (Self,), False)
140
+ _select_parts_rdr: RDRDecorator = RDRDecorator(_rdr_json_dir, (Self,), False,
141
+ package_name="test")
140
142
  """
141
143
  The RDR decorator that is used to determine if the object is a robot or not.
142
144
  """
@@ -1,5 +1,5 @@
1
- from datasets import World, Handle, Container, FixedConnection, PrismaticConnection
2
- from conf.world.base_config import WorldConf, HandleConf, ContainerConf, FixedConnectionConf, PrismaticConnectionConf
1
+ from ...datasets import World, Handle, Container, FixedConnection, PrismaticConnection
2
+ from ...conf.world.base_config import WorldConf, HandleConf, ContainerConf, FixedConnectionConf, PrismaticConnectionConf
3
3
 
4
4
 
5
5
  def create_world_with_handles_and_containers(world_conf: WorldConf) -> World:
@@ -3,7 +3,7 @@ import os
3
3
 
4
4
  from typing_extensions import List, Any, Tuple, Type, Callable, Optional
5
5
 
6
- from datasets import Species, Habitat, load_zoo_cases
6
+ from ..datasets import Species, Habitat, load_zoo_cases
7
7
  from ripple_down_rules.datastructures.case import Case
8
8
  from ripple_down_rules.datastructures.dataclasses import CaseQuery
9
9
  from ripple_down_rules.datastructures.enums import Category
@@ -3,11 +3,11 @@ from unittest import TestCase
3
3
 
4
4
  from typing_extensions import List
5
5
 
6
- from datasets import load_zoo_dataset
6
+ from .datasets import load_zoo_dataset
7
7
  from ripple_down_rules.datastructures.dataclasses import Case
8
8
  from ripple_down_rules.rdr import SingleClassRDR, MultiClassRDR, GeneralRDR
9
9
  from ripple_down_rules.utils import make_set, flatten_list, serialize_dataclass, deserialize_dataclass
10
- from test_helpers.helpers import get_fit_mcrdr, get_fit_scrdr, get_fit_grdr
10
+ from .test_helpers.helpers import get_fit_mcrdr, get_fit_scrdr, get_fit_grdr
11
11
 
12
12
 
13
13
  @dataclass
@@ -1,7 +1,7 @@
1
1
  import os
2
2
  import unittest
3
3
 
4
- from datasets import load_zoo_dataset, Species
4
+ from .datasets import load_zoo_dataset, Species
5
5
  from ripple_down_rules.datastructures.dataclasses import CaseQuery
6
6
  from ripple_down_rules.user_interface.object_diagram import generate_object_graph
7
7
 
@@ -4,15 +4,15 @@ from unittest import TestCase
4
4
 
5
5
  from typing_extensions import List, Optional
6
6
 
7
- from datasets import Habitat, Species, load_zoo_cases
8
- from datasets import load_zoo_dataset
7
+ from .datasets import Habitat, Species, load_zoo_cases
8
+ from .datasets import load_zoo_dataset
9
9
  from ripple_down_rules.datastructures.case import Case
10
10
  from ripple_down_rules.datastructures.dataclasses import CaseQuery
11
11
  from ripple_down_rules.datastructures.enums import MCRDRMode
12
12
  from ripple_down_rules.experts import Human
13
13
  from ripple_down_rules.rdr import SingleClassRDR, MultiClassRDR, GeneralRDR, RDRWithCodeWriter
14
14
  from ripple_down_rules.utils import render_tree, make_set, extract_function_source
15
- from test_helpers.helpers import get_fit_scrdr, get_fit_mcrdr, get_fit_grdr
15
+ from .test_helpers.helpers import get_fit_scrdr, get_fit_mcrdr, get_fit_grdr
16
16
 
17
17
  try:
18
18
  from PyQt6.QtWidgets import QApplication
@@ -7,12 +7,12 @@ from sqlalchemy.orm import MappedColumn as Column
7
7
  from typing_extensions import List, Sequence
8
8
  import pandas as pd
9
9
 
10
- from datasets import Base, MappedAnimal, Species, get_dataset, Habitat, HabitatTable
10
+ from .datasets import Base, MappedAnimal, Species, get_dataset, Habitat, HabitatTable
11
11
  from ripple_down_rules.datastructures.dataclasses import CaseQuery
12
12
  from ripple_down_rules.experts import Human
13
13
  from ripple_down_rules.rdr import SingleClassRDR, MultiClassRDR, GeneralRDR
14
14
  from ripple_down_rules.utils import make_set
15
- from test_helpers.helpers import get_fit_scrdr
15
+ from .test_helpers.helpers import get_fit_scrdr
16
16
 
17
17
 
18
18
  class TestAlchemyRDR(TestCase):
@@ -1,5 +1,5 @@
1
1
  import unittest
2
- from datasets import PhysicalObject, Part, Robot
2
+ from .datasets import PhysicalObject, Part, Robot
3
3
 
4
4
 
5
5
  class RDRDecoratorsTestCase(unittest.TestCase):
@@ -12,8 +12,8 @@ except ImportError as e:
12
12
  QApplication = None
13
13
  RDRCaseViewer = None
14
14
 
15
- from conf.world.handles_and_containers import HandlesAndContainersWorld
16
- from datasets import *
15
+ from ..conf.world.handles_and_containers import HandlesAndContainersWorld
16
+ from ..datasets import *
17
17
  from ripple_down_rules.datastructures.dataclasses import CaseQuery
18
18
  from ripple_down_rules.experts import Human
19
19
  from ripple_down_rules.helpers import is_matching
@@ -9,7 +9,7 @@ except ImportError as e:
9
9
  QApplication = None
10
10
  RDRCaseViewer = None
11
11
 
12
- from datasets import *
12
+ from ..datasets import *
13
13
  from ripple_down_rules.helpers import is_matching
14
14
  from ripple_down_rules.rdr import GeneralRDR
15
15
 
@@ -5,7 +5,7 @@ from unittest import TestCase
5
5
 
6
6
  from typing_extensions import List, Any
7
7
 
8
- from datasets import Robot, Part, PhysicalObject
8
+ from .datasets import Robot, Part, PhysicalObject
9
9
  from ripple_down_rules.datastructures.case import CaseAttribute
10
10
  from ripple_down_rules.datastructures.dataclasses import CaseQuery, CallableExpression
11
11
  from ripple_down_rules.experts import Human
@@ -1,4 +1,4 @@
1
- from datasets import PhysicalObject, Robot
1
+ from ...datasets import PhysicalObject, Robot
2
2
  from typing import Dict
3
3
 
4
4
 
@@ -1,7 +1,6 @@
1
- from typing import Dict
2
- from typing import Dict, Any
3
1
  from ripple_down_rules.datastructures.case import Case, create_case
4
2
  from ripple_down_rules.helpers import general_rdr_classify
3
+ from typing import Any, Dict
5
4
  from . import physical_object_is_a_robot_output__scrdr as output__classifier
6
5
 
7
6
  classifiers_dict = dict()
@@ -12,8 +12,8 @@
12
12
  "builtins.bool"
13
13
  ],
14
14
  "scope": {
15
- "PhysicalObject": "datasets.PhysicalObject",
16
- "Robot": "datasets.Robot",
15
+ "PhysicalObject": "test.datasets.PhysicalObject",
16
+ "Robot": "test.datasets.Robot",
17
17
  "Dict": "typing.Dict"
18
18
  },
19
19
  "conclusion": {
@@ -29,8 +29,8 @@
29
29
  "builtins.bool"
30
30
  ],
31
31
  "scope": {
32
- "PhysicalObject": "datasets.PhysicalObject",
33
- "Robot": "datasets.Robot",
32
+ "PhysicalObject": "test.datasets.PhysicalObject",
33
+ "Robot": "test.datasets.Robot",
34
34
  "Dict": "typing.Dict"
35
35
  },
36
36
  "conclusion": {
@@ -1,4 +1,4 @@
1
- from datasets import PhysicalObject, Robot
1
+ from ...datasets import PhysicalObject, Robot
2
2
  from typing import Dict, List, Union
3
3
 
4
4
 
@@ -1,7 +1,6 @@
1
- from typing import Dict
2
- from typing import Dict, Any
3
1
  from ripple_down_rules.datastructures.case import Case, create_case
4
2
  from ripple_down_rules.helpers import general_rdr_classify
3
+ from typing import Any, Dict
5
4
  from . import physical_object_select_objects_that_are_parts_of_robot_output__mcrdr as output__classifier
6
5
 
7
6
  classifiers_dict = dict()
@@ -12,8 +12,8 @@
12
12
  "builtins.bool"
13
13
  ],
14
14
  "scope": {
15
- "PhysicalObject": "datasets.PhysicalObject",
16
- "Robot": "datasets.Robot",
15
+ "PhysicalObject": "test.datasets.PhysicalObject",
16
+ "Robot": "test.datasets.Robot",
17
17
  "Dict": "typing.Dict",
18
18
  "List": "typing.List",
19
19
  "Union": "typing.Union"
@@ -28,13 +28,13 @@
28
28
  "_type": "ripple_down_rules.datastructures.callable_expression.CallableExpression",
29
29
  "user_input": "def _get_value(case):\n def physical_object_select_objects_that_are_parts_of_robot(self_: PhysicalObject, objects: List[PhysicalObject], robot: Robot, output_: PhysicalObject) -> List[PhysicalObject]:\n \"\"\"Get possible value(s) for PhysicalObject_select_objects_that_are_parts_of_robot.output_ of type PhysicalObject.\"\"\"\n robot_parts = [obj for obj in objects if obj in robot.parts]\n return robot_parts\n return physical_object_select_objects_that_are_parts_of_robot(**case)\n ",
30
30
  "conclusion_type": [
31
- "datasets.PhysicalObject",
31
+ "test.datasets.PhysicalObject",
32
32
  "builtins.set",
33
33
  "builtins.list"
34
34
  ],
35
35
  "scope": {
36
- "PhysicalObject": "datasets.PhysicalObject",
37
- "Robot": "datasets.Robot",
36
+ "PhysicalObject": "test.datasets.PhysicalObject",
37
+ "Robot": "test.datasets.Robot",
38
38
  "Dict": "typing.Dict",
39
39
  "List": "typing.List",
40
40
  "Union": "typing.Union"
@@ -2,7 +2,7 @@ import unittest
2
2
 
3
3
  from sqlalchemy import select
4
4
 
5
- from datasets import *
5
+ from .datasets import *
6
6
 
7
7
 
8
8
  class TestDDL(unittest.TestCase):
@@ -8,8 +8,8 @@ from ripple_down_rules.datastructures.enums import PromptFor
8
8
  from ripple_down_rules.rdr_decorators import RDRDecorator
9
9
  from ripple_down_rules.user_interface.template_file_creator import TemplateFileCreator
10
10
  from ripple_down_rules.utils import make_set
11
- from datasets import World, Handle, Container
12
- from datasets import Part, PhysicalObject, Robot
11
+ from .datasets import World, Handle, Container
12
+ from .datasets import Part, PhysicalObject, Robot
13
13
 
14
14
 
15
15
 
@@ -73,7 +73,7 @@ def test_rdr_decorator_func_name():
73
73
  def test_load():
74
74
  # Test the load function
75
75
  world = World()
76
- imports = "from datasets import World\n\n\n"
76
+ imports = "from test.datasets import World\n\n\n"
77
77
  func_code = "def test_func(case):\n return case"
78
78
  source_code = f"{imports}{func_code}\n"
79
79
  source_code = dedent(source_code)
@@ -3,7 +3,7 @@ from unittest import TestCase, skip
3
3
  from ripple_down_rules.datastructures.dataclasses import CaseQuery
4
4
  from ripple_down_rules.datastructures.enums import PromptFor
5
5
  from ripple_down_rules.user_interface.prompt import UserPrompt
6
- from datasets import World, Handle, Container, FixedConnection, PrismaticConnection
6
+ from ..datasets import World, Handle, Container, FixedConnection, PrismaticConnection
7
7
 
8
8
 
9
9
  class TestPrompt(TestCase):
@@ -11,11 +11,11 @@ except ImportError as e:
11
11
  style = None
12
12
  from typing_extensions import List
13
13
 
14
- from datasets import load_zoo_dataset, Species
14
+ from ..datasets import load_zoo_dataset, Species
15
15
  from ripple_down_rules.datastructures.case import Case
16
16
  from ripple_down_rules.datastructures.dataclasses import CaseQuery
17
- from test_helpers.helpers import get_fit_grdr
18
- from test_object_diagram import Person, Address
17
+ from ..test_helpers.helpers import get_fit_grdr
18
+ from ..test_object_diagram import Person, Address
19
19
 
20
20
 
21
21
  @unittest.skipIf(QApplication is None, "GUI tests need PyQt6,"
@@ -64,11 +64,11 @@ class UtilsTestCase(TestCase):
64
64
  assert rel_import == expected_import
65
65
 
66
66
  def test_get_imports_from_types(self):
67
- from datasets import World, Species
67
+ from .datasets import World, Species
68
68
 
69
69
  imports = get_imports_from_types([World, Species])
70
70
 
71
- assert imports == ["from datasets import Species, World"]
71
+ assert imports == ["from test.datasets import Species, World"]
72
72
 
73
73
  from ripple_down_rules.rdr import GeneralRDR
74
74