placo 0.7.0__tar.gz → 0.7.1__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.

Potentially problematic release.


This version of placo might be problematic. Click here for more details.

Files changed (181) hide show
  1. {placo-0.7.0 → placo-0.7.1}/CMakeLists.txt +8 -2
  2. {placo-0.7.0 → placo-0.7.1}/Makefile +1 -1
  3. {placo-0.7.0 → placo-0.7.1}/PKG-INFO +1 -1
  4. placo-0.7.1/bindings/doxystub/doxygen_parse.py +301 -0
  5. placo-0.7.1/bindings/doxystub/stubs.py +368 -0
  6. placo-0.7.1/bindings/doxystub/stubs.sh +8 -0
  7. {placo-0.7.0 → placo-0.7.1}/bindings/expose-robot-wrapper.cpp +2 -1
  8. {placo-0.7.0 → placo-0.7.1}/build_wheel.sh +2 -4
  9. {placo-0.7.0 → placo-0.7.1}/pyproject.toml +1 -1
  10. {placo-0.7.0 → placo-0.7.1}/python/placo_utils/visualization.py +4 -4
  11. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/polynom.h +6 -0
  12. placo-0.7.0/bindings/doxystub/config.py +0 -5
  13. placo-0.7.0/bindings/doxystub/doxygen_parse.py +0 -200
  14. placo-0.7.0/bindings/doxystub/stubs.py +0 -268
  15. placo-0.7.0/bindings/doxystub/stubs.sh +0 -5
  16. {placo-0.7.0 → placo-0.7.1}/.clang-format +0 -0
  17. {placo-0.7.0 → placo-0.7.1}/.gitattributes +0 -0
  18. {placo-0.7.0 → placo-0.7.1}/.gitignore +0 -0
  19. {placo-0.7.0 → placo-0.7.1}/.readthedocs.yaml +0 -0
  20. {placo-0.7.0 → placo-0.7.1}/Doxyfile +0 -0
  21. {placo-0.7.0 → placo-0.7.1}/LICENSE +0 -0
  22. {placo-0.7.0 → placo-0.7.1}/README.md +0 -0
  23. {placo-0.7.0 → placo-0.7.1}/bindings/doxystub/README.md +0 -0
  24. {placo-0.7.0 → placo-0.7.1}/bindings/doxystub/registry.cpp +0 -0
  25. {placo-0.7.0 → placo-0.7.1}/bindings/doxystub/registry.h +0 -0
  26. {placo-0.7.0 → placo-0.7.1}/bindings/expose-dynamics.cpp +0 -0
  27. {placo-0.7.0 → placo-0.7.1}/bindings/expose-eigen.cpp +0 -0
  28. {placo-0.7.0 → placo-0.7.1}/bindings/expose-footsteps.cpp +0 -0
  29. {placo-0.7.0 → placo-0.7.1}/bindings/expose-kinematics.cpp +0 -0
  30. {placo-0.7.0 → placo-0.7.1}/bindings/expose-parameters.cpp +0 -0
  31. {placo-0.7.0 → placo-0.7.1}/bindings/expose-problem.cpp +0 -0
  32. {placo-0.7.0 → placo-0.7.1}/bindings/expose-tools.cpp +0 -0
  33. {placo-0.7.0 → placo-0.7.1}/bindings/expose-utils.hpp +0 -0
  34. {placo-0.7.0 → placo-0.7.1}/bindings/expose-walk-pattern-generator.cpp +0 -0
  35. {placo-0.7.0 → placo-0.7.1}/bindings/module.cpp +0 -0
  36. {placo-0.7.0 → placo-0.7.1}/bindings/module.h +0 -0
  37. {placo-0.7.0 → placo-0.7.1}/python/.vscode/settings.json +0 -0
  38. {placo-0.7.0 → placo-0.7.1}/python/Makefile +0 -0
  39. {placo-0.7.0 → placo-0.7.1}/python/placo_utils/__init__.py +0 -0
  40. {placo-0.7.0 → placo-0.7.1}/python/placo_utils/tf.py +0 -0
  41. {placo-0.7.0 → placo-0.7.1}/python/placo_utils/view.py +0 -0
  42. {placo-0.7.0 → placo-0.7.1}/python/run_tests.sh +0 -0
  43. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/avoid_self_collisions_constraint.cpp +0 -0
  44. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/avoid_self_collisions_constraint.h +0 -0
  45. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/com_task.cpp +0 -0
  46. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/com_task.h +0 -0
  47. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/constraint.cpp +0 -0
  48. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/constraint.h +0 -0
  49. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/contacts.cpp +0 -0
  50. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/contacts.h +0 -0
  51. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/dynamics_solver.cpp +0 -0
  52. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/dynamics_solver.h +0 -0
  53. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/frame_task.cpp +0 -0
  54. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/frame_task.h +0 -0
  55. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/gear_task.cpp +0 -0
  56. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/gear_task.h +0 -0
  57. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/joints_task.cpp +0 -0
  58. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/joints_task.h +0 -0
  59. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/orientation_task.cpp +0 -0
  60. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/orientation_task.h +0 -0
  61. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/position_task.cpp +0 -0
  62. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/position_task.h +0 -0
  63. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/relative_frame_task.cpp +0 -0
  64. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/relative_frame_task.h +0 -0
  65. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/relative_orientation_task.cpp +0 -0
  66. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/relative_orientation_task.h +0 -0
  67. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/relative_position_task.cpp +0 -0
  68. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/relative_position_task.h +0 -0
  69. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/task.cpp +0 -0
  70. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/task.h +0 -0
  71. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/torque_task.cpp +0 -0
  72. {placo-0.7.0 → placo-0.7.1}/src/placo/dynamics/torque_task.h +0 -0
  73. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/foot_trajectory.cpp +0 -0
  74. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/foot_trajectory.h +0 -0
  75. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/footsteps_planner.cpp +0 -0
  76. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/footsteps_planner.h +0 -0
  77. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/footsteps_planner_naive.cpp +0 -0
  78. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/footsteps_planner_naive.h +0 -0
  79. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/footsteps_planner_repetitive.cpp +0 -0
  80. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/footsteps_planner_repetitive.h +0 -0
  81. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/humanoid_parameters.cpp +0 -0
  82. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/humanoid_parameters.h +0 -0
  83. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/humanoid_robot.cpp +0 -0
  84. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/humanoid_robot.h +0 -0
  85. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/kick.cpp +0 -0
  86. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/kick.h +0 -0
  87. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/lipm.cpp +0 -0
  88. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/lipm.h +0 -0
  89. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/swing_foot.cpp +0 -0
  90. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/swing_foot.h +0 -0
  91. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/swing_foot_cubic.cpp +0 -0
  92. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/swing_foot_cubic.h +0 -0
  93. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/swing_foot_quintic.cpp +0 -0
  94. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/swing_foot_quintic.h +0 -0
  95. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/walk_pattern_generator.cpp +0 -0
  96. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/walk_pattern_generator.h +0 -0
  97. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/walk_tasks.cpp +0 -0
  98. {placo-0.7.0 → placo-0.7.1}/src/placo/humanoid/walk_tasks.h +0 -0
  99. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/avoid_self_collisions_constraint.cpp +0 -0
  100. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/avoid_self_collisions_constraint.h +0 -0
  101. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/axis_align_task.cpp +0 -0
  102. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/axis_align_task.h +0 -0
  103. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/centroidal_momentum_task.cpp +0 -0
  104. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/centroidal_momentum_task.h +0 -0
  105. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/com_polygon_constraint.cpp +0 -0
  106. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/com_polygon_constraint.h +0 -0
  107. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/com_task.cpp +0 -0
  108. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/com_task.h +0 -0
  109. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/cone_constraint.cpp +0 -0
  110. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/cone_constraint.h +0 -0
  111. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/constraint.cpp +0 -0
  112. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/constraint.h +0 -0
  113. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/distance_task.cpp +0 -0
  114. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/distance_task.h +0 -0
  115. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/frame_task.cpp +0 -0
  116. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/frame_task.h +0 -0
  117. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/gear_task.cpp +0 -0
  118. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/gear_task.h +0 -0
  119. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/joint_space_half_spaces_constraint.cpp +0 -0
  120. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/joint_space_half_spaces_constraint.h +0 -0
  121. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/joints_task.cpp +0 -0
  122. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/joints_task.h +0 -0
  123. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/kinematics_solver.cpp +0 -0
  124. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/kinematics_solver.h +0 -0
  125. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/kinetic_energy_regularization_task.cpp +0 -0
  126. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/kinetic_energy_regularization_task.h +0 -0
  127. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/manipulability_task.cpp +0 -0
  128. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/manipulability_task.h +0 -0
  129. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/orientation_task.cpp +0 -0
  130. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/orientation_task.h +0 -0
  131. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/position_task.cpp +0 -0
  132. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/position_task.h +0 -0
  133. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/regularization_task.cpp +0 -0
  134. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/regularization_task.h +0 -0
  135. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/relative_frame_task.cpp +0 -0
  136. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/relative_frame_task.h +0 -0
  137. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/relative_orientation_task.cpp +0 -0
  138. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/relative_orientation_task.h +0 -0
  139. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/relative_position_task.cpp +0 -0
  140. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/relative_position_task.h +0 -0
  141. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/task.cpp +0 -0
  142. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/task.h +0 -0
  143. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/wheel_task.cpp +0 -0
  144. {placo-0.7.0 → placo-0.7.1}/src/placo/kinematics/wheel_task.h +0 -0
  145. {placo-0.7.0 → placo-0.7.1}/src/placo/model/robot_wrapper.cpp +0 -0
  146. {placo-0.7.0 → placo-0.7.1}/src/placo/model/robot_wrapper.h +0 -0
  147. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/constraint.cpp +0 -0
  148. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/constraint.h +0 -0
  149. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/expression.cpp +0 -0
  150. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/expression.h +0 -0
  151. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/integrator.cpp +0 -0
  152. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/integrator.h +0 -0
  153. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/polygon_constraint.cpp +0 -0
  154. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/polygon_constraint.h +0 -0
  155. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/problem.cpp +0 -0
  156. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/problem.h +0 -0
  157. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/problem_polynom.cpp +0 -0
  158. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/problem_polynom.h +0 -0
  159. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/qp_error.cpp +0 -0
  160. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/qp_error.h +0 -0
  161. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/sparsity.cpp +0 -0
  162. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/sparsity.h +0 -0
  163. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/variable.cpp +0 -0
  164. {placo-0.7.0 → placo-0.7.1}/src/placo/problem/variable.h +0 -0
  165. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/axises_mask.cpp +0 -0
  166. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/axises_mask.h +0 -0
  167. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/cubic_spline.cpp +0 -0
  168. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/cubic_spline.h +0 -0
  169. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/cubic_spline_3d.cpp +0 -0
  170. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/cubic_spline_3d.h +0 -0
  171. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/directions.cpp +0 -0
  172. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/directions.h +0 -0
  173. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/polynom.cpp +0 -0
  174. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/prioritized.cpp +0 -0
  175. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/prioritized.h +0 -0
  176. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/segment.cpp +0 -0
  177. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/segment.h +0 -0
  178. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/utils.cpp +0 -0
  179. {placo-0.7.0 → placo-0.7.1}/src/placo/tools/utils.h +0 -0
  180. {placo-0.7.0 → placo-0.7.1}/tweak_sdist.sh +0 -0
  181. {placo-0.7.0 → placo-0.7.1}/wks.yml +0 -0
@@ -139,6 +139,7 @@ set(CMAKE_SHARED_MODULE_PREFIX "")
139
139
 
140
140
  find_package(Python3 REQUIRED)
141
141
  find_package(Boost COMPONENTS python REQUIRED)
142
+ find_package(Python REQUIRED COMPONENTS Interpreter)
142
143
 
143
144
  add_library(placo MODULE
144
145
  bindings/expose-eigen.cpp
@@ -159,8 +160,13 @@ target_link_libraries(placo ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} libplaco)
159
160
  target_include_directories(placo PRIVATE ${PYTHON_INCLUDE_DIRS})
160
161
 
161
162
  add_custom_command(TARGET placo POST_BUILD
162
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bindings/doxystub/stubs.sh "${CMAKE_BINARY_DIR}/${PYTHON_SITELIB}" > "${CMAKE_BINARY_DIR}/${PYTHON_SITELIB}/placo.pyi"
163
- WORKING DIRECTORY "/"
163
+ COMMAND
164
+ "${Python_EXECUTABLE}"
165
+ ${CMAKE_CURRENT_SOURCE_DIR}/bindings/doxystub/stubs.py
166
+ placo
167
+ "${CMAKE_CURRENT_SOURCE_DIR}"
168
+ "${CMAKE_BINARY_DIR}/${PYTHON_SITELIB}/placo.pyi"
169
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${PYTHON_SITELIB}"
164
170
  COMMENT "Generating stubs..."
165
171
  )
166
172
 
@@ -2,7 +2,7 @@
2
2
  # Building Python wheel
3
3
  all:
4
4
  @rm -rf dist/*
5
- python -m build --sdist --wheel
5
+ bash build_wheel.sh
6
6
  bash tweak_sdist.sh
7
7
 
8
8
  upload:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: placo
3
- Version: 0.7.0
3
+ Version: 0.7.1
4
4
  Summary: PlaCo: Rhoban Planning and Control
5
5
  Requires-Python: >= 3.9
6
6
  License-Expression: MIT
@@ -0,0 +1,301 @@
1
+ import glob
2
+ import re
3
+ from typing import Union
4
+ import xml.etree.ElementTree as ET
5
+
6
+
7
+ def element_to_string(element: ET.Element) -> str:
8
+ """
9
+ Retrieve the contents of a given node
10
+ """
11
+ s = element.text or ""
12
+ for sub_element in element:
13
+ s += ET.tostring(sub_element).decode("utf-8")
14
+ s += element.tail
15
+ return re.sub("<[^<]+?>", "", s)
16
+
17
+
18
+ def parse_type(node: ET.Element):
19
+ """
20
+ Retrieve the type of the object present in the given node
21
+ """
22
+ type_node = node.find("type")
23
+
24
+ if type_node.find("ref") is not None:
25
+ if type_node.text and "vector" in type_node.text:
26
+ return ["std::vector", type_node.find("ref").attrib["refid"]]
27
+ else:
28
+ return type_node.find("ref").attrib["refid"]
29
+ else:
30
+ return type_node.text
31
+
32
+
33
+ class DoxygenElement:
34
+ def __init__(self, id: str, name: str):
35
+ self.id = id
36
+ self.name: str = name
37
+
38
+
39
+ class DoxygenTypedef(DoxygenElement):
40
+ pass
41
+
42
+
43
+ class DoxygenMember(DoxygenElement):
44
+ def __init__(self, id: str, name: str):
45
+ super().__init__(id, name)
46
+ self.static: bool = False
47
+ self.type: str | None = None
48
+ self.brief: str = ""
49
+
50
+ def parse(self, node: ET.Element):
51
+ self.static = node.attrib["static"] == "yes"
52
+
53
+ self.type = parse_type(node)
54
+
55
+ # Brief description
56
+ self.brief = node.find("briefdescription/para")
57
+ if self.brief is not None:
58
+ self.brief = element_to_string(self.brief)
59
+
60
+ # Verbatim
61
+ verbatim = node.find("detaileddescription/para/verbatim")
62
+ if verbatim is not None:
63
+ self.brief += "\n" + verbatim.text
64
+
65
+
66
+ class DoxygenVariable(DoxygenMember):
67
+ pass
68
+
69
+
70
+ class DoxygenParameter:
71
+ def __init__(self):
72
+ self.type = None
73
+ self.name = None
74
+ self.default_value = None
75
+ self.description = None
76
+
77
+ def parse(self, node: ET.Element):
78
+ self.type = parse_type(node)
79
+
80
+ if node.find("declname") is not None:
81
+ self.name = node.find("declname").text
82
+ if node.find("defname") is not None:
83
+ self.name = node.find("defname").text
84
+
85
+ self.default_value = (
86
+ node.find("defval").text if node.find("defval") is not None else None
87
+ )
88
+
89
+
90
+ class DoxygenFunction(DoxygenMember):
91
+ def __init__(self, id: str, name: str, class_member: bool = False):
92
+ super().__init__(id, name)
93
+ self.params: list[DoxygenParameter] = []
94
+ self.returns_description = None
95
+ self.class_member = class_member
96
+
97
+ def parse(self, node: ET.Element):
98
+ super().parse(node)
99
+
100
+ # Searching for method parameters
101
+ for param in node.findall("param"):
102
+ parameter = DoxygenParameter()
103
+ parameter.parse(param)
104
+ self.params.append(parameter)
105
+
106
+ # Searching for detailed description to retrieve parameter descriptions
107
+ for entry in node.findall(
108
+ "detaileddescription/para/parameterlist/parameteritem"
109
+ ):
110
+ param_name = entry.find("parameternamelist/parametername").text
111
+ param_desc = element_to_string(entry.find("parameterdescription/para"))
112
+
113
+ for param in self.params:
114
+ if param.name == param_name:
115
+ param.description = param_desc
116
+
117
+ # Description of method returns
118
+ return_desc = node.find("detaileddescription/para/simplesect[@kind='return']")
119
+ if return_desc:
120
+ self.returns_description = return_desc.find("para")
121
+
122
+
123
+ class DoxygenCompound(DoxygenElement):
124
+ def __init__(self, id: str, name: str):
125
+ super().__init__(id, name)
126
+ self.brief: str | None = None
127
+ self.members: dict[str, DoxygenMember] = {}
128
+ self.types: dict[str, str] = {}
129
+ self.is_class: bool = False
130
+
131
+ def parse(self, node: ET.Element):
132
+ if node.find("briefdescription/para"):
133
+ self.brief = element_to_string(node.find("briefdescription/para"))
134
+
135
+ # Searching for member definitions
136
+ for member_node in node.findall("sectiondef/memberdef"):
137
+ # If @pyignore is added to the description, this member is skipped
138
+ ignore = False
139
+ sects = member_node.findall("detaileddescription/para/xrefsect")
140
+ if sects:
141
+ for sect in sects:
142
+ if "pyignore" in sect.attrib["id"]:
143
+ ignore = True
144
+ if ignore:
145
+ continue
146
+
147
+ kind = member_node.attrib["kind"]
148
+ id = member_node.attrib["id"]
149
+
150
+ member = None
151
+ if kind == "function":
152
+ member = DoxygenFunction(
153
+ id, member_node.find("name").text, self.is_class
154
+ )
155
+ member.parse(member_node)
156
+ elif kind == "variable":
157
+ member = DoxygenVariable(id, member_node.find("name").text)
158
+ member.parse(member_node)
159
+ elif kind == "typedef":
160
+ self.types[id] = DoxygenTypedef(id, parse_type(member_node))
161
+ elif kind == "enum":
162
+ self.types[id] = DoxygenTypedef(
163
+ id, self.name + "::" + member_node.find("name").text
164
+ )
165
+
166
+ if member is not None:
167
+ self.members[id] = member
168
+
169
+
170
+ class DoxygenClass(DoxygenCompound):
171
+ def __init__(self, id: str, name: str):
172
+ super().__init__(id, name)
173
+ self.is_class: bool = True
174
+
175
+
176
+ class DoxygenNamespace(DoxygenCompound):
177
+ def __init__(self, id: str, name: str):
178
+ super().__init__(id, name)
179
+
180
+
181
+ class Doxygen:
182
+ def __init__(self):
183
+ self.compounds: dict[str, DoxygenCompound] = {}
184
+ self.elements: dict[str, DoxygenElement] = {}
185
+
186
+ def parse_directory(self, directory: str):
187
+ doxygen_xml_files = glob.glob(f"{directory}/xml/*.xml")
188
+
189
+ # Parsing all files
190
+ for xml_file in doxygen_xml_files:
191
+ self.parse_xml(xml_file)
192
+
193
+ # Collecting all elements (compounds, members and typedefs)
194
+ self.elements = self.compounds.copy()
195
+ for compound in self.compounds.values():
196
+ for element in list(compound.members.values()) + list(
197
+ compound.types.values()
198
+ ):
199
+ self.elements[element.id] = element
200
+
201
+ # Resolving member and parameter types
202
+ for compound in self.compounds.values():
203
+ for member in compound.members.values():
204
+ member.type = self.resolve_type(member.type)
205
+
206
+ if isinstance(member, DoxygenFunction):
207
+ function: DoxygenFunction = member
208
+ for param in member.params:
209
+ param.type = self.resolve_type(param.type)
210
+
211
+ def resolve_type(self, id: Union[list, str]):
212
+ if type(id) == list:
213
+ tpl = self.resolve_type(id[0])
214
+ subtypes = [self.resolve_type(subid) for subid in id[1:]]
215
+ args = ",".join(subtypes)
216
+ return f"{tpl}<{args}>"
217
+ elif id in self.elements:
218
+ return self.elements[id].name
219
+ else:
220
+ return id
221
+
222
+ def parse_xml(self, filename: str):
223
+ with open(filename, "r") as f:
224
+ xml_content = f.read()
225
+ xml_content = ET.fromstring(xml_content)
226
+
227
+ # Searching for compounddef nodes (classs & struct)
228
+ for compounddef_node in xml_content.findall("compounddef"):
229
+ self.parse_compound(compounddef_node)
230
+
231
+ def parse_compound(self, compounddef_node: ET.Element):
232
+ name = compounddef_node.find("compoundname").text
233
+ compound_kind = compounddef_node.attrib["kind"]
234
+ id = compounddef_node.attrib["id"]
235
+
236
+ if compound_kind == "class" or compound_kind == "struct":
237
+ compound = DoxygenClass(id, name)
238
+ elif compound_kind == "namespace":
239
+ compound = DoxygenNamespace(id, name)
240
+ else:
241
+ return
242
+
243
+ compound.parse(compounddef_node)
244
+ self.compounds[id] = compound
245
+
246
+ def get_class(self, class_name: str) -> DoxygenClass | None:
247
+ for compound in self.compounds.values():
248
+ if compound.name == class_name:
249
+ return compound
250
+
251
+ return None
252
+
253
+ def get_class_member(
254
+ self, class_name: str, member_name: str
255
+ ) -> DoxygenMember | None:
256
+ class_ = self.get_class(class_name)
257
+
258
+ if class_ is not None:
259
+ for member in class_.members.values():
260
+ if member.name == member_name:
261
+ return member
262
+
263
+ return None
264
+
265
+ def get_function(self, function_name: str) -> DoxygenFunction | None:
266
+ for compound in self.compounds.values():
267
+ if isinstance(compound, DoxygenNamespace):
268
+ for member in compound.members.values():
269
+ if (
270
+ isinstance(member, DoxygenFunction)
271
+ and member.name == function_name
272
+ ):
273
+ return member
274
+
275
+ return None
276
+
277
+ def get_class_function(
278
+ self, class_name: str, function_name: str
279
+ ) -> DoxygenFunction | None:
280
+ member = self.get_class_member(class_name, function_name)
281
+
282
+ if isinstance(member, DoxygenFunction):
283
+ return member
284
+
285
+ return None
286
+
287
+ def get_class_variable(
288
+ self, class_name: str, function_name: str
289
+ ) -> DoxygenVariable | None:
290
+ member = self.get_class_member(class_name, function_name)
291
+
292
+ if isinstance(member, DoxygenVariable):
293
+ return member
294
+
295
+ return None
296
+
297
+
298
+ if __name__ == "__main__":
299
+ # parse_directory(".")
300
+ doxygen = Doxygen()
301
+ doxygen.parse_directory(".")