xcoll 0.3.3__py3-none-any.whl → 0.3.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (317) hide show
  1. xcoll/beam_elements/__init__.py +5 -0
  2. xcoll/beam_elements/absorber.py +2 -1
  3. xcoll/beam_elements/base.py +32 -17
  4. xcoll/beam_elements/collimators_src/absorber.h +5 -0
  5. xcoll/beam_elements/everest.py +14 -25
  6. xcoll/colldb.py +50 -27
  7. xcoll/general.py +1 -1
  8. xcoll/headers/checks.h +7 -1
  9. xcoll/impacts/impacts.py +2 -1
  10. xcoll/impacts/impacts_src/impacts.h +1 -6
  11. xcoll/manager.py +5 -5
  12. xcoll/rf_sweep.py +90 -19
  13. xcoll/scattering_routines/everest/__init__.py +5 -0
  14. xcoll/scattering_routines/everest/everest.py +1 -1
  15. xcoll/scattering_routines/fluka/build_fluka_input.py +58 -0
  16. xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
  17. xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.so +0 -0
  18. xcoll/scattering_routines/fluka/flukaio/src/Connection.d +68 -48
  19. xcoll/scattering_routines/fluka/flukaio/src/Connection.o +0 -0
  20. xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.d +46 -37
  21. xcoll/scattering_routines/fluka/flukaio/src/FlukaIO.o +0 -0
  22. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.d +28 -25
  23. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOHandshake.o +0 -0
  24. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.d +67 -47
  25. xcoll/scattering_routines/fluka/flukaio/src/FlukaIOServer.o +0 -0
  26. xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.d +39 -33
  27. xcoll/scattering_routines/fluka/flukaio/src/FortranFlukaIO.o +0 -0
  28. xcoll/scattering_routines/fluka/flukaio/src/NetIO.d +66 -47
  29. xcoll/scattering_routines/fluka/flukaio/src/NetIO.o +0 -0
  30. {xcoll-0.3.3.dist-info → xcoll-0.3.5.dist-info}/METADATA +3 -2
  31. xcoll-0.3.5.dist-info/NOTICE +2 -0
  32. xcoll-0.3.5.dist-info/RECORD +111 -0
  33. {xcoll-0.3.3.dist-info → xcoll-0.3.5.dist-info}/WHEEL +1 -1
  34. xcoll/beam_elements/collimators_src/base_block.h +0 -14
  35. xcoll/beam_elements/collimators_src/base_collimator.h +0 -14
  36. xcoll/beam_elements/collimators_src/invalid_collimator.h +0 -15
  37. xcoll/install_collimators.py +0 -180
  38. xcoll/scattering_routines/geant4/collimasim/.git +0 -1
  39. xcoll/scattering_routines/geant4/collimasim/.gitignore +0 -12
  40. xcoll/scattering_routines/geant4/collimasim/.gitmodules +0 -3
  41. xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +0 -26
  42. xcoll/scattering_routines/geant4/collimasim/README.md +0 -21
  43. xcoll/scattering_routines/geant4/collimasim/docs/Makefile +0 -20
  44. xcoll/scattering_routines/geant4/collimasim/docs/make.bat +0 -35
  45. xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +0 -10
  46. xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +0 -59
  47. xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +0 -26
  48. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +0 -37
  49. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +0 -19
  50. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +0 -65
  51. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +0 -73
  52. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +0 -1
  53. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +0 -9
  54. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +0 -386
  55. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +0 -45
  56. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +0 -8
  57. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +0 -16
  58. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +0 -8
  59. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +0 -3
  60. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +0 -19
  61. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +0 -969
  62. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +0 -84
  63. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +0 -48
  64. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +0 -16
  65. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +0 -103
  66. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +0 -45
  67. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +0 -151
  68. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +0 -3
  69. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +0 -297
  70. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +0 -29
  71. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +0 -6
  72. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +0 -180
  73. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +0 -23
  74. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +0 -192
  75. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +0 -11
  76. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +0 -81
  77. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +0 -93
  78. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +0 -310
  79. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +0 -109
  80. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +0 -43
  81. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +0 -171
  82. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +0 -251
  83. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +0 -305
  84. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +0 -1297
  85. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +0 -262
  86. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +0 -396
  87. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +0 -568
  88. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +0 -337
  89. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +0 -13
  90. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +0 -463
  91. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +0 -286
  92. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +0 -155
  93. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +0 -174
  94. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +0 -308
  95. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +0 -91
  96. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +0 -95
  97. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +0 -2050
  98. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +0 -542
  99. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +0 -8
  100. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +0 -648
  101. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +0 -381
  102. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +0 -343
  103. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +0 -48
  104. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +0 -105
  105. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +0 -72
  106. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
  107. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  108. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +0 -427
  109. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  110. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +0 -427
  111. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +0 -130
  112. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +0 -96
  113. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +0 -8
  114. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +0 -548
  115. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +0 -605
  116. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +0 -144
  117. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +0 -1432
  118. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +0 -213
  119. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +0 -2
  120. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +0 -65
  121. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +0 -709
  122. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +0 -1021
  123. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +0 -104
  124. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +0 -346
  125. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +0 -467
  126. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +0 -978
  127. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +0 -55
  128. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +0 -606
  129. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +0 -284
  130. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +0 -163
  131. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +0 -121
  132. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +0 -193
  133. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +0 -275
  134. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +0 -1741
  135. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +0 -163
  136. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +0 -65
  137. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +0 -2497
  138. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +0 -1879
  139. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +0 -103
  140. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +0 -375
  141. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +0 -747
  142. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +0 -88
  143. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +0 -11
  144. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +0 -52
  145. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +0 -12
  146. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +0 -6
  147. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +0 -21
  148. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
  149. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +0 -482
  150. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +0 -63
  151. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +0 -41
  152. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +0 -56
  153. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +0 -155
  154. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +0 -503
  155. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +0 -208
  156. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +0 -275
  157. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +0 -73
  158. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +0 -33
  159. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
  160. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +0 -279
  161. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  162. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +0 -143
  163. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +0 -85
  164. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +0 -179
  165. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +0 -151
  166. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +0 -91
  167. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +0 -85
  168. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +0 -19
  169. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +0 -12
  170. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +0 -26
  171. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +0 -25
  172. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +0 -216
  173. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +0 -163
  174. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +0 -286
  175. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +0 -536
  176. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +0 -107
  177. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +0 -248
  178. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +0 -227
  179. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +0 -202
  180. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +0 -84
  181. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +0 -210
  182. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +0 -550
  183. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +0 -473
  184. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +0 -84
  185. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +0 -21
  186. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +0 -28
  187. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +0 -39
  188. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +0 -46
  189. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +0 -6
  190. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +0 -41
  191. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +0 -35
  192. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +0 -41
  193. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +0 -10
  194. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +0 -165
  195. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +0 -53
  196. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +0 -238
  197. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +0 -126
  198. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +0 -141
  199. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +0 -117
  200. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +0 -41
  201. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +0 -50
  202. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +0 -69
  203. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +0 -42
  204. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +0 -348
  205. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +0 -771
  206. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +0 -47
  207. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +0 -22
  208. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +0 -23
  209. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +0 -326
  210. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +0 -15
  211. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +0 -148
  212. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +0 -272
  213. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +0 -119
  214. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +0 -51
  215. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +0 -5
  216. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +0 -285
  217. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +0 -12
  218. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +0 -265
  219. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +0 -397
  220. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +0 -520
  221. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +0 -49
  222. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +0 -94
  223. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +0 -125
  224. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +0 -331
  225. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +0 -153
  226. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +0 -284
  227. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +0 -107
  228. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +0 -257
  229. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +0 -412
  230. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +0 -517
  231. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +0 -102
  232. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +0 -92
  233. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +0 -233
  234. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +0 -360
  235. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +0 -472
  236. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +0 -593
  237. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +0 -524
  238. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +0 -441
  239. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +0 -103
  240. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +0 -267
  241. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +0 -73
  242. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +0 -59
  243. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +0 -235
  244. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +0 -146
  245. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +0 -189
  246. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +0 -82
  247. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +0 -560
  248. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +0 -651
  249. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +0 -500
  250. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +0 -253
  251. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +0 -452
  252. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +0 -318
  253. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +0 -342
  254. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +0 -291
  255. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +0 -131
  256. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +0 -318
  257. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +0 -144
  258. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +0 -29
  259. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +0 -66
  260. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +0 -44
  261. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +0 -22
  262. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +0 -9
  263. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +0 -510
  264. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +0 -408
  265. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +0 -140
  266. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +0 -117
  267. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +0 -70
  268. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +0 -86
  269. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +0 -257
  270. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +0 -44
  271. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +0 -23
  272. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +0 -39
  273. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +0 -64
  274. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +0 -402
  275. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +0 -233
  276. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +0 -276
  277. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +0 -214
  278. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +0 -3
  279. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +0 -65
  280. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +0 -41
  281. xcoll/scattering_routines/geant4/collimasim/pyproject.toml +0 -8
  282. xcoll/scattering_routines/geant4/collimasim/setup.py +0 -144
  283. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +0 -403
  284. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +0 -100
  285. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +0 -662
  286. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +0 -110
  287. xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +0 -8
  288. xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +0 -63
  289. xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +0 -142
  290. xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +0 -475
  291. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +0 -6
  292. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +0 -20
  293. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +0 -1
  294. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +0 -1
  295. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +0 -1
  296. xcoll/scattering_routines/geant4/collimasim/tests/README.md +0 -25
  297. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +0 -18
  298. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +0 -68
  299. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +0 -15
  300. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +0 -110
  301. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +0 -7
  302. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +0 -3
  303. xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +0 -54
  304. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +0 -3
  305. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +0 -3
  306. xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +0 -51
  307. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +0 -65
  308. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +0 -59
  309. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +0 -102
  310. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +0 -75
  311. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +0 -74
  312. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +0 -84
  313. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +0 -159
  314. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +0 -80
  315. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +0 -97
  316. xcoll-0.3.3.dist-info/RECORD +0 -391
  317. {xcoll-0.3.3.dist-info → xcoll-0.3.5.dist-info}/LICENSE +0 -0
@@ -1,520 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- import re
3
-
4
- import pytest
5
-
6
- import env # noqa: F401
7
- from pybind11_tests import ConstructorStats
8
- from pybind11_tests import factory_constructors as m
9
- from pybind11_tests.factory_constructors import tag
10
-
11
-
12
- def test_init_factory_basic():
13
- """Tests py::init_factory() wrapper around various ways of returning the object"""
14
-
15
- cstats = [
16
- ConstructorStats.get(c)
17
- for c in [m.TestFactory1, m.TestFactory2, m.TestFactory3]
18
- ]
19
- cstats[0].alive() # force gc
20
- n_inst = ConstructorStats.detail_reg_inst()
21
-
22
- x1 = m.TestFactory1(tag.unique_ptr, 3)
23
- assert x1.value == "3"
24
- y1 = m.TestFactory1(tag.pointer)
25
- assert y1.value == "(empty)"
26
- z1 = m.TestFactory1("hi!")
27
- assert z1.value == "hi!"
28
-
29
- assert ConstructorStats.detail_reg_inst() == n_inst + 3
30
-
31
- x2 = m.TestFactory2(tag.move)
32
- assert x2.value == "(empty2)"
33
- y2 = m.TestFactory2(tag.pointer, 7)
34
- assert y2.value == "7"
35
- z2 = m.TestFactory2(tag.unique_ptr, "hi again")
36
- assert z2.value == "hi again"
37
-
38
- assert ConstructorStats.detail_reg_inst() == n_inst + 6
39
-
40
- x3 = m.TestFactory3(tag.shared_ptr)
41
- assert x3.value == "(empty3)"
42
- y3 = m.TestFactory3(tag.pointer, 42)
43
- assert y3.value == "42"
44
- z3 = m.TestFactory3("bye")
45
- assert z3.value == "bye"
46
-
47
- for null_ptr_kind in [tag.null_ptr, tag.null_unique_ptr, tag.null_shared_ptr]:
48
- with pytest.raises(TypeError) as excinfo:
49
- m.TestFactory3(null_ptr_kind)
50
- assert (
51
- str(excinfo.value) == "pybind11::init(): factory function returned nullptr"
52
- )
53
-
54
- assert [i.alive() for i in cstats] == [3, 3, 3]
55
- assert ConstructorStats.detail_reg_inst() == n_inst + 9
56
-
57
- del x1, y2, y3, z3
58
- assert [i.alive() for i in cstats] == [2, 2, 1]
59
- assert ConstructorStats.detail_reg_inst() == n_inst + 5
60
- del x2, x3, y1, z1, z2
61
- assert [i.alive() for i in cstats] == [0, 0, 0]
62
- assert ConstructorStats.detail_reg_inst() == n_inst
63
-
64
- assert [i.values() for i in cstats] == [
65
- ["3", "hi!"],
66
- ["7", "hi again"],
67
- ["42", "bye"],
68
- ]
69
- assert [i.default_constructions for i in cstats] == [1, 1, 1]
70
-
71
-
72
- def test_init_factory_signature(msg):
73
- with pytest.raises(TypeError) as excinfo:
74
- m.TestFactory1("invalid", "constructor", "arguments")
75
- assert (
76
- msg(excinfo.value)
77
- == """
78
- __init__(): incompatible constructor arguments. The following argument types are supported:
79
- 1. m.factory_constructors.TestFactory1(arg0: m.factory_constructors.tag.unique_ptr_tag, arg1: int)
80
- 2. m.factory_constructors.TestFactory1(arg0: str)
81
- 3. m.factory_constructors.TestFactory1(arg0: m.factory_constructors.tag.pointer_tag)
82
- 4. m.factory_constructors.TestFactory1(arg0: handle, arg1: int, arg2: handle)
83
-
84
- Invoked with: 'invalid', 'constructor', 'arguments'
85
- """ # noqa: E501 line too long
86
- )
87
-
88
- assert (
89
- msg(m.TestFactory1.__init__.__doc__)
90
- == """
91
- __init__(*args, **kwargs)
92
- Overloaded function.
93
-
94
- 1. __init__(self: m.factory_constructors.TestFactory1, arg0: m.factory_constructors.tag.unique_ptr_tag, arg1: int) -> None
95
-
96
- 2. __init__(self: m.factory_constructors.TestFactory1, arg0: str) -> None
97
-
98
- 3. __init__(self: m.factory_constructors.TestFactory1, arg0: m.factory_constructors.tag.pointer_tag) -> None
99
-
100
- 4. __init__(self: m.factory_constructors.TestFactory1, arg0: handle, arg1: int, arg2: handle) -> None
101
- """ # noqa: E501 line too long
102
- )
103
-
104
-
105
- def test_init_factory_casting():
106
- """Tests py::init_factory() wrapper with various upcasting and downcasting returns"""
107
-
108
- cstats = [
109
- ConstructorStats.get(c)
110
- for c in [m.TestFactory3, m.TestFactory4, m.TestFactory5]
111
- ]
112
- cstats[0].alive() # force gc
113
- n_inst = ConstructorStats.detail_reg_inst()
114
-
115
- # Construction from derived references:
116
- a = m.TestFactory3(tag.pointer, tag.TF4, 4)
117
- assert a.value == "4"
118
- b = m.TestFactory3(tag.shared_ptr, tag.TF4, 5)
119
- assert b.value == "5"
120
- c = m.TestFactory3(tag.pointer, tag.TF5, 6)
121
- assert c.value == "6"
122
- d = m.TestFactory3(tag.shared_ptr, tag.TF5, 7)
123
- assert d.value == "7"
124
-
125
- assert ConstructorStats.detail_reg_inst() == n_inst + 4
126
-
127
- # Shared a lambda with TF3:
128
- e = m.TestFactory4(tag.pointer, tag.TF4, 8)
129
- assert e.value == "8"
130
-
131
- assert ConstructorStats.detail_reg_inst() == n_inst + 5
132
- assert [i.alive() for i in cstats] == [5, 3, 2]
133
-
134
- del a
135
- assert [i.alive() for i in cstats] == [4, 2, 2]
136
- assert ConstructorStats.detail_reg_inst() == n_inst + 4
137
-
138
- del b, c, e
139
- assert [i.alive() for i in cstats] == [1, 0, 1]
140
- assert ConstructorStats.detail_reg_inst() == n_inst + 1
141
-
142
- del d
143
- assert [i.alive() for i in cstats] == [0, 0, 0]
144
- assert ConstructorStats.detail_reg_inst() == n_inst
145
-
146
- assert [i.values() for i in cstats] == [
147
- ["4", "5", "6", "7", "8"],
148
- ["4", "5", "8"],
149
- ["6", "7"],
150
- ]
151
-
152
-
153
- def test_init_factory_alias():
154
- """Tests py::init_factory() wrapper with value conversions and alias types"""
155
-
156
- cstats = [m.TestFactory6.get_cstats(), m.TestFactory6.get_alias_cstats()]
157
- cstats[0].alive() # force gc
158
- n_inst = ConstructorStats.detail_reg_inst()
159
-
160
- a = m.TestFactory6(tag.base, 1)
161
- assert a.get() == 1
162
- assert not a.has_alias()
163
- b = m.TestFactory6(tag.alias, "hi there")
164
- assert b.get() == 8
165
- assert b.has_alias()
166
- c = m.TestFactory6(tag.alias, 3)
167
- assert c.get() == 3
168
- assert c.has_alias()
169
- d = m.TestFactory6(tag.alias, tag.pointer, 4)
170
- assert d.get() == 4
171
- assert d.has_alias()
172
- e = m.TestFactory6(tag.base, tag.pointer, 5)
173
- assert e.get() == 5
174
- assert not e.has_alias()
175
- f = m.TestFactory6(tag.base, tag.alias, tag.pointer, 6)
176
- assert f.get() == 6
177
- assert f.has_alias()
178
-
179
- assert ConstructorStats.detail_reg_inst() == n_inst + 6
180
- assert [i.alive() for i in cstats] == [6, 4]
181
-
182
- del a, b, e
183
- assert [i.alive() for i in cstats] == [3, 3]
184
- assert ConstructorStats.detail_reg_inst() == n_inst + 3
185
- del f, c, d
186
- assert [i.alive() for i in cstats] == [0, 0]
187
- assert ConstructorStats.detail_reg_inst() == n_inst
188
-
189
- class MyTest(m.TestFactory6):
190
- def __init__(self, *args):
191
- m.TestFactory6.__init__(self, *args)
192
-
193
- def get(self):
194
- return -5 + m.TestFactory6.get(self)
195
-
196
- # Return Class by value, moved into new alias:
197
- z = MyTest(tag.base, 123)
198
- assert z.get() == 118
199
- assert z.has_alias()
200
-
201
- # Return alias by value, moved into new alias:
202
- y = MyTest(tag.alias, "why hello!")
203
- assert y.get() == 5
204
- assert y.has_alias()
205
-
206
- # Return Class by pointer, moved into new alias then original destroyed:
207
- x = MyTest(tag.base, tag.pointer, 47)
208
- assert x.get() == 42
209
- assert x.has_alias()
210
-
211
- assert ConstructorStats.detail_reg_inst() == n_inst + 3
212
- assert [i.alive() for i in cstats] == [3, 3]
213
- del x, y, z
214
- assert [i.alive() for i in cstats] == [0, 0]
215
- assert ConstructorStats.detail_reg_inst() == n_inst
216
-
217
- assert [i.values() for i in cstats] == [
218
- ["1", "8", "3", "4", "5", "6", "123", "10", "47"],
219
- ["hi there", "3", "4", "6", "move", "123", "why hello!", "move", "47"],
220
- ]
221
-
222
-
223
- def test_init_factory_dual():
224
- """Tests init factory functions with dual main/alias factory functions"""
225
- from pybind11_tests.factory_constructors import TestFactory7
226
-
227
- cstats = [TestFactory7.get_cstats(), TestFactory7.get_alias_cstats()]
228
- cstats[0].alive() # force gc
229
- n_inst = ConstructorStats.detail_reg_inst()
230
-
231
- class PythFactory7(TestFactory7):
232
- def get(self):
233
- return 100 + TestFactory7.get(self)
234
-
235
- a1 = TestFactory7(1)
236
- a2 = PythFactory7(2)
237
- assert a1.get() == 1
238
- assert a2.get() == 102
239
- assert not a1.has_alias()
240
- assert a2.has_alias()
241
-
242
- b1 = TestFactory7(tag.pointer, 3)
243
- b2 = PythFactory7(tag.pointer, 4)
244
- assert b1.get() == 3
245
- assert b2.get() == 104
246
- assert not b1.has_alias()
247
- assert b2.has_alias()
248
-
249
- c1 = TestFactory7(tag.mixed, 5)
250
- c2 = PythFactory7(tag.mixed, 6)
251
- assert c1.get() == 5
252
- assert c2.get() == 106
253
- assert not c1.has_alias()
254
- assert c2.has_alias()
255
-
256
- d1 = TestFactory7(tag.base, tag.pointer, 7)
257
- d2 = PythFactory7(tag.base, tag.pointer, 8)
258
- assert d1.get() == 7
259
- assert d2.get() == 108
260
- assert not d1.has_alias()
261
- assert d2.has_alias()
262
-
263
- # Both return an alias; the second multiplies the value by 10:
264
- e1 = TestFactory7(tag.alias, tag.pointer, 9)
265
- e2 = PythFactory7(tag.alias, tag.pointer, 10)
266
- assert e1.get() == 9
267
- assert e2.get() == 200
268
- assert e1.has_alias()
269
- assert e2.has_alias()
270
-
271
- f1 = TestFactory7(tag.shared_ptr, tag.base, 11)
272
- f2 = PythFactory7(tag.shared_ptr, tag.base, 12)
273
- assert f1.get() == 11
274
- assert f2.get() == 112
275
- assert not f1.has_alias()
276
- assert f2.has_alias()
277
-
278
- g1 = TestFactory7(tag.shared_ptr, tag.invalid_base, 13)
279
- assert g1.get() == 13
280
- assert not g1.has_alias()
281
- with pytest.raises(TypeError) as excinfo:
282
- PythFactory7(tag.shared_ptr, tag.invalid_base, 14)
283
- assert (
284
- str(excinfo.value)
285
- == "pybind11::init(): construction failed: returned holder-wrapped instance is not an "
286
- "alias instance"
287
- )
288
-
289
- assert [i.alive() for i in cstats] == [13, 7]
290
- assert ConstructorStats.detail_reg_inst() == n_inst + 13
291
-
292
- del a1, a2, b1, d1, e1, e2
293
- assert [i.alive() for i in cstats] == [7, 4]
294
- assert ConstructorStats.detail_reg_inst() == n_inst + 7
295
- del b2, c1, c2, d2, f1, f2, g1
296
- assert [i.alive() for i in cstats] == [0, 0]
297
- assert ConstructorStats.detail_reg_inst() == n_inst
298
-
299
- assert [i.values() for i in cstats] == [
300
- ["1", "2", "3", "4", "5", "6", "7", "8", "9", "100", "11", "12", "13", "14"],
301
- ["2", "4", "6", "8", "9", "100", "12"],
302
- ]
303
-
304
-
305
- def test_no_placement_new(capture):
306
- """Prior to 2.2, `py::init<...>` relied on the type supporting placement
307
- new; this tests a class without placement new support."""
308
- with capture:
309
- a = m.NoPlacementNew(123)
310
-
311
- found = re.search(r"^operator new called, returning (\d+)\n$", str(capture))
312
- assert found
313
- assert a.i == 123
314
- with capture:
315
- del a
316
- pytest.gc_collect()
317
- assert capture == "operator delete called on " + found.group(1)
318
-
319
- with capture:
320
- b = m.NoPlacementNew()
321
-
322
- found = re.search(r"^operator new called, returning (\d+)\n$", str(capture))
323
- assert found
324
- assert b.i == 100
325
- with capture:
326
- del b
327
- pytest.gc_collect()
328
- assert capture == "operator delete called on " + found.group(1)
329
-
330
-
331
- def test_multiple_inheritance():
332
- class MITest(m.TestFactory1, m.TestFactory2):
333
- def __init__(self):
334
- m.TestFactory1.__init__(self, tag.unique_ptr, 33)
335
- m.TestFactory2.__init__(self, tag.move)
336
-
337
- a = MITest()
338
- assert m.TestFactory1.value.fget(a) == "33"
339
- assert m.TestFactory2.value.fget(a) == "(empty2)"
340
-
341
-
342
- def create_and_destroy(*args):
343
- a = m.NoisyAlloc(*args)
344
- print("---")
345
- del a
346
- pytest.gc_collect()
347
-
348
-
349
- def strip_comments(s):
350
- return re.sub(r"\s+#.*", "", s)
351
-
352
-
353
- def test_reallocation_a(capture, msg):
354
- """When the constructor is overloaded, previous overloads can require a preallocated value.
355
- This test makes sure that such preallocated values only happen when they might be necessary,
356
- and that they are deallocated properly."""
357
-
358
- pytest.gc_collect()
359
-
360
- with capture:
361
- create_and_destroy(1)
362
- assert (
363
- msg(capture)
364
- == """
365
- noisy new
366
- noisy placement new
367
- NoisyAlloc(int 1)
368
- ---
369
- ~NoisyAlloc()
370
- noisy delete
371
- """
372
- )
373
-
374
-
375
- def test_reallocation_b(capture, msg):
376
- with capture:
377
- create_and_destroy(1.5)
378
- assert msg(capture) == strip_comments(
379
- """
380
- noisy new # allocation required to attempt first overload
381
- noisy delete # have to dealloc before considering factory init overload
382
- noisy new # pointer factory calling "new", part 1: allocation
383
- NoisyAlloc(double 1.5) # ... part two, invoking constructor
384
- ---
385
- ~NoisyAlloc() # Destructor
386
- noisy delete # operator delete
387
- """
388
- )
389
-
390
-
391
- def test_reallocation_c(capture, msg):
392
- with capture:
393
- create_and_destroy(2, 3)
394
- assert msg(capture) == strip_comments(
395
- """
396
- noisy new # pointer factory calling "new", allocation
397
- NoisyAlloc(int 2) # constructor
398
- ---
399
- ~NoisyAlloc() # Destructor
400
- noisy delete # operator delete
401
- """
402
- )
403
-
404
-
405
- def test_reallocation_d(capture, msg):
406
- with capture:
407
- create_and_destroy(2.5, 3)
408
- assert msg(capture) == strip_comments(
409
- """
410
- NoisyAlloc(double 2.5) # construction (local func variable: operator_new not called)
411
- noisy new # return-by-value "new" part 1: allocation
412
- ~NoisyAlloc() # moved-away local func variable destruction
413
- ---
414
- ~NoisyAlloc() # Destructor
415
- noisy delete # operator delete
416
- """
417
- )
418
-
419
-
420
- def test_reallocation_e(capture, msg):
421
- with capture:
422
- create_and_destroy(3.5, 4.5)
423
- assert msg(capture) == strip_comments(
424
- """
425
- noisy new # preallocation needed before invoking placement-new overload
426
- noisy placement new # Placement new
427
- NoisyAlloc(double 3.5) # construction
428
- ---
429
- ~NoisyAlloc() # Destructor
430
- noisy delete # operator delete
431
- """
432
- )
433
-
434
-
435
- def test_reallocation_f(capture, msg):
436
- with capture:
437
- create_and_destroy(4, 0.5)
438
- assert msg(capture) == strip_comments(
439
- """
440
- noisy new # preallocation needed before invoking placement-new overload
441
- noisy delete # deallocation of preallocated storage
442
- noisy new # Factory pointer allocation
443
- NoisyAlloc(int 4) # factory pointer construction
444
- ---
445
- ~NoisyAlloc() # Destructor
446
- noisy delete # operator delete
447
- """
448
- )
449
-
450
-
451
- def test_reallocation_g(capture, msg):
452
- with capture:
453
- create_and_destroy(5, "hi")
454
- assert msg(capture) == strip_comments(
455
- """
456
- noisy new # preallocation needed before invoking first placement new
457
- noisy delete # delete before considering new-style constructor
458
- noisy new # preallocation for second placement new
459
- noisy placement new # Placement new in the second placement new overload
460
- NoisyAlloc(int 5) # construction
461
- ---
462
- ~NoisyAlloc() # Destructor
463
- noisy delete # operator delete
464
- """
465
- )
466
-
467
-
468
- @pytest.mark.skipif("env.PY2")
469
- def test_invalid_self():
470
- """Tests invocation of the pybind-registered base class with an invalid `self` argument. You
471
- can only actually do this on Python 3: Python 2 raises an exception itself if you try."""
472
-
473
- class NotPybindDerived(object):
474
- pass
475
-
476
- # Attempts to initialize with an invalid type passed as `self`:
477
- class BrokenTF1(m.TestFactory1):
478
- def __init__(self, bad):
479
- if bad == 1:
480
- a = m.TestFactory2(tag.pointer, 1)
481
- m.TestFactory1.__init__(a, tag.pointer)
482
- elif bad == 2:
483
- a = NotPybindDerived()
484
- m.TestFactory1.__init__(a, tag.pointer)
485
-
486
- # Same as above, but for a class with an alias:
487
- class BrokenTF6(m.TestFactory6):
488
- def __init__(self, bad):
489
- if bad == 0:
490
- m.TestFactory6.__init__()
491
- elif bad == 1:
492
- a = m.TestFactory2(tag.pointer, 1)
493
- m.TestFactory6.__init__(a, tag.base, 1)
494
- elif bad == 2:
495
- a = m.TestFactory2(tag.pointer, 1)
496
- m.TestFactory6.__init__(a, tag.alias, 1)
497
- elif bad == 3:
498
- m.TestFactory6.__init__(
499
- NotPybindDerived.__new__(NotPybindDerived), tag.base, 1
500
- )
501
- elif bad == 4:
502
- m.TestFactory6.__init__(
503
- NotPybindDerived.__new__(NotPybindDerived), tag.alias, 1
504
- )
505
-
506
- for arg in (1, 2):
507
- with pytest.raises(TypeError) as excinfo:
508
- BrokenTF1(arg)
509
- assert (
510
- str(excinfo.value)
511
- == "__init__(self, ...) called with invalid or missing `self` argument"
512
- )
513
-
514
- for arg in (0, 1, 2, 3, 4):
515
- with pytest.raises(TypeError) as excinfo:
516
- BrokenTF6(arg)
517
- assert (
518
- str(excinfo.value)
519
- == "__init__(self, ...) called with invalid or missing `self` argument"
520
- )
@@ -1,49 +0,0 @@
1
- /*
2
- tests/test_gil_scoped.cpp -- acquire and release gil
3
-
4
- Copyright (c) 2017 Borja Zarco (Google LLC) <bzarco@google.com>
5
-
6
- All rights reserved. Use of this source code is governed by a
7
- BSD-style license that can be found in the LICENSE file.
8
- */
9
-
10
- #include "pybind11_tests.h"
11
- #include <pybind11/functional.h>
12
-
13
-
14
- class VirtClass {
15
- public:
16
- virtual ~VirtClass() = default;
17
- VirtClass() = default;
18
- VirtClass(const VirtClass&) = delete;
19
- virtual void virtual_func() {}
20
- virtual void pure_virtual_func() = 0;
21
- };
22
-
23
- class PyVirtClass : public VirtClass {
24
- void virtual_func() override {
25
- PYBIND11_OVERRIDE(void, VirtClass, virtual_func,);
26
- }
27
- void pure_virtual_func() override {
28
- PYBIND11_OVERRIDE_PURE(void, VirtClass, pure_virtual_func,);
29
- }
30
- };
31
-
32
- TEST_SUBMODULE(gil_scoped, m) {
33
- py::class_<VirtClass, PyVirtClass>(m, "VirtClass")
34
- .def(py::init<>())
35
- .def("virtual_func", &VirtClass::virtual_func)
36
- .def("pure_virtual_func", &VirtClass::pure_virtual_func);
37
-
38
- m.def("test_callback_py_obj", [](py::object &func) { func(); });
39
- m.def("test_callback_std_func", [](const std::function<void()> &func) { func(); });
40
- m.def("test_callback_virtual_func", [](VirtClass &virt) { virt.virtual_func(); });
41
- m.def("test_callback_pure_virtual_func", [](VirtClass &virt) { virt.pure_virtual_func(); });
42
- m.def("test_cross_module_gil", []() {
43
- auto cm = py::module_::import("cross_module_gil_utils");
44
- auto gil_acquire
45
- = reinterpret_cast<void (*)()>(PyLong_AsVoidPtr(cm.attr("gil_acquire_funcaddr").ptr()));
46
- py::gil_scoped_release gil_release;
47
- gil_acquire();
48
- });
49
- }
@@ -1,94 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- import multiprocessing
3
- import threading
4
-
5
- from pybind11_tests import gil_scoped as m
6
-
7
-
8
- def _run_in_process(target, *args, **kwargs):
9
- """Runs target in process and returns its exitcode after 10s (None if still alive)."""
10
- process = multiprocessing.Process(target=target, args=args, kwargs=kwargs)
11
- process.daemon = True
12
- try:
13
- process.start()
14
- # Do not need to wait much, 10s should be more than enough.
15
- process.join(timeout=10)
16
- return process.exitcode
17
- finally:
18
- if process.is_alive():
19
- process.terminate()
20
-
21
-
22
- def _python_to_cpp_to_python():
23
- """Calls different C++ functions that come back to Python."""
24
-
25
- class ExtendedVirtClass(m.VirtClass):
26
- def virtual_func(self):
27
- pass
28
-
29
- def pure_virtual_func(self):
30
- pass
31
-
32
- extended = ExtendedVirtClass()
33
- m.test_callback_py_obj(lambda: None)
34
- m.test_callback_std_func(lambda: None)
35
- m.test_callback_virtual_func(extended)
36
- m.test_callback_pure_virtual_func(extended)
37
-
38
-
39
- def _python_to_cpp_to_python_from_threads(num_threads, parallel=False):
40
- """Calls different C++ functions that come back to Python, from Python threads."""
41
- threads = []
42
- for _ in range(num_threads):
43
- thread = threading.Thread(target=_python_to_cpp_to_python)
44
- thread.daemon = True
45
- thread.start()
46
- if parallel:
47
- threads.append(thread)
48
- else:
49
- thread.join()
50
- for thread in threads:
51
- thread.join()
52
-
53
-
54
- # TODO: FIXME, sometimes returns -11 (segfault) instead of 0 on macOS Python 3.9
55
- def test_python_to_cpp_to_python_from_thread():
56
- """Makes sure there is no GIL deadlock when running in a thread.
57
-
58
- It runs in a separate process to be able to stop and assert if it deadlocks.
59
- """
60
- assert _run_in_process(_python_to_cpp_to_python_from_threads, 1) == 0
61
-
62
-
63
- # TODO: FIXME on macOS Python 3.9
64
- def test_python_to_cpp_to_python_from_thread_multiple_parallel():
65
- """Makes sure there is no GIL deadlock when running in a thread multiple times in parallel.
66
-
67
- It runs in a separate process to be able to stop and assert if it deadlocks.
68
- """
69
- assert _run_in_process(_python_to_cpp_to_python_from_threads, 8, parallel=True) == 0
70
-
71
-
72
- # TODO: FIXME on macOS Python 3.9
73
- def test_python_to_cpp_to_python_from_thread_multiple_sequential():
74
- """Makes sure there is no GIL deadlock when running in a thread multiple times sequentially.
75
-
76
- It runs in a separate process to be able to stop and assert if it deadlocks.
77
- """
78
- assert (
79
- _run_in_process(_python_to_cpp_to_python_from_threads, 8, parallel=False) == 0
80
- )
81
-
82
-
83
- # TODO: FIXME on macOS Python 3.9
84
- def test_python_to_cpp_to_python_from_process():
85
- """Makes sure there is no GIL deadlock when using processes.
86
-
87
- This test is for completion, but it was never an issue.
88
- """
89
- assert _run_in_process(_python_to_cpp_to_python) == 0
90
-
91
-
92
- def test_cross_module_gil():
93
- """Makes sure that the GIL can be acquired by another module from a GIL-released state."""
94
- m.test_cross_module_gil() # Should not raise a SIGSEGV