ctpbee-opt-api 0.1.0__cp310-cp310-win_amd64.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.
Files changed (414) hide show
  1. ctpbee_api/__init__.py +17 -0
  2. ctpbee_api/ctp/__init__.py +3 -0
  3. ctpbee_api/ctp/ctp_constant.py +1253 -0
  4. ctpbee_api/ctp/generator/concat.py +93 -0
  5. ctpbee_api/ctp/generator/const.py +325 -0
  6. ctpbee_api/ctp/generator/ctp_constant.py +1274 -0
  7. ctpbee_api/ctp/generator/ctp_md_header_define.h +13 -0
  8. ctpbee_api/ctp/generator/ctp_md_header_function.h +6 -0
  9. ctpbee_api/ctp/generator/ctp_md_header_on.h +26 -0
  10. ctpbee_api/ctp/generator/ctp_md_header_process.h +26 -0
  11. ctpbee_api/ctp/generator/ctp_md_source_function.cpp +42 -0
  12. ctpbee_api/ctp/generator/ctp_md_source_module.cpp +18 -0
  13. ctpbee_api/ctp/generator/ctp_md_source_on.cpp +156 -0
  14. ctpbee_api/ctp/generator/ctp_md_source_process.cpp +282 -0
  15. ctpbee_api/ctp/generator/ctp_md_source_switch.cpp +78 -0
  16. ctpbee_api/ctp/generator/ctp_md_source_task.cpp +211 -0
  17. ctpbee_api/ctp/generator/ctp_struct.py +5640 -0
  18. ctpbee_api/ctp/generator/ctp_td_header_define.h +130 -0
  19. ctpbee_api/ctp/generator/ctp_td_header_function.h +174 -0
  20. ctpbee_api/ctp/generator/ctp_td_header_on.h +260 -0
  21. ctpbee_api/ctp/generator/ctp_td_header_process.h +260 -0
  22. ctpbee_api/ctp/generator/ctp_td_source_function.cpp +1456 -0
  23. ctpbee_api/ctp/generator/ctp_td_source_module.cpp +222 -0
  24. ctpbee_api/ctp/generator/ctp_td_source_on.cpp +1572 -0
  25. ctpbee_api/ctp/generator/ctp_td_source_process.cpp +5472 -0
  26. ctpbee_api/ctp/generator/ctp_td_source_switch.cpp +780 -0
  27. ctpbee_api/ctp/generator/ctp_td_source_task.cpp +2444 -0
  28. ctpbee_api/ctp/generator/ctp_typedef.py +800 -0
  29. ctpbee_api/ctp/generator/generate_api_functions.py +345 -0
  30. ctpbee_api/ctp/generator/generate_data_type.py +76 -0
  31. ctpbee_api/ctp/generator/generate_struct.py +84 -0
  32. ctpbee_api/ctp/include/mac/ctp/ThostFtdcMdApi.h +168 -0
  33. ctpbee_api/ctp/include/mac/ctp/ThostFtdcTraderApi.h +770 -0
  34. ctpbee_api/ctp/include/mac/ctp/ThostFtdcUserApiDataType.h +6878 -0
  35. ctpbee_api/ctp/include/mac/ctp/ThostFtdcUserApiStruct.h +10915 -0
  36. ctpbee_api/ctp/include/mac/pybind11/attr.h +690 -0
  37. ctpbee_api/ctp/include/mac/pybind11/buffer_info.h +208 -0
  38. ctpbee_api/ctp/include/mac/pybind11/cast.h +1704 -0
  39. ctpbee_api/ctp/include/mac/pybind11/chrono.h +225 -0
  40. ctpbee_api/ctp/include/mac/pybind11/common.h +2 -0
  41. ctpbee_api/ctp/include/mac/pybind11/complex.h +74 -0
  42. ctpbee_api/ctp/include/mac/pybind11/detail/class.h +743 -0
  43. ctpbee_api/ctp/include/mac/pybind11/detail/common.h +1255 -0
  44. ctpbee_api/ctp/include/mac/pybind11/detail/descr.h +171 -0
  45. ctpbee_api/ctp/include/mac/pybind11/detail/init.h +434 -0
  46. ctpbee_api/ctp/include/mac/pybind11/detail/internals.h +656 -0
  47. ctpbee_api/ctp/include/mac/pybind11/detail/type_caster_base.h +1177 -0
  48. ctpbee_api/ctp/include/mac/pybind11/detail/typeid.h +65 -0
  49. ctpbee_api/ctp/include/mac/pybind11/eigen/common.h +9 -0
  50. ctpbee_api/ctp/include/mac/pybind11/eigen/matrix.h +714 -0
  51. ctpbee_api/ctp/include/mac/pybind11/eigen/tensor.h +516 -0
  52. ctpbee_api/ctp/include/mac/pybind11/eigen.h +12 -0
  53. ctpbee_api/ctp/include/mac/pybind11/embed.h +316 -0
  54. ctpbee_api/ctp/include/mac/pybind11/eval.h +156 -0
  55. ctpbee_api/ctp/include/mac/pybind11/functional.h +137 -0
  56. ctpbee_api/ctp/include/mac/pybind11/gil.h +239 -0
  57. ctpbee_api/ctp/include/mac/pybind11/iostream.h +265 -0
  58. ctpbee_api/ctp/include/mac/pybind11/numpy.h +1998 -0
  59. ctpbee_api/ctp/include/mac/pybind11/operators.h +202 -0
  60. ctpbee_api/ctp/include/mac/pybind11/options.h +92 -0
  61. ctpbee_api/ctp/include/mac/pybind11/pybind11.h +2890 -0
  62. ctpbee_api/ctp/include/mac/pybind11/pytypes.h +2557 -0
  63. ctpbee_api/ctp/include/mac/pybind11/stl/filesystem.h +116 -0
  64. ctpbee_api/ctp/include/mac/pybind11/stl.h +447 -0
  65. ctpbee_api/ctp/include/mac/pybind11/stl_bind.h +851 -0
  66. ctpbee_api/ctp/include/mac/pybind11/type_caster_pyobject_ptr.h +61 -0
  67. ctpbee_api/ctp/include/new/ctp/ThostFtdcMdApi.h +168 -0
  68. ctpbee_api/ctp/include/new/ctp/ThostFtdcTraderApi.h +770 -0
  69. ctpbee_api/ctp/include/new/ctp/ThostFtdcUserApiDataType.h +6878 -0
  70. ctpbee_api/ctp/include/new/ctp/ThostFtdcUserApiStruct.h +10915 -0
  71. ctpbee_api/ctp/include/new/pybind11/attr.h +690 -0
  72. ctpbee_api/ctp/include/new/pybind11/buffer_info.h +208 -0
  73. ctpbee_api/ctp/include/new/pybind11/cast.h +1704 -0
  74. ctpbee_api/ctp/include/new/pybind11/chrono.h +225 -0
  75. ctpbee_api/ctp/include/new/pybind11/common.h +2 -0
  76. ctpbee_api/ctp/include/new/pybind11/complex.h +74 -0
  77. ctpbee_api/ctp/include/new/pybind11/detail/class.h +743 -0
  78. ctpbee_api/ctp/include/new/pybind11/detail/common.h +1255 -0
  79. ctpbee_api/ctp/include/new/pybind11/detail/descr.h +171 -0
  80. ctpbee_api/ctp/include/new/pybind11/detail/init.h +434 -0
  81. ctpbee_api/ctp/include/new/pybind11/detail/internals.h +656 -0
  82. ctpbee_api/ctp/include/new/pybind11/detail/type_caster_base.h +1177 -0
  83. ctpbee_api/ctp/include/new/pybind11/detail/typeid.h +65 -0
  84. ctpbee_api/ctp/include/new/pybind11/eigen/common.h +9 -0
  85. ctpbee_api/ctp/include/new/pybind11/eigen/matrix.h +714 -0
  86. ctpbee_api/ctp/include/new/pybind11/eigen/tensor.h +516 -0
  87. ctpbee_api/ctp/include/new/pybind11/eigen.h +12 -0
  88. ctpbee_api/ctp/include/new/pybind11/embed.h +316 -0
  89. ctpbee_api/ctp/include/new/pybind11/eval.h +156 -0
  90. ctpbee_api/ctp/include/new/pybind11/functional.h +137 -0
  91. ctpbee_api/ctp/include/new/pybind11/gil.h +239 -0
  92. ctpbee_api/ctp/include/new/pybind11/iostream.h +265 -0
  93. ctpbee_api/ctp/include/new/pybind11/numpy.h +1998 -0
  94. ctpbee_api/ctp/include/new/pybind11/operators.h +202 -0
  95. ctpbee_api/ctp/include/new/pybind11/options.h +92 -0
  96. ctpbee_api/ctp/include/new/pybind11/pybind11.h +2890 -0
  97. ctpbee_api/ctp/include/new/pybind11/pytypes.h +2557 -0
  98. ctpbee_api/ctp/include/new/pybind11/stl/filesystem.h +116 -0
  99. ctpbee_api/ctp/include/new/pybind11/stl.h +447 -0
  100. ctpbee_api/ctp/include/new/pybind11/stl_bind.h +851 -0
  101. ctpbee_api/ctp/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
  102. ctpbee_api/ctp/include/previous/ctp/ThostFtdcMdApi.h +168 -0
  103. ctpbee_api/ctp/include/previous/ctp/ThostFtdcTraderApi.h +770 -0
  104. ctpbee_api/ctp/include/previous/ctp/ThostFtdcUserApiDataType.h +6878 -0
  105. ctpbee_api/ctp/include/previous/ctp/ThostFtdcUserApiStruct.h +10915 -0
  106. ctpbee_api/ctp/include/previous/pybind11/attr.h +489 -0
  107. ctpbee_api/ctp/include/previous/pybind11/buffer_info.h +108 -0
  108. ctpbee_api/ctp/include/previous/pybind11/cast.h +2067 -0
  109. ctpbee_api/ctp/include/previous/pybind11/chrono.h +162 -0
  110. ctpbee_api/ctp/include/previous/pybind11/common.h +2 -0
  111. ctpbee_api/ctp/include/previous/pybind11/complex.h +61 -0
  112. ctpbee_api/ctp/include/previous/pybind11/detail/class.h +626 -0
  113. ctpbee_api/ctp/include/previous/pybind11/detail/common.h +803 -0
  114. ctpbee_api/ctp/include/previous/pybind11/detail/descr.h +185 -0
  115. ctpbee_api/ctp/include/previous/pybind11/detail/init.h +335 -0
  116. ctpbee_api/ctp/include/previous/pybind11/detail/internals.h +285 -0
  117. ctpbee_api/ctp/include/previous/pybind11/detail/typeid.h +53 -0
  118. ctpbee_api/ctp/include/previous/pybind11/eigen.h +604 -0
  119. ctpbee_api/ctp/include/previous/pybind11/embed.h +194 -0
  120. ctpbee_api/ctp/include/previous/pybind11/eval.h +117 -0
  121. ctpbee_api/ctp/include/previous/pybind11/functional.h +85 -0
  122. ctpbee_api/ctp/include/previous/pybind11/iostream.h +200 -0
  123. ctpbee_api/ctp/include/previous/pybind11/numpy.h +1601 -0
  124. ctpbee_api/ctp/include/previous/pybind11/operators.h +168 -0
  125. ctpbee_api/ctp/include/previous/pybind11/options.h +65 -0
  126. ctpbee_api/ctp/include/previous/pybind11/pybind11.h +1965 -0
  127. ctpbee_api/ctp/include/previous/pybind11/pytypes.h +1332 -0
  128. ctpbee_api/ctp/include/previous/pybind11/stl.h +376 -0
  129. ctpbee_api/ctp/include/previous/pybind11/stl_bind.h +599 -0
  130. ctpbee_api/ctp/libs/libcomunicationkey.a +0 -0
  131. ctpbee_api/ctp/libs/libcrypto.a +0 -0
  132. ctpbee_api/ctp/libs/libssl.a +0 -0
  133. ctpbee_api/ctp/libs/thostmduserapi_se.lib +0 -0
  134. ctpbee_api/ctp/libs/thosttraderapi_se.lib +0 -0
  135. ctpbee_api/ctp/libthostmduserapi_se.so +0 -0
  136. ctpbee_api/ctp/libthosttraderapi_se.so +0 -0
  137. ctpbee_api/ctp/thostmduserapi_se.dll +0 -0
  138. ctpbee_api/ctp/thosttraderapi_se.dll +0 -0
  139. ctpbee_api/ctp/vnctp/vnctp.h +189 -0
  140. ctpbee_api/ctp/vnctp/vnctp.sln +41 -0
  141. ctpbee_api/ctp/vnctp/vnctpmd/dllmain.cpp +19 -0
  142. ctpbee_api/ctp/vnctp/vnctpmd/stdafx.cpp +1 -0
  143. ctpbee_api/ctp/vnctp/vnctpmd/stdafx.h +17 -0
  144. ctpbee_api/ctp/vnctp/vnctpmd/targetver.h +8 -0
  145. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.cpp +953 -0
  146. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.h +209 -0
  147. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj +200 -0
  148. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj.filters +54 -0
  149. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj.user +4 -0
  150. ctpbee_api/ctp/vnctp/vnctptd/dllmain.cpp +19 -0
  151. ctpbee_api/ctp/vnctp/vnctptd/stdafx.cpp +1 -0
  152. ctpbee_api/ctp/vnctp/vnctptd/stdafx.h +16 -0
  153. ctpbee_api/ctp/vnctp/vnctptd/targetver.h +8 -0
  154. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.cpp +12148 -0
  155. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.h +1329 -0
  156. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj +198 -0
  157. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj.filters +54 -0
  158. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj.user +4 -0
  159. ctpbee_api/ctp/vnctpmd.cp310-win_amd64.pyd +0 -0
  160. ctpbee_api/ctp/vnctptd.cp310-win_amd64.pyd +0 -0
  161. ctpbee_api/ctp_mini/__init__.py +3 -0
  162. ctpbee_api/ctp_mini/generator/generate_api_functions.py +343 -0
  163. ctpbee_api/ctp_mini/generator/generate_data_type.py +76 -0
  164. ctpbee_api/ctp_mini/generator/generate_struct.py +85 -0
  165. ctpbee_api/ctp_mini/generator/mini_constant.py +1186 -0
  166. ctpbee_api/ctp_mini/generator/mini_md_header_define.h +13 -0
  167. ctpbee_api/ctp_mini/generator/mini_md_header_function.h +4 -0
  168. ctpbee_api/ctp_mini/generator/mini_md_header_on.h +26 -0
  169. ctpbee_api/ctp_mini/generator/mini_md_header_process.h +26 -0
  170. ctpbee_api/ctp_mini/generator/mini_md_source_function.cpp +29 -0
  171. ctpbee_api/ctp_mini/generator/mini_md_source_module.cpp +17 -0
  172. ctpbee_api/ctp_mini/generator/mini_md_source_on.cpp +156 -0
  173. ctpbee_api/ctp_mini/generator/mini_md_source_process.cpp +264 -0
  174. ctpbee_api/ctp_mini/generator/mini_md_source_switch.cpp +78 -0
  175. ctpbee_api/ctp_mini/generator/mini_md_source_task.cpp +203 -0
  176. ctpbee_api/ctp_mini/generator/mini_struct.py +4599 -0
  177. ctpbee_api/ctp_mini/generator/mini_td_header_define.h +63 -0
  178. ctpbee_api/ctp_mini/generator/mini_td_header_function.h +84 -0
  179. ctpbee_api/ctp_mini/generator/mini_td_header_on.h +126 -0
  180. ctpbee_api/ctp_mini/generator/mini_td_header_process.h +126 -0
  181. ctpbee_api/ctp_mini/generator/mini_td_source_function.cpp +663 -0
  182. ctpbee_api/ctp_mini/generator/mini_td_source_module.cpp +107 -0
  183. ctpbee_api/ctp_mini/generator/mini_td_source_on.cpp +756 -0
  184. ctpbee_api/ctp_mini/generator/mini_td_source_process.cpp +2492 -0
  185. ctpbee_api/ctp_mini/generator/mini_td_source_switch.cpp +378 -0
  186. ctpbee_api/ctp_mini/generator/mini_td_source_task.cpp +1193 -0
  187. ctpbee_api/ctp_mini/generator/mini_typedef.py +755 -0
  188. ctpbee_api/ctp_mini/generator/package/vnminimd.cpp +886 -0
  189. ctpbee_api/ctp_mini/generator/package/vnminimd.h +205 -0
  190. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcMdApi.h +148 -0
  191. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcTraderApi.h +419 -0
  192. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcUserApiDataType.h +6458 -0
  193. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcUserApiStruct.h +8890 -0
  194. ctpbee_api/ctp_mini/include/new/pybind11/attr.h +690 -0
  195. ctpbee_api/ctp_mini/include/new/pybind11/buffer_info.h +208 -0
  196. ctpbee_api/ctp_mini/include/new/pybind11/cast.h +1704 -0
  197. ctpbee_api/ctp_mini/include/new/pybind11/chrono.h +225 -0
  198. ctpbee_api/ctp_mini/include/new/pybind11/common.h +2 -0
  199. ctpbee_api/ctp_mini/include/new/pybind11/complex.h +74 -0
  200. ctpbee_api/ctp_mini/include/new/pybind11/detail/class.h +743 -0
  201. ctpbee_api/ctp_mini/include/new/pybind11/detail/common.h +1255 -0
  202. ctpbee_api/ctp_mini/include/new/pybind11/detail/descr.h +171 -0
  203. ctpbee_api/ctp_mini/include/new/pybind11/detail/init.h +434 -0
  204. ctpbee_api/ctp_mini/include/new/pybind11/detail/internals.h +656 -0
  205. ctpbee_api/ctp_mini/include/new/pybind11/detail/type_caster_base.h +1177 -0
  206. ctpbee_api/ctp_mini/include/new/pybind11/detail/typeid.h +65 -0
  207. ctpbee_api/ctp_mini/include/new/pybind11/eigen/common.h +9 -0
  208. ctpbee_api/ctp_mini/include/new/pybind11/eigen/matrix.h +714 -0
  209. ctpbee_api/ctp_mini/include/new/pybind11/eigen/tensor.h +516 -0
  210. ctpbee_api/ctp_mini/include/new/pybind11/eigen.h +12 -0
  211. ctpbee_api/ctp_mini/include/new/pybind11/embed.h +316 -0
  212. ctpbee_api/ctp_mini/include/new/pybind11/eval.h +156 -0
  213. ctpbee_api/ctp_mini/include/new/pybind11/functional.h +137 -0
  214. ctpbee_api/ctp_mini/include/new/pybind11/gil.h +239 -0
  215. ctpbee_api/ctp_mini/include/new/pybind11/iostream.h +265 -0
  216. ctpbee_api/ctp_mini/include/new/pybind11/numpy.h +1998 -0
  217. ctpbee_api/ctp_mini/include/new/pybind11/operators.h +202 -0
  218. ctpbee_api/ctp_mini/include/new/pybind11/options.h +92 -0
  219. ctpbee_api/ctp_mini/include/new/pybind11/pybind11.h +2890 -0
  220. ctpbee_api/ctp_mini/include/new/pybind11/pytypes.h +2557 -0
  221. ctpbee_api/ctp_mini/include/new/pybind11/stl/filesystem.h +116 -0
  222. ctpbee_api/ctp_mini/include/new/pybind11/stl.h +447 -0
  223. ctpbee_api/ctp_mini/include/new/pybind11/stl_bind.h +851 -0
  224. ctpbee_api/ctp_mini/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
  225. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcMdApi.h +148 -0
  226. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcTraderApi.h +419 -0
  227. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcUserApiDataType.h +6458 -0
  228. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcUserApiStruct.h +8890 -0
  229. ctpbee_api/ctp_mini/include/previous/pybind11/attr.h +489 -0
  230. ctpbee_api/ctp_mini/include/previous/pybind11/buffer_info.h +108 -0
  231. ctpbee_api/ctp_mini/include/previous/pybind11/cast.h +2067 -0
  232. ctpbee_api/ctp_mini/include/previous/pybind11/chrono.h +162 -0
  233. ctpbee_api/ctp_mini/include/previous/pybind11/common.h +2 -0
  234. ctpbee_api/ctp_mini/include/previous/pybind11/complex.h +61 -0
  235. ctpbee_api/ctp_mini/include/previous/pybind11/detail/class.h +626 -0
  236. ctpbee_api/ctp_mini/include/previous/pybind11/detail/common.h +803 -0
  237. ctpbee_api/ctp_mini/include/previous/pybind11/detail/descr.h +185 -0
  238. ctpbee_api/ctp_mini/include/previous/pybind11/detail/init.h +335 -0
  239. ctpbee_api/ctp_mini/include/previous/pybind11/detail/internals.h +285 -0
  240. ctpbee_api/ctp_mini/include/previous/pybind11/detail/typeid.h +53 -0
  241. ctpbee_api/ctp_mini/include/previous/pybind11/eigen.h +604 -0
  242. ctpbee_api/ctp_mini/include/previous/pybind11/embed.h +194 -0
  243. ctpbee_api/ctp_mini/include/previous/pybind11/eval.h +117 -0
  244. ctpbee_api/ctp_mini/include/previous/pybind11/functional.h +85 -0
  245. ctpbee_api/ctp_mini/include/previous/pybind11/iostream.h +200 -0
  246. ctpbee_api/ctp_mini/include/previous/pybind11/numpy.h +1601 -0
  247. ctpbee_api/ctp_mini/include/previous/pybind11/operators.h +168 -0
  248. ctpbee_api/ctp_mini/include/previous/pybind11/options.h +65 -0
  249. ctpbee_api/ctp_mini/include/previous/pybind11/pybind11.h +1965 -0
  250. ctpbee_api/ctp_mini/include/previous/pybind11/pytypes.h +1332 -0
  251. ctpbee_api/ctp_mini/include/previous/pybind11/stl.h +376 -0
  252. ctpbee_api/ctp_mini/include/previous/pybind11/stl_bind.h +599 -0
  253. ctpbee_api/ctp_mini/libs/thostmduserapi.lib +0 -0
  254. ctpbee_api/ctp_mini/libs/thosttraderapi.lib +0 -0
  255. ctpbee_api/ctp_mini/libthostmduserapi.so +0 -0
  256. ctpbee_api/ctp_mini/libthosttraderapi.so +0 -0
  257. ctpbee_api/ctp_mini/mini_constant.py +1186 -0
  258. ctpbee_api/ctp_mini/thostmduserapi.dll +0 -0
  259. ctpbee_api/ctp_mini/thosttraderapi.dll +0 -0
  260. ctpbee_api/ctp_mini/vnctp_mini/vnctp_mini.h +146 -0
  261. ctpbee_api/ctp_mini/vnctp_mini/vnctp_mini.sln +41 -0
  262. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/dllmain.cpp +0 -0
  263. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/stdafx.cpp +0 -0
  264. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/stdafx.h +0 -0
  265. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/targetver.h +0 -0
  266. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.cpp +886 -0
  267. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.h +203 -0
  268. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj +183 -0
  269. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj.filters +54 -0
  270. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj.user +4 -0
  271. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/dllmain.cpp +0 -0
  272. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/stdafx.cpp +0 -0
  273. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/stdafx.h +0 -0
  274. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/targetver.h +0 -0
  275. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.cpp +5716 -0
  276. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.h +680 -0
  277. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj +180 -0
  278. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj.filters +54 -0
  279. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj.user +4 -0
  280. ctpbee_api/ctp_mini/vnctp_minimd.cp310-win_amd64.pyd +0 -0
  281. ctpbee_api/ctp_mini/vnctp_minitd.cp310-win_amd64.pyd +0 -0
  282. ctpbee_api/ctp_mini/vnctp_minitd.lib +0 -0
  283. ctpbee_api/rohon/RohonBaseV64.dll +0 -0
  284. ctpbee_api/rohon/WinDataCollect.dll +0 -0
  285. ctpbee_api/rohon/__init__.py +3 -0
  286. ctpbee_api/rohon/generator/generate_api_functions.py +348 -0
  287. ctpbee_api/rohon/generator/generate_data_type.py +76 -0
  288. ctpbee_api/rohon/generator/generate_struct.py +84 -0
  289. ctpbee_api/rohon/generator/rohon_constant.py +1242 -0
  290. ctpbee_api/rohon/generator/rohon_md_header_define.h +13 -0
  291. ctpbee_api/rohon/generator/rohon_md_header_function.h +6 -0
  292. ctpbee_api/rohon/generator/rohon_md_header_on.h +26 -0
  293. ctpbee_api/rohon/generator/rohon_md_header_process.h +26 -0
  294. ctpbee_api/rohon/generator/rohon_md_source_function.cpp +40 -0
  295. ctpbee_api/rohon/generator/rohon_md_source_module.cpp +18 -0
  296. ctpbee_api/rohon/generator/rohon_md_source_on.cpp +156 -0
  297. ctpbee_api/rohon/generator/rohon_md_source_process.cpp +271 -0
  298. ctpbee_api/rohon/generator/rohon_md_source_switch.cpp +78 -0
  299. ctpbee_api/rohon/generator/rohon_md_source_task.cpp +211 -0
  300. ctpbee_api/rohon/generator/rohon_struct.py +4958 -0
  301. ctpbee_api/rohon/generator/rohon_td_header_define.h +125 -0
  302. ctpbee_api/rohon/generator/rohon_td_header_function.h +164 -0
  303. ctpbee_api/rohon/generator/rohon_td_header_on.h +250 -0
  304. ctpbee_api/rohon/generator/rohon_td_header_process.h +250 -0
  305. ctpbee_api/rohon/generator/rohon_td_source_function.cpp +1338 -0
  306. ctpbee_api/rohon/generator/rohon_td_source_module.cpp +209 -0
  307. ctpbee_api/rohon/generator/rohon_td_source_on.cpp +1500 -0
  308. ctpbee_api/rohon/generator/rohon_td_source_process.cpp +5125 -0
  309. ctpbee_api/rohon/generator/rohon_td_source_switch.cpp +750 -0
  310. ctpbee_api/rohon/generator/rohon_td_source_task.cpp +2339 -0
  311. ctpbee_api/rohon/generator/rohon_typedef.py +781 -0
  312. ctpbee_api/rohon/include/new/pybind11/attr.h +690 -0
  313. ctpbee_api/rohon/include/new/pybind11/buffer_info.h +208 -0
  314. ctpbee_api/rohon/include/new/pybind11/cast.h +1704 -0
  315. ctpbee_api/rohon/include/new/pybind11/chrono.h +225 -0
  316. ctpbee_api/rohon/include/new/pybind11/common.h +2 -0
  317. ctpbee_api/rohon/include/new/pybind11/complex.h +74 -0
  318. ctpbee_api/rohon/include/new/pybind11/detail/class.h +743 -0
  319. ctpbee_api/rohon/include/new/pybind11/detail/common.h +1255 -0
  320. ctpbee_api/rohon/include/new/pybind11/detail/descr.h +171 -0
  321. ctpbee_api/rohon/include/new/pybind11/detail/init.h +434 -0
  322. ctpbee_api/rohon/include/new/pybind11/detail/internals.h +656 -0
  323. ctpbee_api/rohon/include/new/pybind11/detail/type_caster_base.h +1177 -0
  324. ctpbee_api/rohon/include/new/pybind11/detail/typeid.h +65 -0
  325. ctpbee_api/rohon/include/new/pybind11/eigen/common.h +9 -0
  326. ctpbee_api/rohon/include/new/pybind11/eigen/matrix.h +714 -0
  327. ctpbee_api/rohon/include/new/pybind11/eigen/tensor.h +516 -0
  328. ctpbee_api/rohon/include/new/pybind11/eigen.h +12 -0
  329. ctpbee_api/rohon/include/new/pybind11/embed.h +316 -0
  330. ctpbee_api/rohon/include/new/pybind11/eval.h +156 -0
  331. ctpbee_api/rohon/include/new/pybind11/functional.h +137 -0
  332. ctpbee_api/rohon/include/new/pybind11/gil.h +239 -0
  333. ctpbee_api/rohon/include/new/pybind11/iostream.h +265 -0
  334. ctpbee_api/rohon/include/new/pybind11/numpy.h +1998 -0
  335. ctpbee_api/rohon/include/new/pybind11/operators.h +202 -0
  336. ctpbee_api/rohon/include/new/pybind11/options.h +92 -0
  337. ctpbee_api/rohon/include/new/pybind11/pybind11.h +2890 -0
  338. ctpbee_api/rohon/include/new/pybind11/pytypes.h +2557 -0
  339. ctpbee_api/rohon/include/new/pybind11/stl/filesystem.h +116 -0
  340. ctpbee_api/rohon/include/new/pybind11/stl.h +447 -0
  341. ctpbee_api/rohon/include/new/pybind11/stl_bind.h +851 -0
  342. ctpbee_api/rohon/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
  343. ctpbee_api/rohon/include/new/rohon/ThostFtdcMdApi.h +168 -0
  344. ctpbee_api/rohon/include/new/rohon/ThostFtdcTraderApi.h +739 -0
  345. ctpbee_api/rohon/include/new/rohon/ThostFtdcUserApiDataType.h +6708 -0
  346. ctpbee_api/rohon/include/new/rohon/ThostFtdcUserApiStruct.h +9580 -0
  347. ctpbee_api/rohon/include/previous/pybind11/attr.h +489 -0
  348. ctpbee_api/rohon/include/previous/pybind11/buffer_info.h +108 -0
  349. ctpbee_api/rohon/include/previous/pybind11/cast.h +2067 -0
  350. ctpbee_api/rohon/include/previous/pybind11/chrono.h +162 -0
  351. ctpbee_api/rohon/include/previous/pybind11/common.h +2 -0
  352. ctpbee_api/rohon/include/previous/pybind11/complex.h +61 -0
  353. ctpbee_api/rohon/include/previous/pybind11/detail/class.h +626 -0
  354. ctpbee_api/rohon/include/previous/pybind11/detail/common.h +803 -0
  355. ctpbee_api/rohon/include/previous/pybind11/detail/descr.h +185 -0
  356. ctpbee_api/rohon/include/previous/pybind11/detail/init.h +335 -0
  357. ctpbee_api/rohon/include/previous/pybind11/detail/internals.h +285 -0
  358. ctpbee_api/rohon/include/previous/pybind11/detail/typeid.h +53 -0
  359. ctpbee_api/rohon/include/previous/pybind11/eigen.h +604 -0
  360. ctpbee_api/rohon/include/previous/pybind11/embed.h +194 -0
  361. ctpbee_api/rohon/include/previous/pybind11/eval.h +117 -0
  362. ctpbee_api/rohon/include/previous/pybind11/functional.h +85 -0
  363. ctpbee_api/rohon/include/previous/pybind11/iostream.h +200 -0
  364. ctpbee_api/rohon/include/previous/pybind11/numpy.h +1601 -0
  365. ctpbee_api/rohon/include/previous/pybind11/operators.h +168 -0
  366. ctpbee_api/rohon/include/previous/pybind11/options.h +65 -0
  367. ctpbee_api/rohon/include/previous/pybind11/pybind11.h +1965 -0
  368. ctpbee_api/rohon/include/previous/pybind11/pytypes.h +1332 -0
  369. ctpbee_api/rohon/include/previous/pybind11/stl.h +376 -0
  370. ctpbee_api/rohon/include/previous/pybind11/stl_bind.h +599 -0
  371. ctpbee_api/rohon/include/previous/rohon/ThostFtdcMdApi.h +168 -0
  372. ctpbee_api/rohon/include/previous/rohon/ThostFtdcTraderApi.h +739 -0
  373. ctpbee_api/rohon/include/previous/rohon/ThostFtdcUserApiDataType.h +6708 -0
  374. ctpbee_api/rohon/include/previous/rohon/ThostFtdcUserApiStruct.h +9580 -0
  375. ctpbee_api/rohon/libLinuxDataCollect.so +0 -0
  376. ctpbee_api/rohon/librohonbase.so +0 -0
  377. ctpbee_api/rohon/librohonbase.so.1.1 +0 -0
  378. ctpbee_api/rohon/librohonbase.so.1.1.0.1 +0 -0
  379. ctpbee_api/rohon/libs/thostmduserapi_se.lib +0 -0
  380. ctpbee_api/rohon/libs/thosttraderapi_se.lib +0 -0
  381. ctpbee_api/rohon/libthostmduserapi_se.so +0 -0
  382. ctpbee_api/rohon/libthosttraderapi_se.so +0 -0
  383. ctpbee_api/rohon/rohon_constant.py +1242 -0
  384. ctpbee_api/rohon/thostmduserapi_se.dll +0 -0
  385. ctpbee_api/rohon/thosttraderapi_se.dll +0 -0
  386. ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/.suo +0 -0
  387. ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/Browse.VC.db +0 -0
  388. ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/Solution.VC.db +0 -0
  389. ctpbee_api/rohon/vnrohon/vnrohon.h +147 -0
  390. ctpbee_api/rohon/vnrohon/vnrohon.sln +41 -0
  391. ctpbee_api/rohon/vnrohon/vnrohonmd/dllmain.cpp +19 -0
  392. ctpbee_api/rohon/vnrohon/vnrohonmd/framework.h +5 -0
  393. ctpbee_api/rohon/vnrohon/vnrohonmd/pch.cpp +5 -0
  394. ctpbee_api/rohon/vnrohon/vnrohonmd/pch.h +13 -0
  395. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.cpp +931 -0
  396. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.h +207 -0
  397. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj +188 -0
  398. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj.filters +54 -0
  399. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj.user +4 -0
  400. ctpbee_api/rohon/vnrohon/vnrohontd/dllmain.cpp +19 -0
  401. ctpbee_api/rohon/vnrohon/vnrohontd/framework.h +5 -0
  402. ctpbee_api/rohon/vnrohon/vnrohontd/pch.cpp +5 -0
  403. ctpbee_api/rohon/vnrohon/vnrohontd/pch.h +13 -0
  404. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.cpp +11395 -0
  405. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.h +1259 -0
  406. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj +188 -0
  407. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj.filters +54 -0
  408. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj.user +4 -0
  409. ctpbee_api/rohon/vnrohonmd.cp310-win_amd64.pyd +0 -0
  410. ctpbee_api/rohon/vnrohontd.cp310-win_amd64.pyd +0 -0
  411. ctpbee_opt_api-0.1.0.dist-info/METADATA +46 -0
  412. ctpbee_opt_api-0.1.0.dist-info/RECORD +414 -0
  413. ctpbee_opt_api-0.1.0.dist-info/WHEEL +5 -0
  414. ctpbee_opt_api-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,116 @@
1
+ // Copyright (c) 2021 The Pybind Development Team.
2
+ // All rights reserved. Use of this source code is governed by a
3
+ // BSD-style license that can be found in the LICENSE file.
4
+
5
+ #pragma once
6
+
7
+ #include "../pybind11.h"
8
+ #include "../detail/common.h"
9
+ #include "../detail/descr.h"
10
+ #include "../cast.h"
11
+ #include "../pytypes.h"
12
+
13
+ #include <string>
14
+
15
+ #ifdef __has_include
16
+ # if defined(PYBIND11_CPP17)
17
+ # if __has_include(<filesystem>) && \
18
+ PY_VERSION_HEX >= 0x03060000
19
+ # include <filesystem>
20
+ # define PYBIND11_HAS_FILESYSTEM 1
21
+ # elif __has_include(<experimental/filesystem>)
22
+ # include <experimental/filesystem>
23
+ # define PYBIND11_HAS_EXPERIMENTAL_FILESYSTEM 1
24
+ # endif
25
+ # endif
26
+ #endif
27
+
28
+ #if !defined(PYBIND11_HAS_FILESYSTEM) && !defined(PYBIND11_HAS_EXPERIMENTAL_FILESYSTEM) \
29
+ && !defined(PYBIND11_HAS_FILESYSTEM_IS_OPTIONAL)
30
+ # error \
31
+ "Neither #include <filesystem> nor #include <experimental/filesystem is available. (Use -DPYBIND11_HAS_FILESYSTEM_IS_OPTIONAL to ignore.)"
32
+ #endif
33
+
34
+ PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
35
+ PYBIND11_NAMESPACE_BEGIN(detail)
36
+
37
+ #if defined(PYBIND11_HAS_FILESYSTEM) || defined(PYBIND11_HAS_EXPERIMENTAL_FILESYSTEM)
38
+ template <typename T>
39
+ struct path_caster {
40
+
41
+ private:
42
+ static PyObject *unicode_from_fs_native(const std::string &w) {
43
+ # if !defined(PYPY_VERSION)
44
+ return PyUnicode_DecodeFSDefaultAndSize(w.c_str(), ssize_t(w.size()));
45
+ # else
46
+ // PyPy mistakenly declares the first parameter as non-const.
47
+ return PyUnicode_DecodeFSDefaultAndSize(const_cast<char *>(w.c_str()), ssize_t(w.size()));
48
+ # endif
49
+ }
50
+
51
+ static PyObject *unicode_from_fs_native(const std::wstring &w) {
52
+ return PyUnicode_FromWideChar(w.c_str(), ssize_t(w.size()));
53
+ }
54
+
55
+ public:
56
+ static handle cast(const T &path, return_value_policy, handle) {
57
+ if (auto py_str = unicode_from_fs_native(path.native())) {
58
+ return module_::import("pathlib")
59
+ .attr("Path")(reinterpret_steal<object>(py_str))
60
+ .release();
61
+ }
62
+ return nullptr;
63
+ }
64
+
65
+ bool load(handle handle, bool) {
66
+ // PyUnicode_FSConverter and PyUnicode_FSDecoder normally take care of
67
+ // calling PyOS_FSPath themselves, but that's broken on PyPy (PyPy
68
+ // issue #3168) so we do it ourselves instead.
69
+ PyObject *buf = PyOS_FSPath(handle.ptr());
70
+ if (!buf) {
71
+ PyErr_Clear();
72
+ return false;
73
+ }
74
+ PyObject *native = nullptr;
75
+ if constexpr (std::is_same_v<typename T::value_type, char>) {
76
+ if (PyUnicode_FSConverter(buf, &native) != 0) {
77
+ if (auto *c_str = PyBytes_AsString(native)) {
78
+ // AsString returns a pointer to the internal buffer, which
79
+ // must not be free'd.
80
+ value = c_str;
81
+ }
82
+ }
83
+ } else if constexpr (std::is_same_v<typename T::value_type, wchar_t>) {
84
+ if (PyUnicode_FSDecoder(buf, &native) != 0) {
85
+ if (auto *c_str = PyUnicode_AsWideCharString(native, nullptr)) {
86
+ // AsWideCharString returns a new string that must be free'd.
87
+ value = c_str; // Copies the string.
88
+ PyMem_Free(c_str);
89
+ }
90
+ }
91
+ }
92
+ Py_XDECREF(native);
93
+ Py_DECREF(buf);
94
+ if (PyErr_Occurred()) {
95
+ PyErr_Clear();
96
+ return false;
97
+ }
98
+ return true;
99
+ }
100
+
101
+ PYBIND11_TYPE_CASTER(T, const_name("os.PathLike"));
102
+ };
103
+
104
+ #endif // PYBIND11_HAS_FILESYSTEM || defined(PYBIND11_HAS_EXPERIMENTAL_FILESYSTEM)
105
+
106
+ #if defined(PYBIND11_HAS_FILESYSTEM)
107
+ template <>
108
+ struct type_caster<std::filesystem::path> : public path_caster<std::filesystem::path> {};
109
+ #elif defined(PYBIND11_HAS_EXPERIMENTAL_FILESYSTEM)
110
+ template <>
111
+ struct type_caster<std::experimental::filesystem::path>
112
+ : public path_caster<std::experimental::filesystem::path> {};
113
+ #endif
114
+
115
+ PYBIND11_NAMESPACE_END(detail)
116
+ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
@@ -0,0 +1,447 @@
1
+ /*
2
+ pybind11/stl.h: Transparent conversion for STL data types
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
+ #pragma once
11
+
12
+ #include "pybind11.h"
13
+ #include "detail/common.h"
14
+
15
+ #include <deque>
16
+ #include <list>
17
+ #include <map>
18
+ #include <ostream>
19
+ #include <set>
20
+ #include <unordered_map>
21
+ #include <unordered_set>
22
+ #include <valarray>
23
+
24
+ // See `detail/common.h` for implementation of these guards.
25
+ #if defined(PYBIND11_HAS_OPTIONAL)
26
+ # include <optional>
27
+ #elif defined(PYBIND11_HAS_EXP_OPTIONAL)
28
+ # include <experimental/optional>
29
+ #endif
30
+
31
+ #if defined(PYBIND11_HAS_VARIANT)
32
+ # include <variant>
33
+ #endif
34
+
35
+ PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
36
+ PYBIND11_NAMESPACE_BEGIN(detail)
37
+
38
+ /// Extracts an const lvalue reference or rvalue reference for U based on the type of T (e.g. for
39
+ /// forwarding a container element). Typically used indirect via forwarded_type(), below.
40
+ template <typename T, typename U>
41
+ using forwarded_type = conditional_t<std::is_lvalue_reference<T>::value,
42
+ remove_reference_t<U> &,
43
+ remove_reference_t<U> &&>;
44
+
45
+ /// Forwards a value U as rvalue or lvalue according to whether T is rvalue or lvalue; typically
46
+ /// used for forwarding a container's elements.
47
+ template <typename T, typename U>
48
+ constexpr forwarded_type<T, U> forward_like(U &&u) {
49
+ return std::forward<detail::forwarded_type<T, U>>(std::forward<U>(u));
50
+ }
51
+
52
+ // Checks if a container has a STL style reserve method.
53
+ // This will only return true for a `reserve()` with a `void` return.
54
+ template <typename C>
55
+ using has_reserve_method = std::is_same<decltype(std::declval<C>().reserve(0)), void>;
56
+
57
+ template <typename Type, typename Key>
58
+ struct set_caster {
59
+ using type = Type;
60
+ using key_conv = make_caster<Key>;
61
+
62
+ private:
63
+ template <typename T = Type, enable_if_t<has_reserve_method<T>::value, int> = 0>
64
+ void reserve_maybe(const anyset &s, Type *) {
65
+ value.reserve(s.size());
66
+ }
67
+ void reserve_maybe(const anyset &, void *) {}
68
+
69
+ public:
70
+ bool load(handle src, bool convert) {
71
+ if (!isinstance<anyset>(src)) {
72
+ return false;
73
+ }
74
+ auto s = reinterpret_borrow<anyset>(src);
75
+ value.clear();
76
+ reserve_maybe(s, &value);
77
+ for (auto entry : s) {
78
+ key_conv conv;
79
+ if (!conv.load(entry, convert)) {
80
+ return false;
81
+ }
82
+ value.insert(cast_op<Key &&>(std::move(conv)));
83
+ }
84
+ return true;
85
+ }
86
+
87
+ template <typename T>
88
+ static handle cast(T &&src, return_value_policy policy, handle parent) {
89
+ if (!std::is_lvalue_reference<T>::value) {
90
+ policy = return_value_policy_override<Key>::policy(policy);
91
+ }
92
+ pybind11::set s;
93
+ for (auto &&value : src) {
94
+ auto value_ = reinterpret_steal<object>(
95
+ key_conv::cast(detail::forward_like<T>(value), policy, parent));
96
+ if (!value_ || !s.add(std::move(value_))) {
97
+ return handle();
98
+ }
99
+ }
100
+ return s.release();
101
+ }
102
+
103
+ PYBIND11_TYPE_CASTER(type, const_name("Set[") + key_conv::name + const_name("]"));
104
+ };
105
+
106
+ template <typename Type, typename Key, typename Value>
107
+ struct map_caster {
108
+ using key_conv = make_caster<Key>;
109
+ using value_conv = make_caster<Value>;
110
+
111
+ private:
112
+ template <typename T = Type, enable_if_t<has_reserve_method<T>::value, int> = 0>
113
+ void reserve_maybe(const dict &d, Type *) {
114
+ value.reserve(d.size());
115
+ }
116
+ void reserve_maybe(const dict &, void *) {}
117
+
118
+ public:
119
+ bool load(handle src, bool convert) {
120
+ if (!isinstance<dict>(src)) {
121
+ return false;
122
+ }
123
+ auto d = reinterpret_borrow<dict>(src);
124
+ value.clear();
125
+ reserve_maybe(d, &value);
126
+ for (auto it : d) {
127
+ key_conv kconv;
128
+ value_conv vconv;
129
+ if (!kconv.load(it.first.ptr(), convert) || !vconv.load(it.second.ptr(), convert)) {
130
+ return false;
131
+ }
132
+ value.emplace(cast_op<Key &&>(std::move(kconv)), cast_op<Value &&>(std::move(vconv)));
133
+ }
134
+ return true;
135
+ }
136
+
137
+ template <typename T>
138
+ static handle cast(T &&src, return_value_policy policy, handle parent) {
139
+ dict d;
140
+ return_value_policy policy_key = policy;
141
+ return_value_policy policy_value = policy;
142
+ if (!std::is_lvalue_reference<T>::value) {
143
+ policy_key = return_value_policy_override<Key>::policy(policy_key);
144
+ policy_value = return_value_policy_override<Value>::policy(policy_value);
145
+ }
146
+ for (auto &&kv : src) {
147
+ auto key = reinterpret_steal<object>(
148
+ key_conv::cast(detail::forward_like<T>(kv.first), policy_key, parent));
149
+ auto value = reinterpret_steal<object>(
150
+ value_conv::cast(detail::forward_like<T>(kv.second), policy_value, parent));
151
+ if (!key || !value) {
152
+ return handle();
153
+ }
154
+ d[std::move(key)] = std::move(value);
155
+ }
156
+ return d.release();
157
+ }
158
+
159
+ PYBIND11_TYPE_CASTER(Type,
160
+ const_name("Dict[") + key_conv::name + const_name(", ") + value_conv::name
161
+ + const_name("]"));
162
+ };
163
+
164
+ template <typename Type, typename Value>
165
+ struct list_caster {
166
+ using value_conv = make_caster<Value>;
167
+
168
+ bool load(handle src, bool convert) {
169
+ if (!isinstance<sequence>(src) || isinstance<bytes>(src) || isinstance<str>(src)) {
170
+ return false;
171
+ }
172
+ auto s = reinterpret_borrow<sequence>(src);
173
+ value.clear();
174
+ reserve_maybe(s, &value);
175
+ for (auto it : s) {
176
+ value_conv conv;
177
+ if (!conv.load(it, convert)) {
178
+ return false;
179
+ }
180
+ value.push_back(cast_op<Value &&>(std::move(conv)));
181
+ }
182
+ return true;
183
+ }
184
+
185
+ private:
186
+ template <typename T = Type, enable_if_t<has_reserve_method<T>::value, int> = 0>
187
+ void reserve_maybe(const sequence &s, Type *) {
188
+ value.reserve(s.size());
189
+ }
190
+ void reserve_maybe(const sequence &, void *) {}
191
+
192
+ public:
193
+ template <typename T>
194
+ static handle cast(T &&src, return_value_policy policy, handle parent) {
195
+ if (!std::is_lvalue_reference<T>::value) {
196
+ policy = return_value_policy_override<Value>::policy(policy);
197
+ }
198
+ list l(src.size());
199
+ ssize_t index = 0;
200
+ for (auto &&value : src) {
201
+ auto value_ = reinterpret_steal<object>(
202
+ value_conv::cast(detail::forward_like<T>(value), policy, parent));
203
+ if (!value_) {
204
+ return handle();
205
+ }
206
+ PyList_SET_ITEM(l.ptr(), index++, value_.release().ptr()); // steals a reference
207
+ }
208
+ return l.release();
209
+ }
210
+
211
+ PYBIND11_TYPE_CASTER(Type, const_name("List[") + value_conv::name + const_name("]"));
212
+ };
213
+
214
+ template <typename Type, typename Alloc>
215
+ struct type_caster<std::vector<Type, Alloc>> : list_caster<std::vector<Type, Alloc>, Type> {};
216
+
217
+ template <typename Type, typename Alloc>
218
+ struct type_caster<std::deque<Type, Alloc>> : list_caster<std::deque<Type, Alloc>, Type> {};
219
+
220
+ template <typename Type, typename Alloc>
221
+ struct type_caster<std::list<Type, Alloc>> : list_caster<std::list<Type, Alloc>, Type> {};
222
+
223
+ template <typename ArrayType, typename Value, bool Resizable, size_t Size = 0>
224
+ struct array_caster {
225
+ using value_conv = make_caster<Value>;
226
+
227
+ private:
228
+ template <bool R = Resizable>
229
+ bool require_size(enable_if_t<R, size_t> size) {
230
+ if (value.size() != size) {
231
+ value.resize(size);
232
+ }
233
+ return true;
234
+ }
235
+ template <bool R = Resizable>
236
+ bool require_size(enable_if_t<!R, size_t> size) {
237
+ return size == Size;
238
+ }
239
+
240
+ public:
241
+ bool load(handle src, bool convert) {
242
+ if (!isinstance<sequence>(src)) {
243
+ return false;
244
+ }
245
+ auto l = reinterpret_borrow<sequence>(src);
246
+ if (!require_size(l.size())) {
247
+ return false;
248
+ }
249
+ size_t ctr = 0;
250
+ for (auto it : l) {
251
+ value_conv conv;
252
+ if (!conv.load(it, convert)) {
253
+ return false;
254
+ }
255
+ value[ctr++] = cast_op<Value &&>(std::move(conv));
256
+ }
257
+ return true;
258
+ }
259
+
260
+ template <typename T>
261
+ static handle cast(T &&src, return_value_policy policy, handle parent) {
262
+ list l(src.size());
263
+ ssize_t index = 0;
264
+ for (auto &&value : src) {
265
+ auto value_ = reinterpret_steal<object>(
266
+ value_conv::cast(detail::forward_like<T>(value), policy, parent));
267
+ if (!value_) {
268
+ return handle();
269
+ }
270
+ PyList_SET_ITEM(l.ptr(), index++, value_.release().ptr()); // steals a reference
271
+ }
272
+ return l.release();
273
+ }
274
+
275
+ PYBIND11_TYPE_CASTER(ArrayType,
276
+ const_name<Resizable>(const_name(""), const_name("Annotated["))
277
+ + const_name("List[") + value_conv::name + const_name("]")
278
+ + const_name<Resizable>(const_name(""),
279
+ const_name(", FixedSize(")
280
+ + const_name<Size>() + const_name(")]")));
281
+ };
282
+
283
+ template <typename Type, size_t Size>
284
+ struct type_caster<std::array<Type, Size>>
285
+ : array_caster<std::array<Type, Size>, Type, false, Size> {};
286
+
287
+ template <typename Type>
288
+ struct type_caster<std::valarray<Type>> : array_caster<std::valarray<Type>, Type, true> {};
289
+
290
+ template <typename Key, typename Compare, typename Alloc>
291
+ struct type_caster<std::set<Key, Compare, Alloc>>
292
+ : set_caster<std::set<Key, Compare, Alloc>, Key> {};
293
+
294
+ template <typename Key, typename Hash, typename Equal, typename Alloc>
295
+ struct type_caster<std::unordered_set<Key, Hash, Equal, Alloc>>
296
+ : set_caster<std::unordered_set<Key, Hash, Equal, Alloc>, Key> {};
297
+
298
+ template <typename Key, typename Value, typename Compare, typename Alloc>
299
+ struct type_caster<std::map<Key, Value, Compare, Alloc>>
300
+ : map_caster<std::map<Key, Value, Compare, Alloc>, Key, Value> {};
301
+
302
+ template <typename Key, typename Value, typename Hash, typename Equal, typename Alloc>
303
+ struct type_caster<std::unordered_map<Key, Value, Hash, Equal, Alloc>>
304
+ : map_caster<std::unordered_map<Key, Value, Hash, Equal, Alloc>, Key, Value> {};
305
+
306
+ // This type caster is intended to be used for std::optional and std::experimental::optional
307
+ template <typename Type, typename Value = typename Type::value_type>
308
+ struct optional_caster {
309
+ using value_conv = make_caster<Value>;
310
+
311
+ template <typename T>
312
+ static handle cast(T &&src, return_value_policy policy, handle parent) {
313
+ if (!src) {
314
+ return none().release();
315
+ }
316
+ if (!std::is_lvalue_reference<T>::value) {
317
+ policy = return_value_policy_override<Value>::policy(policy);
318
+ }
319
+ // NOLINTNEXTLINE(bugprone-unchecked-optional-access)
320
+ return value_conv::cast(*std::forward<T>(src), policy, parent);
321
+ }
322
+
323
+ bool load(handle src, bool convert) {
324
+ if (!src) {
325
+ return false;
326
+ }
327
+ if (src.is_none()) {
328
+ return true; // default-constructed value is already empty
329
+ }
330
+ value_conv inner_caster;
331
+ if (!inner_caster.load(src, convert)) {
332
+ return false;
333
+ }
334
+
335
+ value.emplace(cast_op<Value &&>(std::move(inner_caster)));
336
+ return true;
337
+ }
338
+
339
+ PYBIND11_TYPE_CASTER(Type, const_name("Optional[") + value_conv::name + const_name("]"));
340
+ };
341
+
342
+ #if defined(PYBIND11_HAS_OPTIONAL)
343
+ template <typename T>
344
+ struct type_caster<std::optional<T>> : public optional_caster<std::optional<T>> {};
345
+
346
+ template <>
347
+ struct type_caster<std::nullopt_t> : public void_caster<std::nullopt_t> {};
348
+ #endif
349
+
350
+ #if defined(PYBIND11_HAS_EXP_OPTIONAL)
351
+ template <typename T>
352
+ struct type_caster<std::experimental::optional<T>>
353
+ : public optional_caster<std::experimental::optional<T>> {};
354
+
355
+ template <>
356
+ struct type_caster<std::experimental::nullopt_t>
357
+ : public void_caster<std::experimental::nullopt_t> {};
358
+ #endif
359
+
360
+ /// Visit a variant and cast any found type to Python
361
+ struct variant_caster_visitor {
362
+ return_value_policy policy;
363
+ handle parent;
364
+
365
+ using result_type = handle; // required by boost::variant in C++11
366
+
367
+ template <typename T>
368
+ result_type operator()(T &&src) const {
369
+ return make_caster<T>::cast(std::forward<T>(src), policy, parent);
370
+ }
371
+ };
372
+
373
+ /// Helper class which abstracts away variant's `visit` function. `std::variant` and similar
374
+ /// `namespace::variant` types which provide a `namespace::visit()` function are handled here
375
+ /// automatically using argument-dependent lookup. Users can provide specializations for other
376
+ /// variant-like classes, e.g. `boost::variant` and `boost::apply_visitor`.
377
+ template <template <typename...> class Variant>
378
+ struct visit_helper {
379
+ template <typename... Args>
380
+ static auto call(Args &&...args) -> decltype(visit(std::forward<Args>(args)...)) {
381
+ return visit(std::forward<Args>(args)...);
382
+ }
383
+ };
384
+
385
+ /// Generic variant caster
386
+ template <typename Variant>
387
+ struct variant_caster;
388
+
389
+ template <template <typename...> class V, typename... Ts>
390
+ struct variant_caster<V<Ts...>> {
391
+ static_assert(sizeof...(Ts) > 0, "Variant must consist of at least one alternative.");
392
+
393
+ template <typename U, typename... Us>
394
+ bool load_alternative(handle src, bool convert, type_list<U, Us...>) {
395
+ auto caster = make_caster<U>();
396
+ if (caster.load(src, convert)) {
397
+ value = cast_op<U>(std::move(caster));
398
+ return true;
399
+ }
400
+ return load_alternative(src, convert, type_list<Us...>{});
401
+ }
402
+
403
+ bool load_alternative(handle, bool, type_list<>) { return false; }
404
+
405
+ bool load(handle src, bool convert) {
406
+ // Do a first pass without conversions to improve constructor resolution.
407
+ // E.g. `py::int_(1).cast<variant<double, int>>()` needs to fill the `int`
408
+ // slot of the variant. Without two-pass loading `double` would be filled
409
+ // because it appears first and a conversion is possible.
410
+ if (convert && load_alternative(src, false, type_list<Ts...>{})) {
411
+ return true;
412
+ }
413
+ return load_alternative(src, convert, type_list<Ts...>{});
414
+ }
415
+
416
+ template <typename Variant>
417
+ static handle cast(Variant &&src, return_value_policy policy, handle parent) {
418
+ return visit_helper<V>::call(variant_caster_visitor{policy, parent},
419
+ std::forward<Variant>(src));
420
+ }
421
+
422
+ using Type = V<Ts...>;
423
+ PYBIND11_TYPE_CASTER(Type,
424
+ const_name("Union[") + detail::concat(make_caster<Ts>::name...)
425
+ + const_name("]"));
426
+ };
427
+
428
+ #if defined(PYBIND11_HAS_VARIANT)
429
+ template <typename... Ts>
430
+ struct type_caster<std::variant<Ts...>> : variant_caster<std::variant<Ts...>> {};
431
+
432
+ template <>
433
+ struct type_caster<std::monostate> : public void_caster<std::monostate> {};
434
+ #endif
435
+
436
+ PYBIND11_NAMESPACE_END(detail)
437
+
438
+ inline std::ostream &operator<<(std::ostream &os, const handle &obj) {
439
+ #ifdef PYBIND11_HAS_STRING_VIEW
440
+ os << str(obj).cast<std::string_view>();
441
+ #else
442
+ os << (std::string) str(obj);
443
+ #endif
444
+ return os;
445
+ }
446
+
447
+ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)