ripple-down-rules 0.5.83__tar.gz → 0.5.85__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.83 → ripple_down_rules-0.5.85}/PKG-INFO +1 -1
  2. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/__init__.py +1 -1
  3. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/utils.py +22 -3
  4. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules.egg-info/PKG-INFO +1 -1
  5. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/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 +1 -1
  6. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_utils.py +2 -1
  7. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/.github/workflows/build_and_deploy_doc.yml +0 -0
  8. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/.github/workflows/ci.yml +0 -0
  9. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/.github/workflows/publish-to-test-pypi.yml +0 -0
  10. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/.idea/shelf/Uncommitted_changes_before_Checkout_at_2_4_25,_6_32_PM_[Changes]/shelved.patch +0 -0
  11. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/.idea/shelf/Uncommitted_changes_before_Checkout_at_2_4_25,_6_32_PM_[Changes]1/shelved.patch +0 -0
  12. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/LICENSE +0 -0
  13. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/README.md +0 -0
  14. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/doc/_config.yml +0 -0
  15. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/doc/_toc.yml +0 -0
  16. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/doc/bibliography.md +0 -0
  17. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/doc/intro.md +0 -0
  18. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/doc/references.bib +0 -0
  19. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/doc/requirements.txt +0 -0
  20. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/examples/__init__.py +0 -0
  21. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/examples/animal_species.py +0 -0
  22. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/examples/part_containment_rdr/__init__.py +0 -0
  23. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/examples/part_containment_rdr/rdr_metadata/part_containment_rdr.json +0 -0
  24. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/examples/part_containment_rdr/robot_contained_objects_mcrdr.py +0 -0
  25. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/examples/part_containment_rdr/robot_contained_objects_mcrdr_defs.py +0 -0
  26. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/examples/part_containment_rdr/robot_rdr.py +0 -0
  27. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/examples/relational_example.py +0 -0
  28. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/images/scrdr.dot +0 -0
  29. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/images/scrdr.png +0 -0
  30. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/images/thinking_pr2.jpg +0 -0
  31. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/pyproject.toml +0 -0
  32. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/pytest.ini +0 -0
  33. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/requirements-dev-ci.txt +0 -0
  34. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/requirements-dev.txt +0 -0
  35. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/requirements-gui.txt +0 -0
  36. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/requirements-viz.txt +0 -0
  37. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/requirements.txt +0 -0
  38. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/complete_mcrdr_extra.dot +0 -0
  39. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/complete_mcrdr_extra.png +0 -0
  40. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/complete_mcrdr_stop_only.dot +0 -0
  41. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/complete_mcrdr_stop_only.png +0 -0
  42. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/complete_mcrdr_stop_plus_rule.dot +0 -0
  43. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/complete_mcrdr_stop_plus_rule.png +0 -0
  44. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/complete_scrdr.dot +0 -0
  45. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/complete_scrdr.png +0 -0
  46. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/complete_scrdr_2.dot +0 -0
  47. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/complete_scrdr_2.png +0 -0
  48. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/complete_scrdr_3.dot +0 -0
  49. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/complete_scrdr_3.png +0 -0
  50. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/grdr_Habitat.dot +0 -0
  51. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/grdr_Habitat.png +0 -0
  52. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/grdr_Species.dot +0 -0
  53. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/grdr_Species.png +0 -0
  54. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/mcrdr_extra.dot +0 -0
  55. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/mcrdr_extra.png +0 -0
  56. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/mcrdr_extra_classify.dot +0 -0
  57. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/mcrdr_extra_classify.png +0 -0
  58. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/mcrdr_stop_plus_rule_combined.dot +0 -0
  59. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/mcrdr_stop_plus_rule_combined.png +0 -0
  60. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/partial_mcrdr_extra.dot +0 -0
  61. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/partial_mcrdr_extra.png +0 -0
  62. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/relational_scrdr_classify.dot +0 -0
  63. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/results/relational_scrdr_classify.png +0 -0
  64. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/setup.cfg +0 -0
  65. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/datastructures/__init__.py +0 -0
  66. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/datastructures/callable_expression.py +0 -0
  67. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/datastructures/case.py +0 -0
  68. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/datastructures/dataclasses.py +0 -0
  69. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/datastructures/enums.py +0 -0
  70. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/experts.py +0 -0
  71. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/helpers.py +0 -0
  72. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/rdr.py +0 -0
  73. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/rdr_decorators.py +0 -0
  74. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/rules.py +0 -0
  75. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/start-code-server.sh +0 -0
  76. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/user_interface/__init__.py +0 -0
  77. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/user_interface/gui.py +0 -0
  78. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/user_interface/ipython_custom_shell.py +0 -0
  79. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/user_interface/object_diagram.py +0 -0
  80. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/user_interface/prompt.py +0 -0
  81. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules/user_interface/template_file_creator.py +0 -0
  82. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules.egg-info/SOURCES.txt +0 -0
  83. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules.egg-info/dependency_links.txt +0 -0
  84. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules.egg-info/requires.txt +0 -0
  85. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/src/ripple_down_rules.egg-info/top_level.txt +0 -0
  86. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/__init__.py +0 -0
  87. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/conf/__init__.py +0 -0
  88. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/conf/world/__init__.py +0 -0
  89. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/conf/world/base_config.py +0 -0
  90. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/conf/world/handles_and_containers.py +0 -0
  91. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/conftest.py +0 -0
  92. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/datasets.py +0 -0
  93. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/factories/__init__.py +0 -0
  94. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/factories/world/__init__.py +0 -0
  95. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/factories/world/handles_and_containers.py +0 -0
  96. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/correct_drawer_rdr_expert_answers_fit.json +0 -0
  97. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/drawer_cabinet_expert_answers_fit.json +0 -0
  98. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/grdr_expert_answers_classify.json +0 -0
  99. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/grdr_expert_answers_fit.json +0 -0
  100. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/grdr_expert_answers_fit_extra.json +0 -0
  101. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/grdr_expert_answers_fit_no_targets.json +0 -0
  102. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/mcrdr_expert_answers_classify.json +0 -0
  103. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/mcrdr_expert_answers_fit_no_targets.json +0 -0
  104. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/mcrdr_expert_answers_stop_only_fit.json +0 -0
  105. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/mcrdr_extra_expert_answers_classify.json +0 -0
  106. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/mcrdr_extra_expert_answers_fit.json +0 -0
  107. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/mcrdr_multi_line_expert_answers_fit.json +0 -0
  108. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/mcrdr_stop_only_answers_fit.json +0 -0
  109. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/mcrdr_stop_plus_rule_answers_fit.json +0 -0
  110. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/mcrdr_stop_plus_rule_combined_expert_answers_fit.json +0 -0
  111. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/mcrdr_stop_plus_rule_expert_answers_fit.json +0 -0
  112. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/mutagenic_expert_answers.json +0 -0
  113. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/relational_scrdr_expert_answers_classify.json +0 -0
  114. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/scrdr_expert_answers_classify.json +0 -0
  115. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/scrdr_expert_answers_fit.json +0 -0
  116. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/scrdr_expert_answers_fit_no_targets.json +0 -0
  117. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/scrdr_multi_line_expert_answers_fit.json +0 -0
  118. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_expert_answers/scrdr_world_expert_answers_fit.json +0 -0
  119. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_generated_rdrs/__init__.py +0 -0
  120. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_helpers/__init__.py +0 -0
  121. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_helpers/helpers.py +0 -0
  122. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_helpers/object_diagram_case_query.png +0 -0
  123. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_helpers/object_diagram_person.png +0 -0
  124. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_json_serialization.py +0 -0
  125. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_object_diagram.py +0 -0
  126. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_on_mutagenic.py +0 -0
  127. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_rdr.py +0 -0
  128. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_rdr_alchemy.py +0 -0
  129. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_rdr_decorators.py +0 -0
  130. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_rdr_helpers_rdrs.py +0 -0
  131. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_rdr_world/__init__.py +0 -0
  132. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_rdr_world/conftest.py +0 -0
  133. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_rdr_world/test_rdr_world.py +0 -0
  134. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_relational_rdr.py +0 -0
  135. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_relational_rdr_alchemy.py +0 -0
  136. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_results/datasets_physical_object_is_a_robot/__init__.py +0 -0
  137. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_results/datasets_physical_object_is_a_robot/physical_object_is_a_robot_output__scrdr.py +0 -0
  138. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_results/datasets_physical_object_is_a_robot/physical_object_is_a_robot_output__scrdr_defs.py +0 -0
  139. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_results/datasets_physical_object_is_a_robot/physical_object_is_a_robot_rdr.py +0 -0
  140. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_results/datasets_physical_object_is_a_robot/rdr_metadata/datasets_physical_object_is_a_robot.json +0 -0
  141. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_results/datasets_physical_object_select_objects_that_are_parts_of_robot/__init__.py +0 -0
  142. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/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 +0 -0
  143. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_results/datasets_physical_object_select_objects_that_are_parts_of_robot/physical_object_select_objects_that_are_parts_of_robot_rdr.py +0 -0
  144. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/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 +0 -0
  145. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_sql_model.py +0 -0
  146. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_template_file_creator.py +0 -0
  147. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_user_interface/__init__.py +0 -0
  148. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_user_interface/test_ipython.py +0 -0
  149. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_user_interface/test_ipython_copilot.py +0 -0
  150. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_user_interface/test_prompt.py +0 -0
  151. {ripple_down_rules-0.5.83 → ripple_down_rules-0.5.85}/test/test_user_interface/test_qt_gui_inline.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ripple_down_rules
3
- Version: 0.5.83
3
+ Version: 0.5.85
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.83"
1
+ __version__ = "0.5.85"
2
2
 
3
3
  import logging
4
4
  logger = logging.Logger("rdr")
@@ -850,22 +850,27 @@ def get_function_representation(func: Callable) -> str:
850
850
 
851
851
 
852
852
  def get_relative_import(target_file_path, imported_module_path: Optional[str] = None,
853
- module: Optional[str] = None) -> str:
853
+ module: Optional[str] = None, package_name: Optional[str] = None) -> str:
854
854
  """
855
855
  Get a relative import path from the target file to the imported module.
856
856
 
857
857
  :param target_file_path: The file path of the target file.
858
858
  :param imported_module_path: The file path of the module being imported.
859
859
  :param module: The module name, if available.
860
+ :param package_name: The name of the root package where the module is located.
860
861
  :return: A relative import path as a string.
861
862
  """
862
863
  # Convert to absolute paths
864
+ target_path = Path(target_file_path).resolve()
865
+ if package_name is not None:
866
+ target_path = Path(get_path_starting_from(str(target_path), package_name))
863
867
  if module is not None:
864
868
  imported_module_path = sys.modules[module].__file__
865
869
  if imported_module_path is None:
866
870
  raise ValueError("Either imported_module_path or module must be provided")
867
- target_path = Path(target_file_path).resolve()
868
871
  imported_path = Path(imported_module_path).resolve()
872
+ if package_name is not None:
873
+ imported_path = Path(get_path_starting_from(str(imported_path), package_name))
869
874
 
870
875
  # Compute relative path from target to imported module
871
876
  rel_path = os.path.relpath(imported_path.parent, target_path.parent)
@@ -881,6 +886,20 @@ def get_relative_import(target_file_path, imported_module_path: Optional[str] =
881
886
  return joined_parts
882
887
 
883
888
 
889
+ def get_path_starting_from(path: str, package_name: str) -> Optional[str]:
890
+ """
891
+ Get the path starting from the package name.
892
+
893
+ :param path: The full path to the file.
894
+ :param package_name: The name of the package to start from.
895
+ :return: The path starting from the package name or None if not found.
896
+ """
897
+ if package_name in path:
898
+ idx = path.index(package_name)
899
+ return path[idx:]
900
+ return None
901
+
902
+
884
903
  def get_imports_from_types(type_objs: Iterable[Type],
885
904
  target_file_path: Optional[str] = None,
886
905
  package_name: Optional[str] = None) -> List[str]:
@@ -923,7 +942,7 @@ def get_imports_from_types(type_objs: Iterable[Type],
923
942
  joined = ", ".join(sorted(set(names)))
924
943
  import_path = module
925
944
  if (target_file_path is not None) and (package_name is not None) and (package_name in module):
926
- import_path = get_relative_import(target_file_path, module=module)
945
+ import_path = get_relative_import(target_file_path, module=module, package_name=package_name)
927
946
  lines.append(f"from {import_path} import {joined}")
928
947
  if other_imports:
929
948
  lines.extend(other_imports)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ripple_down_rules
3
- Version: 0.5.83
3
+ Version: 0.5.85
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
@@ -5,7 +5,7 @@ from .physical_object_select_objects_that_are_parts_of_robot_output__mcrdr_defs
5
5
 
6
6
 
7
7
  attribute_name = 'output_'
8
- conclusion_type = (set, PhysicalObject, list,)
8
+ conclusion_type = (PhysicalObject, set, list,)
9
9
  mutually_exclusive = False
10
10
 
11
11
 
@@ -1,4 +1,5 @@
1
1
  import os
2
+ import sys
2
3
  from os.path import dirname
3
4
  from unittest import TestCase
4
5
 
@@ -72,7 +73,7 @@ class UtilsTestCase(TestCase):
72
73
 
73
74
  from ripple_down_rules.rdr import GeneralRDR
74
75
 
75
- package_dir = f"{dirname(__file__)}/../src/ripple_down_rules"
76
+ package_dir = dirname(sys.modules["ripple_down_rules"].__file__)
76
77
  target_file = os.path.join(package_dir, "datastructures", "case.py")
77
78
  imports = get_imports_from_types([GeneralRDR], target_file, "ripple_down_rules")
78
79
  assert imports == ["from ..rdr import GeneralRDR"]