ripple-down-rules 0.5.71__tar.gz → 0.5.75__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 (150) hide show
  1. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/PKG-INFO +1 -1
  2. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/__init__.py +1 -1
  3. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/datastructures/dataclasses.py +3 -3
  4. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/rdr.py +29 -22
  5. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/rules.py +2 -3
  6. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/utils.py +19 -10
  7. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules.egg-info/PKG-INFO +1 -1
  8. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_results/datasets_physical_object_is_a_robot/rdr_metadata/datasets_physical_object_is_a_robot.json +2 -2
  9. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/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
  10. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/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 +6 -6
  11. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/.github/workflows/build_and_deploy_doc.yml +0 -0
  12. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/.github/workflows/ci.yml +0 -0
  13. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/.github/workflows/publish-to-test-pypi.yml +0 -0
  14. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/.idea/shelf/Uncommitted_changes_before_Checkout_at_2_4_25,_6_32_PM_[Changes]/shelved.patch +0 -0
  15. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/.idea/shelf/Uncommitted_changes_before_Checkout_at_2_4_25,_6_32_PM_[Changes]1/shelved.patch +0 -0
  16. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/LICENSE +0 -0
  17. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/README.md +0 -0
  18. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/doc/_config.yml +0 -0
  19. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/doc/_toc.yml +0 -0
  20. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/doc/bibliography.md +0 -0
  21. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/doc/intro.md +0 -0
  22. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/doc/references.bib +0 -0
  23. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/doc/requirements.txt +0 -0
  24. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/examples/__init__.py +0 -0
  25. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/examples/animal_species.py +0 -0
  26. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/examples/part_containment_rdr/__init__.py +0 -0
  27. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/examples/part_containment_rdr/rdr_metadata/part_containment_rdr.json +0 -0
  28. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/examples/part_containment_rdr/robot_contained_objects_mcrdr.py +0 -0
  29. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/examples/part_containment_rdr/robot_contained_objects_mcrdr_defs.py +0 -0
  30. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/examples/part_containment_rdr/robot_rdr.py +0 -0
  31. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/examples/relational_example.py +0 -0
  32. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/images/scrdr.dot +0 -0
  33. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/images/scrdr.png +0 -0
  34. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/images/thinking_pr2.jpg +0 -0
  35. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/pyproject.toml +0 -0
  36. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/pytest.ini +0 -0
  37. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/requirements-dev-ci.txt +0 -0
  38. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/requirements-dev.txt +0 -0
  39. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/requirements-gui.txt +0 -0
  40. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/requirements-viz.txt +0 -0
  41. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/requirements.txt +0 -0
  42. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/complete_mcrdr_extra.dot +0 -0
  43. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/complete_mcrdr_extra.png +0 -0
  44. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/complete_mcrdr_stop_only.dot +0 -0
  45. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/complete_mcrdr_stop_only.png +0 -0
  46. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/complete_mcrdr_stop_plus_rule.dot +0 -0
  47. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/complete_mcrdr_stop_plus_rule.png +0 -0
  48. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/complete_scrdr.dot +0 -0
  49. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/complete_scrdr.png +0 -0
  50. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/complete_scrdr_2.dot +0 -0
  51. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/complete_scrdr_2.png +0 -0
  52. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/complete_scrdr_3.dot +0 -0
  53. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/complete_scrdr_3.png +0 -0
  54. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/grdr_Habitat.dot +0 -0
  55. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/grdr_Habitat.png +0 -0
  56. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/grdr_Species.dot +0 -0
  57. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/grdr_Species.png +0 -0
  58. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/mcrdr_extra.dot +0 -0
  59. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/mcrdr_extra.png +0 -0
  60. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/mcrdr_extra_classify.dot +0 -0
  61. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/mcrdr_extra_classify.png +0 -0
  62. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/mcrdr_stop_plus_rule_combined.dot +0 -0
  63. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/mcrdr_stop_plus_rule_combined.png +0 -0
  64. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/partial_mcrdr_extra.dot +0 -0
  65. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/partial_mcrdr_extra.png +0 -0
  66. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/relational_scrdr_classify.dot +0 -0
  67. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/results/relational_scrdr_classify.png +0 -0
  68. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/setup.cfg +0 -0
  69. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/datastructures/__init__.py +0 -0
  70. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/datastructures/callable_expression.py +0 -0
  71. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/datastructures/case.py +0 -0
  72. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/datastructures/enums.py +0 -0
  73. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/experts.py +0 -0
  74. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/helpers.py +0 -0
  75. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/rdr_decorators.py +0 -0
  76. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/start-code-server.sh +0 -0
  77. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/user_interface/__init__.py +0 -0
  78. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/user_interface/gui.py +0 -0
  79. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/user_interface/ipython_custom_shell.py +0 -0
  80. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/user_interface/object_diagram.py +0 -0
  81. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/user_interface/prompt.py +0 -0
  82. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules/user_interface/template_file_creator.py +0 -0
  83. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules.egg-info/SOURCES.txt +0 -0
  84. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules.egg-info/dependency_links.txt +0 -0
  85. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules.egg-info/requires.txt +0 -0
  86. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/src/ripple_down_rules.egg-info/top_level.txt +0 -0
  87. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/conf/__init__.py +0 -0
  88. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/conf/world/__init__.py +0 -0
  89. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/conf/world/base_config.py +0 -0
  90. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/conf/world/handles_and_containers.py +0 -0
  91. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/conftest.py +0 -0
  92. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/datasets.py +0 -0
  93. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/factories/__init__.py +0 -0
  94. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/factories/world/__init__.py +0 -0
  95. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/factories/world/handles_and_containers.py +0 -0
  96. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/correct_drawer_rdr_expert_answers_fit.json +0 -0
  97. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/drawer_cabinet_expert_answers_fit.json +0 -0
  98. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/grdr_expert_answers_classify.json +0 -0
  99. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/grdr_expert_answers_fit.json +0 -0
  100. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/grdr_expert_answers_fit_extra.json +0 -0
  101. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/grdr_expert_answers_fit_no_targets.json +0 -0
  102. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/mcrdr_expert_answers_classify.json +0 -0
  103. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/mcrdr_expert_answers_fit_no_targets.json +0 -0
  104. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/mcrdr_expert_answers_stop_only_fit.json +0 -0
  105. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/mcrdr_extra_expert_answers_classify.json +0 -0
  106. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/mcrdr_extra_expert_answers_fit.json +0 -0
  107. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/mcrdr_multi_line_expert_answers_fit.json +0 -0
  108. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/mcrdr_stop_only_answers_fit.json +0 -0
  109. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/mcrdr_stop_plus_rule_answers_fit.json +0 -0
  110. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/mcrdr_stop_plus_rule_combined_expert_answers_fit.json +0 -0
  111. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/mcrdr_stop_plus_rule_expert_answers_fit.json +0 -0
  112. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/mutagenic_expert_answers.json +0 -0
  113. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/relational_scrdr_expert_answers_classify.json +0 -0
  114. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/scrdr_expert_answers_classify.json +0 -0
  115. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/scrdr_expert_answers_fit.json +0 -0
  116. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/scrdr_expert_answers_fit_no_targets.json +0 -0
  117. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/scrdr_multi_line_expert_answers_fit.json +0 -0
  118. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_expert_answers/scrdr_world_expert_answers_fit.json +0 -0
  119. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_generated_rdrs/__init__.py +0 -0
  120. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_helpers/__init__.py +0 -0
  121. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_helpers/helpers.py +0 -0
  122. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_helpers/object_diagram_case_query.png +0 -0
  123. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_helpers/object_diagram_person.png +0 -0
  124. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_json_serialization.py +0 -0
  125. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_object_diagram.py +0 -0
  126. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_on_mutagenic.py +0 -0
  127. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_rdr.py +0 -0
  128. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_rdr_alchemy.py +0 -0
  129. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_rdr_decorators.py +0 -0
  130. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_rdr_helpers_rdrs.py +0 -0
  131. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_rdr_world/__init__.py +0 -0
  132. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_rdr_world/conftest.py +0 -0
  133. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_rdr_world/test_rdr_world.py +0 -0
  134. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_relational_rdr.py +0 -0
  135. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_relational_rdr_alchemy.py +0 -0
  136. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_results/datasets_physical_object_is_a_robot/__init__.py +0 -0
  137. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/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.71 → ripple_down_rules-0.5.75}/test/test_results/datasets_physical_object_is_a_robot/physical_object_is_a_robot_output__scrdr_defs.py +1 -1
  139. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_results/datasets_physical_object_is_a_robot/physical_object_is_a_robot_rdr.py +0 -0
  140. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_results/datasets_physical_object_select_objects_that_are_parts_of_robot/__init__.py +0 -0
  141. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/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 +3 -3
  142. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/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
  143. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_sql_model.py +0 -0
  144. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_template_file_creator.py +0 -0
  145. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_user_interface/__init__.py +0 -0
  146. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_user_interface/test_ipython.py +0 -0
  147. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_user_interface/test_ipython_copilot.py +0 -0
  148. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_user_interface/test_prompt.py +0 -0
  149. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_user_interface/test_qt_gui_inline.py +0 -0
  150. {ripple_down_rules-0.5.71 → ripple_down_rules-0.5.75}/test/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ripple_down_rules
3
- Version: 0.5.71
3
+ Version: 0.5.75
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.71"
1
+ __version__ = "0.5.75"
2
2
 
3
3
  import logging
4
4
  logger = logging.Logger("rdr")
@@ -9,7 +9,7 @@ from omegaconf import MISSING
9
9
  from sqlalchemy.orm import DeclarativeBase as SQLTable
10
10
  from typing_extensions import Any, Optional, Dict, Type, Tuple, Union, List, get_origin, Set, Callable
11
11
 
12
- from ..utils import get_method_name, get_function_import_path_and_representation
12
+ from ..utils import get_method_name, get_function_import_data, get_function_representation
13
13
  from .callable_expression import CallableExpression
14
14
  from .case import create_case, Case
15
15
  from ..utils import copy_case, make_list, make_set, get_origin_and_args_from_type_hint, get_value_type_from_type_hint, \
@@ -274,9 +274,9 @@ class CaseFactoryMetaData:
274
274
  factory_method_repr = None
275
275
  scenario_repr = None
276
276
  if self.factory_method is not None:
277
- _, factory_method_repr = get_function_import_path_and_representation(self.factory_method)
277
+ factory_method_repr = get_function_representation(self.factory_method)
278
278
  if self.scenario is not None:
279
- _, scenario_repr = get_function_import_path_and_representation(self.scenario)
279
+ scenario_repr = get_function_representation(self.scenario)
280
280
  return (f"CaseFactoryMetaData("
281
281
  f"factory_method={factory_method_repr}, "
282
282
  f"factory_idx={self.factory_idx}, "
@@ -39,7 +39,7 @@ except ImportError as e:
39
39
  from .utils import draw_tree, make_set, copy_case, \
40
40
  SubclassJSONSerializer, make_list, get_type_from_string, \
41
41
  is_conflicting, get_imports_from_scope, extract_function_source, extract_imports, get_full_class_name, \
42
- is_iterable, str_to_snake_case, get_import_path_from_path
42
+ is_iterable, str_to_snake_case, get_import_path_from_path, get_imports_from_types
43
43
 
44
44
 
45
45
  class RippleDownRules(SubclassJSONSerializer, ABC):
@@ -401,12 +401,9 @@ class RippleDownRules(SubclassJSONSerializer, ABC):
401
401
  # remove from imports if exists first
402
402
  package_name = get_import_path_from_path(package_name)
403
403
  name = f"{package_name}.{self.generated_python_file_name}" if package_name else self.generated_python_file_name
404
- try:
405
- module = importlib.import_module(name)
406
- del sys.modules[name]
407
- except ModuleNotFoundError:
408
- pass
409
- return importlib.import_module(name).classify
404
+ module = importlib.import_module(name)
405
+ importlib.reload(module)
406
+ return module.classify
410
407
 
411
408
 
412
409
  class RDRWithCodeWriter(RippleDownRules, ABC):
@@ -434,7 +431,9 @@ class RDRWithCodeWriter(RippleDownRules, ABC):
434
431
  rule.conditions.user_input = functions_source[f"conditions_{rule.uid}"]
435
432
  rule.conditions.scope = scope
436
433
  if os.path.exists(cases_path):
437
- rule.corner_case_metadata = importlib.import_module(cases_import_path).__dict__.get(f"corner_case_{rule.uid}", None)
434
+ module = importlib.import_module(cases_import_path)
435
+ importlib.reload(module)
436
+ rule.corner_case_metadata = module.__dict__.get(f"corner_case_{rule.uid}", None)
438
437
  if rule.conclusion is not None and not isinstance(rule, MultiClassStopRule):
439
438
  rule.conclusion.user_input = functions_source[f"conclusion_{rule.uid}"]
440
439
  rule.conclusion.scope = scope
@@ -471,8 +470,10 @@ class RDRWithCodeWriter(RippleDownRules, ABC):
471
470
  # clear the files first
472
471
  with open(defs_file_name, "w") as f:
473
472
  f.write(defs_imports + "\n\n")
473
+ case_factory_import = get_imports_from_types([CaseFactoryMetaData])
474
474
  with open(cases_file_name, "w") as cases_f:
475
475
  cases_f.write("# This file contains the corner cases for the rules.\n")
476
+ cases_f.write('\n'.join(case_factory_import) + "\n\n\n")
476
477
  with open(file_name, "w") as f:
477
478
  imports += f"from .{self.generated_python_defs_file_name} import *\n"
478
479
  f.write(imports + "\n\n")
@@ -482,8 +483,8 @@ class RDRWithCodeWriter(RippleDownRules, ABC):
482
483
  f.write(f"\n\n{func_def}")
483
484
  f.write(f"{' ' * 4}if not isinstance(case, Case):\n"
484
485
  f"{' ' * 4} case = create_case(case, max_recursion_idx=3)\n""")
485
- self.write_rules_as_source_code_to_file(self.start_rule, f, " " * 4, defs_file=defs_file_name,
486
- cases_file=cases_file_name)
486
+ self.write_rules_as_source_code_to_file(self.start_rule, file_name, " " * 4, defs_file=defs_file_name,
487
+ cases_file=cases_file_name)
487
488
 
488
489
  @property
489
490
  @abstractmethod
@@ -663,7 +664,7 @@ class SingleClassRDR(RDRWithCodeWriter):
663
664
  with open(model_dir + f"/{self.generated_python_file_name}.py", "a") as f:
664
665
  f.write(f"{' ' * 4}else:\n{' ' * 8}return {self.default_conclusion}\n")
665
666
 
666
- def write_rules_as_source_code_to_file(self, rule: SingleClassRule, file: TextIOWrapper, parent_indent: str = "",
667
+ def write_rules_as_source_code_to_file(self, rule: SingleClassRule, filename: str, parent_indent: str = "",
667
668
  defs_file: Optional[str] = None, cases_file: Optional[str] = None):
668
669
  """
669
670
  Write the rules as source code to a file.
@@ -671,16 +672,18 @@ class SingleClassRDR(RDRWithCodeWriter):
671
672
  if rule.conditions:
672
673
  rule.write_corner_case_as_source_code(cases_file)
673
674
  if_clause = rule.write_condition_as_source_code(parent_indent, defs_file)
674
- file.write(if_clause)
675
+ with open(filename, "a") as file:
676
+ file.write(if_clause)
675
677
  if rule.refinement:
676
- self.write_rules_as_source_code_to_file(rule.refinement, file, parent_indent + " ",
678
+ self.write_rules_as_source_code_to_file(rule.refinement, filename, parent_indent + " ",
677
679
  defs_file=defs_file, cases_file=cases_file)
678
680
 
679
681
  conclusion_call = rule.write_conclusion_as_source_code(parent_indent, defs_file)
680
- file.write(conclusion_call)
682
+ with open(filename, "a") as file:
683
+ file.write(conclusion_call)
681
684
 
682
685
  if rule.alternative:
683
- self.write_rules_as_source_code_to_file(rule.alternative, file, parent_indent, defs_file=defs_file,
686
+ self.write_rules_as_source_code_to_file(rule.alternative, filename, parent_indent, defs_file=defs_file,
684
687
  cases_file=cases_file)
685
688
 
686
689
  @property
@@ -785,26 +788,30 @@ class MultiClassRDR(RDRWithCodeWriter):
785
788
  return self.conclusions
786
789
 
787
790
  def write_rules_as_source_code_to_file(self, rule: Union[MultiClassTopRule, MultiClassStopRule],
788
- file, parent_indent: str = "", defs_file: Optional[str] = None,
791
+ filename: str, parent_indent: str = "", defs_file: Optional[str] = None,
789
792
  cases_file: Optional[str] = None):
790
793
  if rule == self.start_rule:
791
- file.write(f"{parent_indent}conclusions = set()\n")
794
+ with open(filename, "a") as file:
795
+ file.write(f"{parent_indent}conclusions = set()\n")
792
796
  if rule.conditions:
793
797
  rule.write_corner_case_as_source_code(cases_file)
794
798
  if_clause = rule.write_condition_as_source_code(parent_indent, defs_file)
795
- file.write(if_clause)
799
+ with open(filename, "a") as file:
800
+ file.write(if_clause)
796
801
  conclusion_indent = parent_indent
797
802
  if hasattr(rule, "refinement") and rule.refinement:
798
- self.write_rules_as_source_code_to_file(rule.refinement, file, parent_indent + " ",
803
+ self.write_rules_as_source_code_to_file(rule.refinement, filename, parent_indent + " ",
799
804
  defs_file=defs_file, cases_file=cases_file)
800
805
  conclusion_indent = parent_indent + " " * 4
801
- file.write(f"{conclusion_indent}else:\n")
806
+ with open(filename, "a") as file:
807
+ file.write(f"{conclusion_indent}else:\n")
802
808
 
803
809
  conclusion_call = rule.write_conclusion_as_source_code(conclusion_indent, defs_file)
804
- file.write(conclusion_call)
810
+ with open(filename, "a") as file:
811
+ file.write(conclusion_call)
805
812
 
806
813
  if rule.alternative:
807
- self.write_rules_as_source_code_to_file(rule.alternative, file, parent_indent, defs_file=defs_file,
814
+ self.write_rules_as_source_code_to_file(rule.alternative, filename, parent_indent, defs_file=defs_file,
808
815
  cases_file=cases_file)
809
816
 
810
817
  @property
@@ -8,11 +8,11 @@ from uuid import uuid4
8
8
 
9
9
  from anytree import NodeMixin
10
10
  from sqlalchemy.orm import DeclarativeBase as SQLTable
11
- from typing_extensions import List, Optional, Self, Union, Dict, Any, Tuple, Callable
11
+ from typing_extensions import List, Optional, Self, Union, Dict, Any, Tuple
12
12
 
13
13
  from .datastructures.callable_expression import CallableExpression
14
14
  from .datastructures.case import Case
15
- from .datastructures.dataclasses import CaseFactoryMetaData, CaseConf, CaseQuery
15
+ from .datastructures.dataclasses import CaseFactoryMetaData, CaseQuery
16
16
  from .datastructures.enums import RDREdge, Stop
17
17
  from .utils import SubclassJSONSerializer, conclusion_to_json, get_full_class_name, get_imports_from_types
18
18
 
@@ -117,7 +117,6 @@ class Rule(NodeMixin, SubclassJSONSerializer, ABC):
117
117
  types_to_import.add(self.corner_case_metadata.scenario)
118
118
  if self.corner_case_metadata.case_conf is not None:
119
119
  types_to_import.add(self.corner_case_metadata.case_conf)
120
- types_to_import.add(CaseFactoryMetaData)
121
120
  imports = get_imports_from_types(list(types_to_import))
122
121
  with open(cases_file, 'a') as f:
123
122
  f.write("\n".join(imports) + "\n\n\n")
@@ -799,7 +799,7 @@ def get_import_path_from_path(path: str) -> Optional[str]:
799
799
  return package_name
800
800
 
801
801
 
802
- def get_function_import_path_and_representation(func: Callable) -> Tuple[str, str]:
802
+ def get_function_import_data(func: Callable) -> Tuple[str, str]:
803
803
  """
804
804
  Get the import path of a function.
805
805
 
@@ -813,12 +813,24 @@ def get_function_import_path_and_representation(func: Callable) -> Tuple[str, st
813
813
  func_import_path = get_import_path_from_path(dirname(func_file_path))
814
814
  func_import_path = f"{func_import_path}.{func_file_name}" if func_import_path else func_file_name
815
815
  if func_class_name and func_class_name != func_name:
816
- import_path = f"from {func_import_path} import {func_class_name}"
817
- func_representation = f"{func_class_name}.{func_name}"
816
+ func_import_name = func_class_name
818
817
  else:
819
- import_path = f"from {func_import_path} import {func_name}"
820
- func_representation = func_name
821
- return import_path, func_representation
818
+ func_import_name = func_name
819
+ return func_import_path, func_import_name
820
+
821
+
822
+ def get_function_representation(func: Callable) -> str:
823
+ """
824
+ Get a string representation of a function, including its module and class if applicable.
825
+
826
+ :param func: The function to represent.
827
+ :return: A string representation of the function.
828
+ """
829
+ func_name = get_method_name(func)
830
+ func_class_name = get_method_class_name_if_exists(func)
831
+ if func_class_name and func_class_name != func_name:
832
+ return f"{func_class_name}.{func_name}"
833
+ return func_name
822
834
 
823
835
 
824
836
  def get_imports_from_types(type_objs: List[Type]) -> List[str]:
@@ -836,10 +848,7 @@ def get_imports_from_types(type_objs: List[Type]) -> List[str]:
836
848
  module = tp.__module__
837
849
  name = tp.__qualname__
838
850
  elif callable(tp):
839
- import_, _ = get_function_import_path_and_representation(tp)
840
- if import_ is not None:
841
- other_imports.append(import_)
842
- module = None
851
+ module, name = get_function_import_data(tp)
843
852
  elif hasattr(type(tp), "__module__"):
844
853
  module = type(tp).__module__
845
854
  name = type(tp).__qualname__
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ripple_down_rules
3
- Version: 0.5.71
3
+ Version: 0.5.75
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
@@ -12,8 +12,8 @@
12
12
  "builtins.bool"
13
13
  ],
14
14
  "scope": {
15
- "Dict": "typing.Dict",
16
15
  "Robot": "datasets.Robot",
16
+ "Dict": "typing.Dict",
17
17
  "PhysicalObject": "datasets.PhysicalObject"
18
18
  },
19
19
  "conclusion": {
@@ -29,8 +29,8 @@
29
29
  "builtins.bool"
30
30
  ],
31
31
  "scope": {
32
- "Dict": "typing.Dict",
33
32
  "Robot": "datasets.Robot",
33
+ "Dict": "typing.Dict",
34
34
  "PhysicalObject": "datasets.PhysicalObject"
35
35
  },
36
36
  "conclusion": {
@@ -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 = (PhysicalObject, set, list,)
8
+ conclusion_type = (set, PhysicalObject, list,)
9
9
  mutually_exclusive = False
10
10
 
11
11
 
@@ -12,11 +12,11 @@
12
12
  "builtins.bool"
13
13
  ],
14
14
  "scope": {
15
- "PhysicalObject": "datasets.PhysicalObject",
15
+ "Robot": "datasets.Robot",
16
16
  "Union": "typing.Union",
17
+ "List": "typing.List",
17
18
  "Dict": "typing.Dict",
18
- "Robot": "datasets.Robot",
19
- "List": "typing.List"
19
+ "PhysicalObject": "datasets.PhysicalObject"
20
20
  },
21
21
  "conclusion": {
22
22
  "_type": "builtins.NoneType",
@@ -33,11 +33,11 @@
33
33
  "builtins.list"
34
34
  ],
35
35
  "scope": {
36
- "PhysicalObject": "datasets.PhysicalObject",
36
+ "Robot": "datasets.Robot",
37
37
  "Union": "typing.Union",
38
+ "List": "typing.List",
38
39
  "Dict": "typing.Dict",
39
- "Robot": "datasets.Robot",
40
- "List": "typing.List"
40
+ "PhysicalObject": "datasets.PhysicalObject"
41
41
  },
42
42
  "conclusion": {
43
43
  "_type": "builtins.NoneType",
@@ -1,6 +1,6 @@
1
- from datasets import Robot
2
1
  from datasets import PhysicalObject
3
2
  from typing import Dict
3
+ from datasets import Robot
4
4
 
5
5
 
6
6
  def conditions_226969243620390858682731042391766665817(case):
@@ -1,8 +1,8 @@
1
- from datasets import PhysicalObject
2
- from typing import Dict
1
+ from datasets import Robot
3
2
  from typing import List
3
+ from typing import Dict
4
+ from datasets import PhysicalObject
4
5
  from typing import Union
5
- from datasets import Robot
6
6
  from typing_extensions import Union
7
7
 
8
8