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,291 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- import pytest
3
-
4
- from pybind11_tests import ConstructorStats, UserType
5
- from pybind11_tests import stl as m
6
-
7
-
8
- def test_vector(doc):
9
- """std::vector <-> list"""
10
- lst = m.cast_vector()
11
- assert lst == [1]
12
- lst.append(2)
13
- assert m.load_vector(lst)
14
- assert m.load_vector(tuple(lst))
15
-
16
- assert m.cast_bool_vector() == [True, False]
17
- assert m.load_bool_vector([True, False])
18
-
19
- assert doc(m.cast_vector) == "cast_vector() -> List[int]"
20
- assert doc(m.load_vector) == "load_vector(arg0: List[int]) -> bool"
21
-
22
- # Test regression caused by 936: pointers to stl containers weren't castable
23
- assert m.cast_ptr_vector() == ["lvalue", "lvalue"]
24
-
25
-
26
- def test_deque(doc):
27
- """std::deque <-> list"""
28
- lst = m.cast_deque()
29
- assert lst == [1]
30
- lst.append(2)
31
- assert m.load_deque(lst)
32
- assert m.load_deque(tuple(lst))
33
-
34
-
35
- def test_array(doc):
36
- """std::array <-> list"""
37
- lst = m.cast_array()
38
- assert lst == [1, 2]
39
- assert m.load_array(lst)
40
-
41
- assert doc(m.cast_array) == "cast_array() -> List[int[2]]"
42
- assert doc(m.load_array) == "load_array(arg0: List[int[2]]) -> bool"
43
-
44
-
45
- def test_valarray(doc):
46
- """std::valarray <-> list"""
47
- lst = m.cast_valarray()
48
- assert lst == [1, 4, 9]
49
- assert m.load_valarray(lst)
50
-
51
- assert doc(m.cast_valarray) == "cast_valarray() -> List[int]"
52
- assert doc(m.load_valarray) == "load_valarray(arg0: List[int]) -> bool"
53
-
54
-
55
- def test_map(doc):
56
- """std::map <-> dict"""
57
- d = m.cast_map()
58
- assert d == {"key": "value"}
59
- assert "key" in d
60
- d["key2"] = "value2"
61
- assert "key2" in d
62
- assert m.load_map(d)
63
-
64
- assert doc(m.cast_map) == "cast_map() -> Dict[str, str]"
65
- assert doc(m.load_map) == "load_map(arg0: Dict[str, str]) -> bool"
66
-
67
-
68
- def test_set(doc):
69
- """std::set <-> set"""
70
- s = m.cast_set()
71
- assert s == {"key1", "key2"}
72
- s.add("key3")
73
- assert m.load_set(s)
74
-
75
- assert doc(m.cast_set) == "cast_set() -> Set[str]"
76
- assert doc(m.load_set) == "load_set(arg0: Set[str]) -> bool"
77
-
78
-
79
- def test_recursive_casting():
80
- """Tests that stl casters preserve lvalue/rvalue context for container values"""
81
- assert m.cast_rv_vector() == ["rvalue", "rvalue"]
82
- assert m.cast_lv_vector() == ["lvalue", "lvalue"]
83
- assert m.cast_rv_array() == ["rvalue", "rvalue", "rvalue"]
84
- assert m.cast_lv_array() == ["lvalue", "lvalue"]
85
- assert m.cast_rv_map() == {"a": "rvalue"}
86
- assert m.cast_lv_map() == {"a": "lvalue", "b": "lvalue"}
87
- assert m.cast_rv_nested() == [[[{"b": "rvalue", "c": "rvalue"}], [{"a": "rvalue"}]]]
88
- assert m.cast_lv_nested() == {
89
- "a": [[["lvalue", "lvalue"]], [["lvalue", "lvalue"]]],
90
- "b": [[["lvalue", "lvalue"], ["lvalue", "lvalue"]]],
91
- }
92
-
93
- # Issue #853 test case:
94
- z = m.cast_unique_ptr_vector()
95
- assert z[0].value == 7 and z[1].value == 42
96
-
97
-
98
- def test_move_out_container():
99
- """Properties use the `reference_internal` policy by default. If the underlying function
100
- returns an rvalue, the policy is automatically changed to `move` to avoid referencing
101
- a temporary. In case the return value is a container of user-defined types, the policy
102
- also needs to be applied to the elements, not just the container."""
103
- c = m.MoveOutContainer()
104
- moved_out_list = c.move_list
105
- assert [x.value for x in moved_out_list] == [0, 1, 2]
106
-
107
-
108
- @pytest.mark.skipif(not hasattr(m, "has_optional"), reason="no <optional>")
109
- def test_optional():
110
- assert m.double_or_zero(None) == 0
111
- assert m.double_or_zero(42) == 84
112
- pytest.raises(TypeError, m.double_or_zero, "foo")
113
-
114
- assert m.half_or_none(0) is None
115
- assert m.half_or_none(42) == 21
116
- pytest.raises(TypeError, m.half_or_none, "foo")
117
-
118
- assert m.test_nullopt() == 42
119
- assert m.test_nullopt(None) == 42
120
- assert m.test_nullopt(42) == 42
121
- assert m.test_nullopt(43) == 43
122
-
123
- assert m.test_no_assign() == 42
124
- assert m.test_no_assign(None) == 42
125
- assert m.test_no_assign(m.NoAssign(43)) == 43
126
- pytest.raises(TypeError, m.test_no_assign, 43)
127
-
128
- assert m.nodefer_none_optional(None)
129
-
130
- holder = m.OptionalHolder()
131
- mvalue = holder.member
132
- assert mvalue.initialized
133
- assert holder.member_initialized()
134
-
135
-
136
- @pytest.mark.skipif(
137
- not hasattr(m, "has_exp_optional"), reason="no <experimental/optional>"
138
- )
139
- def test_exp_optional():
140
- assert m.double_or_zero_exp(None) == 0
141
- assert m.double_or_zero_exp(42) == 84
142
- pytest.raises(TypeError, m.double_or_zero_exp, "foo")
143
-
144
- assert m.half_or_none_exp(0) is None
145
- assert m.half_or_none_exp(42) == 21
146
- pytest.raises(TypeError, m.half_or_none_exp, "foo")
147
-
148
- assert m.test_nullopt_exp() == 42
149
- assert m.test_nullopt_exp(None) == 42
150
- assert m.test_nullopt_exp(42) == 42
151
- assert m.test_nullopt_exp(43) == 43
152
-
153
- assert m.test_no_assign_exp() == 42
154
- assert m.test_no_assign_exp(None) == 42
155
- assert m.test_no_assign_exp(m.NoAssign(43)) == 43
156
- pytest.raises(TypeError, m.test_no_assign_exp, 43)
157
-
158
- holder = m.OptionalExpHolder()
159
- mvalue = holder.member
160
- assert mvalue.initialized
161
- assert holder.member_initialized()
162
-
163
-
164
- @pytest.mark.skipif(not hasattr(m, "has_filesystem"), reason="no <filesystem>")
165
- def test_fs_path():
166
- from pathlib import Path
167
-
168
- class PseudoStrPath:
169
- def __fspath__(self):
170
- return "foo/bar"
171
-
172
- class PseudoBytesPath:
173
- def __fspath__(self):
174
- return b"foo/bar"
175
-
176
- assert m.parent_path(Path("foo/bar")) == Path("foo")
177
- assert m.parent_path("foo/bar") == Path("foo")
178
- assert m.parent_path(b"foo/bar") == Path("foo")
179
- assert m.parent_path(PseudoStrPath()) == Path("foo")
180
- assert m.parent_path(PseudoBytesPath()) == Path("foo")
181
-
182
-
183
- @pytest.mark.skipif(not hasattr(m, "load_variant"), reason="no <variant>")
184
- def test_variant(doc):
185
- assert m.load_variant(1) == "int"
186
- assert m.load_variant("1") == "std::string"
187
- assert m.load_variant(1.0) == "double"
188
- assert m.load_variant(None) == "std::nullptr_t"
189
-
190
- assert m.load_variant_2pass(1) == "int"
191
- assert m.load_variant_2pass(1.0) == "double"
192
-
193
- assert m.cast_variant() == (5, "Hello")
194
-
195
- assert (
196
- doc(m.load_variant) == "load_variant(arg0: Union[int, str, float, None]) -> str"
197
- )
198
-
199
-
200
- def test_vec_of_reference_wrapper():
201
- """#171: Can't return reference wrappers (or STL structures containing them)"""
202
- assert (
203
- str(m.return_vec_of_reference_wrapper(UserType(4)))
204
- == "[UserType(1), UserType(2), UserType(3), UserType(4)]"
205
- )
206
-
207
-
208
- def test_stl_pass_by_pointer(msg):
209
- """Passing nullptr or None to an STL container pointer is not expected to work"""
210
- with pytest.raises(TypeError) as excinfo:
211
- m.stl_pass_by_pointer() # default value is `nullptr`
212
- assert (
213
- msg(excinfo.value)
214
- == """
215
- stl_pass_by_pointer(): incompatible function arguments. The following argument types are supported:
216
- 1. (v: List[int] = None) -> List[int]
217
-
218
- Invoked with:
219
- """ # noqa: E501 line too long
220
- )
221
-
222
- with pytest.raises(TypeError) as excinfo:
223
- m.stl_pass_by_pointer(None)
224
- assert (
225
- msg(excinfo.value)
226
- == """
227
- stl_pass_by_pointer(): incompatible function arguments. The following argument types are supported:
228
- 1. (v: List[int] = None) -> List[int]
229
-
230
- Invoked with: None
231
- """ # noqa: E501 line too long
232
- )
233
-
234
- assert m.stl_pass_by_pointer([1, 2, 3]) == [1, 2, 3]
235
-
236
-
237
- def test_missing_header_message():
238
- """Trying convert `list` to a `std::vector`, or vice versa, without including
239
- <pybind11/stl.h> should result in a helpful suggestion in the error message"""
240
- import pybind11_cross_module_tests as cm
241
-
242
- expected_message = (
243
- "Did you forget to `#include <pybind11/stl.h>`? Or <pybind11/complex.h>,\n"
244
- "<pybind11/functional.h>, <pybind11/chrono.h>, etc. Some automatic\n"
245
- "conversions are optional and require extra headers to be included\n"
246
- "when compiling your pybind11 module."
247
- )
248
-
249
- with pytest.raises(TypeError) as excinfo:
250
- cm.missing_header_arg([1.0, 2.0, 3.0])
251
- assert expected_message in str(excinfo.value)
252
-
253
- with pytest.raises(TypeError) as excinfo:
254
- cm.missing_header_return()
255
- assert expected_message in str(excinfo.value)
256
-
257
-
258
- def test_function_with_string_and_vector_string_arg():
259
- """Check if a string is NOT implicitly converted to a list, which was the
260
- behavior before fix of issue #1258"""
261
- assert m.func_with_string_or_vector_string_arg_overload(("A", "B")) == 2
262
- assert m.func_with_string_or_vector_string_arg_overload(["A", "B"]) == 2
263
- assert m.func_with_string_or_vector_string_arg_overload("A") == 3
264
-
265
-
266
- def test_stl_ownership():
267
- cstats = ConstructorStats.get(m.Placeholder)
268
- assert cstats.alive() == 0
269
- r = m.test_stl_ownership()
270
- assert len(r) == 1
271
- del r
272
- assert cstats.alive() == 0
273
-
274
-
275
- def test_array_cast_sequence():
276
- assert m.array_cast_sequence((1, 2, 3)) == [1, 2, 3]
277
-
278
-
279
- def test_issue_1561():
280
- """check fix for issue #1561"""
281
- bar = m.Issue1561Outer()
282
- bar.list = [m.Issue1561Inner("bar")]
283
- bar.list
284
- assert bar.list[0].data == "bar"
285
-
286
-
287
- def test_return_vector_bool_raw_ptr():
288
- # Add `while True:` for manual leak checking.
289
- v = m.return_vector_bool_raw_ptr()
290
- assert isinstance(v, list)
291
- assert len(v) == 4513
@@ -1,131 +0,0 @@
1
- /*
2
- tests/test_stl_binders.cpp -- Usage of stl_binders functions
3
-
4
- Copyright (c) 2016 Sergey Lyskov
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
-
12
- #include <pybind11/stl_bind.h>
13
- #include <pybind11/numpy.h>
14
- #include <map>
15
- #include <deque>
16
- #include <unordered_map>
17
-
18
- class El {
19
- public:
20
- El() = delete;
21
- explicit El(int v) : a(v) {}
22
-
23
- int a;
24
- };
25
-
26
- std::ostream & operator<<(std::ostream &s, El const&v) {
27
- s << "El{" << v.a << '}';
28
- return s;
29
- }
30
-
31
- /// Issue #487: binding std::vector<E> with E non-copyable
32
- class E_nc {
33
- public:
34
- explicit E_nc(int i) : value{i} {}
35
- E_nc(const E_nc &) = delete;
36
- E_nc &operator=(const E_nc &) = delete;
37
- E_nc(E_nc &&) = default;
38
- E_nc &operator=(E_nc &&) = default;
39
-
40
- int value;
41
- };
42
-
43
- template <class Container> Container *one_to_n(int n) {
44
- auto v = new Container();
45
- for (int i = 1; i <= n; i++)
46
- v->emplace_back(i);
47
- return v;
48
- }
49
-
50
- template <class Map> Map *times_ten(int n) {
51
- auto m = new Map();
52
- for (int i = 1; i <= n; i++)
53
- m->emplace(int(i), E_nc(10*i));
54
- return m;
55
- }
56
-
57
- template <class NestMap> NestMap *times_hundred(int n) {
58
- auto m = new NestMap();
59
- for (int i = 1; i <= n; i++)
60
- for (int j = 1; j <= n; j++)
61
- (*m)[i].emplace(int(j*10), E_nc(100*j));
62
- return m;
63
- }
64
-
65
- TEST_SUBMODULE(stl_binders, m) {
66
- // test_vector_int
67
- py::bind_vector<std::vector<unsigned int>>(m, "VectorInt", py::buffer_protocol());
68
-
69
- // test_vector_custom
70
- py::class_<El>(m, "El")
71
- .def(py::init<int>());
72
- py::bind_vector<std::vector<El>>(m, "VectorEl");
73
- py::bind_vector<std::vector<std::vector<El>>>(m, "VectorVectorEl");
74
-
75
- // test_map_string_double
76
- py::bind_map<std::map<std::string, double>>(m, "MapStringDouble");
77
- py::bind_map<std::unordered_map<std::string, double>>(m, "UnorderedMapStringDouble");
78
-
79
- // test_map_string_double_const
80
- py::bind_map<std::map<std::string, double const>>(m, "MapStringDoubleConst");
81
- py::bind_map<std::unordered_map<std::string, double const>>(m, "UnorderedMapStringDoubleConst");
82
-
83
- py::class_<E_nc>(m, "ENC")
84
- .def(py::init<int>())
85
- .def_readwrite("value", &E_nc::value);
86
-
87
- // test_noncopyable_containers
88
- py::bind_vector<std::vector<E_nc>>(m, "VectorENC");
89
- m.def("get_vnc", &one_to_n<std::vector<E_nc>>);
90
- py::bind_vector<std::deque<E_nc>>(m, "DequeENC");
91
- m.def("get_dnc", &one_to_n<std::deque<E_nc>>);
92
- py::bind_map<std::map<int, E_nc>>(m, "MapENC");
93
- m.def("get_mnc", &times_ten<std::map<int, E_nc>>);
94
- py::bind_map<std::unordered_map<int, E_nc>>(m, "UmapENC");
95
- m.def("get_umnc", &times_ten<std::unordered_map<int, E_nc>>);
96
- // Issue #1885: binding nested std::map<X, Container<E>> with E non-copyable
97
- py::bind_map<std::map<int, std::vector<E_nc>>>(m, "MapVecENC");
98
- m.def("get_nvnc", [](int n)
99
- {
100
- auto m = new std::map<int, std::vector<E_nc>>();
101
- for (int i = 1; i <= n; i++)
102
- for (int j = 1; j <= n; j++)
103
- (*m)[i].emplace_back(j);
104
- return m;
105
- });
106
- py::bind_map<std::map<int, std::map<int, E_nc>>>(m, "MapMapENC");
107
- m.def("get_nmnc", &times_hundred<std::map<int, std::map<int, E_nc>>>);
108
- py::bind_map<std::unordered_map<int, std::unordered_map<int, E_nc>>>(m, "UmapUmapENC");
109
- m.def("get_numnc", &times_hundred<std::unordered_map<int, std::unordered_map<int, E_nc>>>);
110
-
111
- // test_vector_buffer
112
- py::bind_vector<std::vector<unsigned char>>(m, "VectorUChar", py::buffer_protocol());
113
- // no dtype declared for this version:
114
- struct VUndeclStruct { bool w; uint32_t x; double y; bool z; };
115
- m.def("create_undeclstruct", [m] () mutable {
116
- py::bind_vector<std::vector<VUndeclStruct>>(m, "VectorUndeclStruct", py::buffer_protocol());
117
- });
118
-
119
- // The rest depends on numpy:
120
- try { py::module_::import("numpy"); }
121
- catch (...) { return; }
122
-
123
- // test_vector_buffer_numpy
124
- struct VStruct { bool w; uint32_t x; double y; bool z; };
125
- PYBIND11_NUMPY_DTYPE(VStruct, w, x, y, z);
126
- py::class_<VStruct>(m, "VStruct").def_readwrite("x", &VStruct::x);
127
- py::bind_vector<std::vector<VStruct>>(m, "VectorStruct", py::buffer_protocol());
128
- m.def("get_vectorstruct", [] {
129
- return std::vector<VStruct>{{false, 5, 3.0, true}, {true, 30, -1e4, false}};
130
- });
131
- }