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,550 +0,0 @@
1
- /*
2
- tests/test_class.cpp -- test py::class_ definitions and basic functionality
3
-
4
- Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
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
- #if defined(__INTEL_COMPILER) && __cplusplus >= 201703L
11
- // Intel compiler requires a separate header file to support aligned new operators
12
- // and does not set the __cpp_aligned_new feature macro.
13
- // This header needs to be included before pybind11.
14
- #include <aligned_new>
15
- #endif
16
-
17
- #include "pybind11_tests.h"
18
- #include "constructor_stats.h"
19
- #include "local_bindings.h"
20
- #include <pybind11/stl.h>
21
-
22
- #include <utility>
23
-
24
- #if defined(_MSC_VER)
25
- # pragma warning(disable: 4324) // warning C4324: structure was padded due to alignment specifier
26
- #endif
27
-
28
- // test_brace_initialization
29
- struct NoBraceInitialization {
30
- explicit NoBraceInitialization(std::vector<int> v) : vec{std::move(v)} {}
31
- template <typename T>
32
- NoBraceInitialization(std::initializer_list<T> l) : vec(l) {}
33
-
34
- std::vector<int> vec;
35
- };
36
-
37
- TEST_SUBMODULE(class_, m) {
38
- // test_instance
39
- struct NoConstructor {
40
- NoConstructor() = default;
41
- NoConstructor(const NoConstructor &) = default;
42
- NoConstructor(NoConstructor &&) = default;
43
- static NoConstructor *new_instance() {
44
- auto *ptr = new NoConstructor();
45
- print_created(ptr, "via new_instance");
46
- return ptr;
47
- }
48
- ~NoConstructor() { print_destroyed(this); }
49
- };
50
- struct NoConstructorNew {
51
- NoConstructorNew() = default;
52
- NoConstructorNew(const NoConstructorNew &) = default;
53
- NoConstructorNew(NoConstructorNew &&) = default;
54
- static NoConstructorNew *new_instance() {
55
- auto *ptr = new NoConstructorNew();
56
- print_created(ptr, "via new_instance");
57
- return ptr;
58
- }
59
- ~NoConstructorNew() { print_destroyed(this); }
60
- };
61
-
62
- py::class_<NoConstructor>(m, "NoConstructor")
63
- .def_static("new_instance", &NoConstructor::new_instance, "Return an instance");
64
-
65
- py::class_<NoConstructorNew>(m, "NoConstructorNew")
66
- .def(py::init([](const NoConstructorNew &self) { return self; })) // Need a NOOP __init__
67
- .def_static("__new__",
68
- [](const py::object &) { return NoConstructorNew::new_instance(); });
69
-
70
- // test_inheritance
71
- class Pet {
72
- public:
73
- Pet(const std::string &name, const std::string &species)
74
- : m_name(name), m_species(species) {}
75
- std::string name() const { return m_name; }
76
- std::string species() const { return m_species; }
77
- private:
78
- std::string m_name;
79
- std::string m_species;
80
- };
81
-
82
- class Dog : public Pet {
83
- public:
84
- explicit Dog(const std::string &name) : Pet(name, "dog") {}
85
- std::string bark() const { return "Woof!"; }
86
- };
87
-
88
- class Rabbit : public Pet {
89
- public:
90
- explicit Rabbit(const std::string &name) : Pet(name, "parrot") {}
91
- };
92
-
93
- class Hamster : public Pet {
94
- public:
95
- explicit Hamster(const std::string &name) : Pet(name, "rodent") {}
96
- };
97
-
98
- class Chimera : public Pet {
99
- Chimera() : Pet("Kimmy", "chimera") {}
100
- };
101
-
102
- py::class_<Pet> pet_class(m, "Pet");
103
- pet_class
104
- .def(py::init<std::string, std::string>())
105
- .def("name", &Pet::name)
106
- .def("species", &Pet::species);
107
-
108
- /* One way of declaring a subclass relationship: reference parent's class_ object */
109
- py::class_<Dog>(m, "Dog", pet_class)
110
- .def(py::init<std::string>());
111
-
112
- /* Another way of declaring a subclass relationship: reference parent's C++ type */
113
- py::class_<Rabbit, Pet>(m, "Rabbit")
114
- .def(py::init<std::string>());
115
-
116
- /* And another: list parent in class template arguments */
117
- py::class_<Hamster, Pet>(m, "Hamster")
118
- .def(py::init<std::string>());
119
-
120
- /* Constructors are not inherited by default */
121
- py::class_<Chimera, Pet>(m, "Chimera");
122
-
123
- m.def("pet_name_species", [](const Pet &pet) { return pet.name() + " is a " + pet.species(); });
124
- m.def("dog_bark", [](const Dog &dog) { return dog.bark(); });
125
-
126
- // test_automatic_upcasting
127
- struct BaseClass {
128
- BaseClass() = default;
129
- BaseClass(const BaseClass &) = default;
130
- BaseClass(BaseClass &&) = default;
131
- virtual ~BaseClass() = default;
132
- };
133
- struct DerivedClass1 : BaseClass { };
134
- struct DerivedClass2 : BaseClass { };
135
-
136
- py::class_<BaseClass>(m, "BaseClass").def(py::init<>());
137
- py::class_<DerivedClass1>(m, "DerivedClass1").def(py::init<>());
138
- py::class_<DerivedClass2>(m, "DerivedClass2").def(py::init<>());
139
-
140
- m.def("return_class_1", []() -> BaseClass* { return new DerivedClass1(); });
141
- m.def("return_class_2", []() -> BaseClass* { return new DerivedClass2(); });
142
- m.def("return_class_n", [](int n) -> BaseClass* {
143
- if (n == 1) return new DerivedClass1();
144
- if (n == 2) return new DerivedClass2();
145
- return new BaseClass();
146
- });
147
- m.def("return_none", []() -> BaseClass* { return nullptr; });
148
-
149
- // test_isinstance
150
- m.def("check_instances", [](const py::list &l) {
151
- return py::make_tuple(
152
- py::isinstance<py::tuple>(l[0]),
153
- py::isinstance<py::dict>(l[1]),
154
- py::isinstance<Pet>(l[2]),
155
- py::isinstance<Pet>(l[3]),
156
- py::isinstance<Dog>(l[4]),
157
- py::isinstance<Rabbit>(l[5]),
158
- py::isinstance<UnregisteredType>(l[6])
159
- );
160
- });
161
-
162
- struct Invalid {};
163
-
164
- // test_type
165
- m.def("check_type", [](int category) {
166
- // Currently not supported (via a fail at compile time)
167
- // See https://github.com/pybind/pybind11/issues/2486
168
- // if (category == 2)
169
- // return py::type::of<int>();
170
- if (category == 1)
171
- return py::type::of<DerivedClass1>();
172
- return py::type::of<Invalid>();
173
- });
174
-
175
- m.def("get_type_of", [](py::object ob) { return py::type::of(std::move(ob)); });
176
-
177
- m.def("get_type_classic", [](py::handle h) {
178
- return h.get_type();
179
- });
180
-
181
- m.def("as_type", [](const py::object &ob) { return py::type(ob); });
182
-
183
- // test_mismatched_holder
184
- struct MismatchBase1 { };
185
- struct MismatchDerived1 : MismatchBase1 { };
186
-
187
- struct MismatchBase2 { };
188
- struct MismatchDerived2 : MismatchBase2 { };
189
-
190
- m.def("mismatched_holder_1", []() {
191
- auto mod = py::module_::import("__main__");
192
- py::class_<MismatchBase1, std::shared_ptr<MismatchBase1>>(mod, "MismatchBase1");
193
- py::class_<MismatchDerived1, MismatchBase1>(mod, "MismatchDerived1");
194
- });
195
- m.def("mismatched_holder_2", []() {
196
- auto mod = py::module_::import("__main__");
197
- py::class_<MismatchBase2>(mod, "MismatchBase2");
198
- py::class_<MismatchDerived2, std::shared_ptr<MismatchDerived2>,
199
- MismatchBase2>(mod, "MismatchDerived2");
200
- });
201
-
202
- // test_override_static
203
- // #511: problem with inheritance + overwritten def_static
204
- struct MyBase {
205
- static std::unique_ptr<MyBase> make() {
206
- return std::unique_ptr<MyBase>(new MyBase());
207
- }
208
- };
209
-
210
- struct MyDerived : MyBase {
211
- static std::unique_ptr<MyDerived> make() {
212
- return std::unique_ptr<MyDerived>(new MyDerived());
213
- }
214
- };
215
-
216
- py::class_<MyBase>(m, "MyBase")
217
- .def_static("make", &MyBase::make);
218
-
219
- py::class_<MyDerived, MyBase>(m, "MyDerived")
220
- .def_static("make", &MyDerived::make)
221
- .def_static("make2", &MyDerived::make);
222
-
223
- // test_implicit_conversion_life_support
224
- struct ConvertibleFromUserType {
225
- int i;
226
-
227
- explicit ConvertibleFromUserType(UserType u) : i(u.value()) {}
228
- };
229
-
230
- py::class_<ConvertibleFromUserType>(m, "AcceptsUserType")
231
- .def(py::init<UserType>());
232
- py::implicitly_convertible<UserType, ConvertibleFromUserType>();
233
-
234
- m.def("implicitly_convert_argument", [](const ConvertibleFromUserType &r) { return r.i; });
235
- m.def("implicitly_convert_variable", [](const py::object &o) {
236
- // `o` is `UserType` and `r` is a reference to a temporary created by implicit
237
- // conversion. This is valid when called inside a bound function because the temp
238
- // object is attached to the same life support system as the arguments.
239
- const auto &r = o.cast<const ConvertibleFromUserType &>();
240
- return r.i;
241
- });
242
- m.add_object("implicitly_convert_variable_fail", [&] {
243
- auto f = [](PyObject *, PyObject *args) -> PyObject * {
244
- auto o = py::reinterpret_borrow<py::tuple>(args)[0];
245
- try { // It should fail here because there is no life support.
246
- o.cast<const ConvertibleFromUserType &>();
247
- } catch (const py::cast_error &e) {
248
- return py::str(e.what()).release().ptr();
249
- }
250
- return py::str().release().ptr();
251
- };
252
-
253
- auto def = new PyMethodDef{"f", f, METH_VARARGS, nullptr};
254
- py::capsule def_capsule(def, [](void *ptr) { delete reinterpret_cast<PyMethodDef *>(ptr); });
255
- return py::reinterpret_steal<py::object>(PyCFunction_NewEx(def, def_capsule.ptr(), m.ptr()));
256
- }());
257
-
258
- // test_operator_new_delete
259
- struct HasOpNewDel {
260
- std::uint64_t i;
261
- static void *operator new(size_t s) { py::print("A new", s); return ::operator new(s); }
262
- static void *operator new(size_t s, void *ptr) { py::print("A placement-new", s); return ptr; }
263
- static void operator delete(void *p) { py::print("A delete"); return ::operator delete(p); }
264
- };
265
- struct HasOpNewDelSize {
266
- std::uint32_t i;
267
- static void *operator new(size_t s) { py::print("B new", s); return ::operator new(s); }
268
- static void *operator new(size_t s, void *ptr) { py::print("B placement-new", s); return ptr; }
269
- static void operator delete(void *p, size_t s) { py::print("B delete", s); return ::operator delete(p); }
270
- };
271
- struct AliasedHasOpNewDelSize {
272
- std::uint64_t i;
273
- static void *operator new(size_t s) { py::print("C new", s); return ::operator new(s); }
274
- static void *operator new(size_t s, void *ptr) { py::print("C placement-new", s); return ptr; }
275
- static void operator delete(void *p, size_t s) { py::print("C delete", s); return ::operator delete(p); }
276
- virtual ~AliasedHasOpNewDelSize() = default;
277
- AliasedHasOpNewDelSize() = default;
278
- AliasedHasOpNewDelSize(const AliasedHasOpNewDelSize&) = delete;
279
- };
280
- struct PyAliasedHasOpNewDelSize : AliasedHasOpNewDelSize {
281
- PyAliasedHasOpNewDelSize() = default;
282
- explicit PyAliasedHasOpNewDelSize(int) {}
283
- std::uint64_t j;
284
- };
285
- struct HasOpNewDelBoth {
286
- std::uint32_t i[8];
287
- static void *operator new(size_t s) { py::print("D new", s); return ::operator new(s); }
288
- static void *operator new(size_t s, void *ptr) { py::print("D placement-new", s); return ptr; }
289
- static void operator delete(void *p) { py::print("D delete"); return ::operator delete(p); }
290
- static void operator delete(void *p, size_t s) { py::print("D wrong delete", s); return ::operator delete(p); }
291
- };
292
- py::class_<HasOpNewDel>(m, "HasOpNewDel").def(py::init<>());
293
- py::class_<HasOpNewDelSize>(m, "HasOpNewDelSize").def(py::init<>());
294
- py::class_<HasOpNewDelBoth>(m, "HasOpNewDelBoth").def(py::init<>());
295
- py::class_<AliasedHasOpNewDelSize, PyAliasedHasOpNewDelSize> aliased(m, "AliasedHasOpNewDelSize");
296
- aliased.def(py::init<>());
297
- aliased.attr("size_noalias") = py::int_(sizeof(AliasedHasOpNewDelSize));
298
- aliased.attr("size_alias") = py::int_(sizeof(PyAliasedHasOpNewDelSize));
299
-
300
- // This test is actually part of test_local_bindings (test_duplicate_local), but we need a
301
- // definition in a different compilation unit within the same module:
302
- bind_local<LocalExternal, 17>(m, "LocalExternal", py::module_local());
303
-
304
- // test_bind_protected_functions
305
- class ProtectedA {
306
- protected:
307
- int foo() const { return value; }
308
-
309
- private:
310
- int value = 42;
311
- };
312
-
313
- class PublicistA : public ProtectedA {
314
- public:
315
- using ProtectedA::foo;
316
- };
317
-
318
- py::class_<ProtectedA>(m, "ProtectedA")
319
- .def(py::init<>())
320
- #if !defined(_MSC_VER) || _MSC_VER >= 1910
321
- .def("foo", &PublicistA::foo);
322
- #else
323
- .def("foo", static_cast<int (ProtectedA::*)() const>(&PublicistA::foo));
324
- #endif
325
-
326
- class ProtectedB {
327
- public:
328
- virtual ~ProtectedB() = default;
329
- ProtectedB() = default;
330
- ProtectedB(const ProtectedB &) = delete;
331
-
332
- protected:
333
- virtual int foo() const { return value; }
334
-
335
- private:
336
- int value = 42;
337
- };
338
-
339
- class TrampolineB : public ProtectedB {
340
- public:
341
- int foo() const override { PYBIND11_OVERRIDE(int, ProtectedB, foo, ); }
342
- };
343
-
344
- class PublicistB : public ProtectedB {
345
- public:
346
- // [workaround(intel)] = default does not work here
347
- // Removing or defaulting this destructor results in linking errors with the Intel compiler
348
- // (in Debug builds only, tested with icpc (ICC) 2021.1 Beta 20200827)
349
- ~PublicistB() override {}; // NOLINT(modernize-use-equals-default)
350
- using ProtectedB::foo;
351
- };
352
-
353
- py::class_<ProtectedB, TrampolineB>(m, "ProtectedB")
354
- .def(py::init<>())
355
- #if !defined(_MSC_VER) || _MSC_VER >= 1910
356
- .def("foo", &PublicistB::foo);
357
- #else
358
- .def("foo", static_cast<int (ProtectedB::*)() const>(&PublicistB::foo));
359
- #endif
360
-
361
- // test_brace_initialization
362
- struct BraceInitialization {
363
- int field1;
364
- std::string field2;
365
- };
366
-
367
- py::class_<BraceInitialization>(m, "BraceInitialization")
368
- .def(py::init<int, const std::string &>())
369
- .def_readwrite("field1", &BraceInitialization::field1)
370
- .def_readwrite("field2", &BraceInitialization::field2);
371
- // We *don't* want to construct using braces when the given constructor argument maps to a
372
- // constructor, because brace initialization could go to the wrong place (in particular when
373
- // there is also an `initializer_list<T>`-accept constructor):
374
- py::class_<NoBraceInitialization>(m, "NoBraceInitialization")
375
- .def(py::init<std::vector<int>>())
376
- .def_readonly("vec", &NoBraceInitialization::vec);
377
-
378
- // test_reentrant_implicit_conversion_failure
379
- // #1035: issue with runaway reentrant implicit conversion
380
- struct BogusImplicitConversion {
381
- BogusImplicitConversion(const BogusImplicitConversion &) = default;
382
- };
383
-
384
- py::class_<BogusImplicitConversion>(m, "BogusImplicitConversion")
385
- .def(py::init<const BogusImplicitConversion &>());
386
-
387
- py::implicitly_convertible<int, BogusImplicitConversion>();
388
-
389
- // test_qualname
390
- // #1166: nested class docstring doesn't show nested name
391
- // Also related: tests that __qualname__ is set properly
392
- struct NestBase {};
393
- struct Nested {};
394
- py::class_<NestBase> base(m, "NestBase");
395
- base.def(py::init<>());
396
- py::class_<Nested>(base, "Nested")
397
- .def(py::init<>())
398
- .def("fn", [](Nested &, int, NestBase &, Nested &) {})
399
- .def("fa", [](Nested &, int, NestBase &, Nested &) {},
400
- "a"_a, "b"_a, "c"_a);
401
- base.def("g", [](NestBase &, Nested &) {});
402
- base.def("h", []() { return NestBase(); });
403
-
404
- // test_error_after_conversion
405
- // The second-pass path through dispatcher() previously didn't
406
- // remember which overload was used, and would crash trying to
407
- // generate a useful error message
408
-
409
- struct NotRegistered {};
410
- struct StringWrapper { std::string str; };
411
- m.def("test_error_after_conversions", [](int) {});
412
- m.def("test_error_after_conversions",
413
- [](const StringWrapper &) -> NotRegistered { return {}; });
414
- py::class_<StringWrapper>(m, "StringWrapper").def(py::init<std::string>());
415
- py::implicitly_convertible<std::string, StringWrapper>();
416
-
417
- #if defined(PYBIND11_CPP17)
418
- struct alignas(1024) Aligned {
419
- std::uintptr_t ptr() const { return (uintptr_t) this; }
420
- };
421
- py::class_<Aligned>(m, "Aligned")
422
- .def(py::init<>())
423
- .def("ptr", &Aligned::ptr);
424
- #endif
425
-
426
- // test_final
427
- struct IsFinal final {};
428
- py::class_<IsFinal>(m, "IsFinal", py::is_final());
429
-
430
- // test_non_final_final
431
- struct IsNonFinalFinal {};
432
- py::class_<IsNonFinalFinal>(m, "IsNonFinalFinal", py::is_final());
433
-
434
- // test_exception_rvalue_abort
435
- struct PyPrintDestructor {
436
- PyPrintDestructor() = default;
437
- ~PyPrintDestructor() {
438
- py::print("Print from destructor");
439
- }
440
- void throw_something() { throw std::runtime_error("error"); }
441
- };
442
- py::class_<PyPrintDestructor>(m, "PyPrintDestructor")
443
- .def(py::init<>())
444
- .def("throw_something", &PyPrintDestructor::throw_something);
445
-
446
- // test_multiple_instances_with_same_pointer
447
- struct SamePointer {};
448
- static SamePointer samePointer;
449
- py::class_<SamePointer, std::unique_ptr<SamePointer, py::nodelete>>(m, "SamePointer")
450
- .def(py::init([]() { return &samePointer; }));
451
-
452
- struct Empty {};
453
- py::class_<Empty>(m, "Empty")
454
- .def(py::init<>());
455
-
456
- // test_base_and_derived_nested_scope
457
- struct BaseWithNested {
458
- struct Nested {};
459
- };
460
-
461
- struct DerivedWithNested : BaseWithNested {
462
- struct Nested {};
463
- };
464
-
465
- py::class_<BaseWithNested> baseWithNested_class(m, "BaseWithNested");
466
- py::class_<DerivedWithNested, BaseWithNested> derivedWithNested_class(m, "DerivedWithNested");
467
- py::class_<BaseWithNested::Nested>(baseWithNested_class, "Nested")
468
- .def_static("get_name", []() { return "BaseWithNested::Nested"; });
469
- py::class_<DerivedWithNested::Nested>(derivedWithNested_class, "Nested")
470
- .def_static("get_name", []() { return "DerivedWithNested::Nested"; });
471
-
472
- // test_register_duplicate_class
473
- struct Duplicate {};
474
- struct OtherDuplicate {};
475
- struct DuplicateNested {};
476
- struct OtherDuplicateNested {};
477
-
478
- m.def("register_duplicate_class_name", [](const py::module_ &m) {
479
- py::class_<Duplicate>(m, "Duplicate");
480
- py::class_<OtherDuplicate>(m, "Duplicate");
481
- });
482
- m.def("register_duplicate_class_type", [](const py::module_ &m) {
483
- py::class_<OtherDuplicate>(m, "OtherDuplicate");
484
- py::class_<OtherDuplicate>(m, "YetAnotherDuplicate");
485
- });
486
- m.def("register_duplicate_nested_class_name", [](const py::object &gt) {
487
- py::class_<DuplicateNested>(gt, "DuplicateNested");
488
- py::class_<OtherDuplicateNested>(gt, "DuplicateNested");
489
- });
490
- m.def("register_duplicate_nested_class_type", [](const py::object &gt) {
491
- py::class_<OtherDuplicateNested>(gt, "OtherDuplicateNested");
492
- py::class_<OtherDuplicateNested>(gt, "YetAnotherDuplicateNested");
493
- });
494
- }
495
-
496
- template <int N> class BreaksBase { public:
497
- virtual ~BreaksBase() = default;
498
- BreaksBase() = default;
499
- BreaksBase(const BreaksBase&) = delete;
500
- };
501
- template <int N> class BreaksTramp : public BreaksBase<N> {};
502
- // These should all compile just fine:
503
- using DoesntBreak1 = py::class_<BreaksBase<1>, std::unique_ptr<BreaksBase<1>>, BreaksTramp<1>>;
504
- using DoesntBreak2 = py::class_<BreaksBase<2>, BreaksTramp<2>, std::unique_ptr<BreaksBase<2>>>;
505
- using DoesntBreak3 = py::class_<BreaksBase<3>, std::unique_ptr<BreaksBase<3>>>;
506
- using DoesntBreak4 = py::class_<BreaksBase<4>, BreaksTramp<4>>;
507
- using DoesntBreak5 = py::class_<BreaksBase<5>>;
508
- using DoesntBreak6 = py::class_<BreaksBase<6>, std::shared_ptr<BreaksBase<6>>, BreaksTramp<6>>;
509
- using DoesntBreak7 = py::class_<BreaksBase<7>, BreaksTramp<7>, std::shared_ptr<BreaksBase<7>>>;
510
- using DoesntBreak8 = py::class_<BreaksBase<8>, std::shared_ptr<BreaksBase<8>>>;
511
- #define CHECK_BASE(N) static_assert(std::is_same<typename DoesntBreak##N::type, BreaksBase<(N)>>::value, \
512
- "DoesntBreak" #N " has wrong type!")
513
- CHECK_BASE(1); CHECK_BASE(2); CHECK_BASE(3); CHECK_BASE(4); CHECK_BASE(5); CHECK_BASE(6); CHECK_BASE(7); CHECK_BASE(8);
514
- #define CHECK_ALIAS(N) static_assert(DoesntBreak##N::has_alias && std::is_same<typename DoesntBreak##N::type_alias, BreaksTramp<(N)>>::value, \
515
- "DoesntBreak" #N " has wrong type_alias!")
516
- #define CHECK_NOALIAS(N) static_assert(!DoesntBreak##N::has_alias && std::is_void<typename DoesntBreak##N::type_alias>::value, \
517
- "DoesntBreak" #N " has type alias, but shouldn't!")
518
- CHECK_ALIAS(1); CHECK_ALIAS(2); CHECK_NOALIAS(3); CHECK_ALIAS(4); CHECK_NOALIAS(5); CHECK_ALIAS(6); CHECK_ALIAS(7); CHECK_NOALIAS(8);
519
- #define CHECK_HOLDER(N, TYPE) static_assert(std::is_same<typename DoesntBreak##N::holder_type, std::TYPE##_ptr<BreaksBase<(N)>>>::value, \
520
- "DoesntBreak" #N " has wrong holder_type!")
521
- CHECK_HOLDER(1, unique); CHECK_HOLDER(2, unique); CHECK_HOLDER(3, unique); CHECK_HOLDER(4, unique); CHECK_HOLDER(5, unique);
522
- CHECK_HOLDER(6, shared); CHECK_HOLDER(7, shared); CHECK_HOLDER(8, shared);
523
-
524
- // There's no nice way to test that these fail because they fail to compile; leave them here,
525
- // though, so that they can be manually tested by uncommenting them (and seeing that compilation
526
- // failures occurs).
527
-
528
- // We have to actually look into the type: the typedef alone isn't enough to instantiate the type:
529
- #define CHECK_BROKEN(N) static_assert(std::is_same<typename Breaks##N::type, BreaksBase<-(N)>>::value, \
530
- "Breaks1 has wrong type!");
531
-
532
- //// Two holder classes:
533
- //typedef py::class_<BreaksBase<-1>, std::unique_ptr<BreaksBase<-1>>, std::unique_ptr<BreaksBase<-1>>> Breaks1;
534
- //CHECK_BROKEN(1);
535
- //// Two aliases:
536
- //typedef py::class_<BreaksBase<-2>, BreaksTramp<-2>, BreaksTramp<-2>> Breaks2;
537
- //CHECK_BROKEN(2);
538
- //// Holder + 2 aliases
539
- //typedef py::class_<BreaksBase<-3>, std::unique_ptr<BreaksBase<-3>>, BreaksTramp<-3>, BreaksTramp<-3>> Breaks3;
540
- //CHECK_BROKEN(3);
541
- //// Alias + 2 holders
542
- //typedef py::class_<BreaksBase<-4>, std::unique_ptr<BreaksBase<-4>>, BreaksTramp<-4>, std::shared_ptr<BreaksBase<-4>>> Breaks4;
543
- //CHECK_BROKEN(4);
544
- //// Invalid option (not a subclass or holder)
545
- //typedef py::class_<BreaksBase<-5>, BreaksTramp<-4>> Breaks5;
546
- //CHECK_BROKEN(5);
547
- //// Invalid option: multiple inheritance not supported:
548
- //template <> struct BreaksBase<-8> : BreaksBase<-6>, BreaksBase<-7> {};
549
- //typedef py::class_<BreaksBase<-8>, BreaksBase<-6>, BreaksBase<-7>> Breaks8;
550
- //CHECK_BROKEN(8);