tpy-lang 0.3.0.dev0__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.
Files changed (333) hide show
  1. tpy_lang-0.3.0.dev0.dist-info/METADATA +151 -0
  2. tpy_lang-0.3.0.dev0.dist-info/RECORD +333 -0
  3. tpy_lang-0.3.0.dev0.dist-info/WHEEL +4 -0
  4. tpy_lang-0.3.0.dev0.dist-info/entry_points.txt +3 -0
  5. tpyc/__init__.py +104 -0
  6. tpyc/__main__.py +6 -0
  7. tpyc/_buildinfo.py +1 -0
  8. tpyc/_data/docs/LANGUAGE_FEATURES.md +6278 -0
  9. tpyc/_data/docs/STDLIB_ROADMAP.md +1258 -0
  10. tpyc/_data/docs/TPY_FOR_AGENTS.md +556 -0
  11. tpyc/_data/lib/tpy/_bindings/__init__.py +6 -0
  12. tpyc/_data/lib/tpy/_bindings/pcre2.py +173 -0
  13. tpyc/_data/lib/tpy/_bindings/posix_socket.py +161 -0
  14. tpyc/_data/lib/tpy/_functools_macros.py +80 -0
  15. tpyc/_data/lib/tpy/_macro_helpers.py +161 -0
  16. tpyc/_data/lib/tpy/argparse.py +2062 -0
  17. tpyc/_data/lib/tpy/asyncio/__init__.py +744 -0
  18. tpyc/_data/lib/tpy/asyncio/_executor.py +515 -0
  19. tpyc/_data/lib/tpy/base64.py +410 -0
  20. tpyc/_data/lib/tpy/bisect.py +39 -0
  21. tpyc/_data/lib/tpy/builtins.py +38 -0
  22. tpyc/_data/lib/tpy/dataclasses.py +354 -0
  23. tpyc/_data/lib/tpy/enum.py +23 -0
  24. tpyc/_data/lib/tpy/functools.py +33 -0
  25. tpyc/_data/lib/tpy/hashlib.py +206 -0
  26. tpyc/_data/lib/tpy/heapq.py +118 -0
  27. tpyc/_data/lib/tpy/io.py +395 -0
  28. tpyc/_data/lib/tpy/json.py +221 -0
  29. tpyc/_data/lib/tpy/math.py +406 -0
  30. tpyc/_data/lib/tpy/random.py +597 -0
  31. tpyc/_data/lib/tpy/re.py +467 -0
  32. tpyc/_data/lib/tpy/socket.py +379 -0
  33. tpyc/_data/lib/tpy/struct.py +178 -0
  34. tpyc/_data/lib/tpy/sys.py +40 -0
  35. tpyc/_data/lib/tpy/time.py +39 -0
  36. tpyc/_data/lib/tpy/tpy/__init__.py +78 -0
  37. tpyc/_data/lib/tpy/tpy/_bootstrap/__init__.py +10 -0
  38. tpyc/_data/lib/tpy/tpy/_bootstrap/_decorators.py +37 -0
  39. tpyc/_data/lib/tpy/tpy/_bootstrap/_extern.py +64 -0
  40. tpyc/_data/lib/tpy/tpy/_builtins/__init__.py +11 -0
  41. tpyc/_data/lib/tpy/tpy/_builtins/_bytes.py +378 -0
  42. tpyc/_data/lib/tpy/tpy/_builtins/_dict.py +151 -0
  43. tpyc/_data/lib/tpy/tpy/_builtins/_exceptions.py +125 -0
  44. tpyc/_data/lib/tpy/tpy/_builtins/_funcs.py +681 -0
  45. tpyc/_data/lib/tpy/tpy/_builtins/_io.py +97 -0
  46. tpyc/_data/lib/tpy/tpy/_builtins/_list.py +127 -0
  47. tpyc/_data/lib/tpy/tpy/_builtins/_range.py +52 -0
  48. tpyc/_data/lib/tpy/tpy/_builtins/_set.py +139 -0
  49. tpyc/_data/lib/tpy/tpy/_builtins/_super.py +11 -0
  50. tpyc/_data/lib/tpy/tpy/_builtins/_types.py +661 -0
  51. tpyc/_data/lib/tpy/tpy/_core/__init__.py +23 -0
  52. tpyc/_data/lib/tpy/tpy/_core/_bytes_view.py +129 -0
  53. tpyc/_data/lib/tpy/tpy/_core/_containers.py +137 -0
  54. tpyc/_data/lib/tpy/tpy/_core/_functions.py +40 -0
  55. tpyc/_data/lib/tpy/tpy/_core/_types.py +2061 -0
  56. tpyc/_data/lib/tpy/tpy/_typing/__init__.py +77 -0
  57. tpyc/_data/lib/tpy/tpy/_version.py +29 -0
  58. tpyc/_data/lib/tpy/tpy/bits.py +28 -0
  59. tpyc/_data/lib/tpy/tpy/coro/__init__.py +127 -0
  60. tpyc/_data/lib/tpy/tpy/extern.py +8 -0
  61. tpyc/_data/lib/tpy/tpy/mem.py +49 -0
  62. tpyc/_data/lib/tpy/tpy/unsafe.py +195 -0
  63. tpyc/_data/lib/tpy/tpy/version.py +21 -0
  64. tpyc/_data/lib/tpy/typing.py +13 -0
  65. tpyc/_data/runtime/cpp/include/tpy/any.hpp +461 -0
  66. tpyc/_data/runtime/cpp/include/tpy/as_ostream.hpp +117 -0
  67. tpyc/_data/runtime/cpp/include/tpy/async.hpp +76 -0
  68. tpyc/_data/runtime/cpp/include/tpy/bigint.hpp +1343 -0
  69. tpyc/_data/runtime/cpp/include/tpy/builtins.hpp +400 -0
  70. tpyc/_data/runtime/cpp/include/tpy/bytes_ops.hpp +469 -0
  71. tpyc/_data/runtime/cpp/include/tpy/container_ops.hpp +487 -0
  72. tpyc/_data/runtime/cpp/include/tpy/copy_iter.hpp +82 -0
  73. tpyc/_data/runtime/cpp/include/tpy/core.hpp +558 -0
  74. tpyc/_data/runtime/cpp/include/tpy/dict_ops.hpp +289 -0
  75. tpyc/_data/runtime/cpp/include/tpy/dunder.hpp +750 -0
  76. tpyc/_data/runtime/cpp/include/tpy/dynamic.hpp +44 -0
  77. tpyc/_data/runtime/cpp/include/tpy/enum.hpp +40 -0
  78. tpyc/_data/runtime/cpp/include/tpy/file.hpp +245 -0
  79. tpyc/_data/runtime/cpp/include/tpy/fixed_int.hpp +317 -0
  80. tpyc/_data/runtime/cpp/include/tpy/format.hpp +954 -0
  81. tpyc/_data/runtime/cpp/include/tpy/frame_slot.hpp +120 -0
  82. tpyc/_data/runtime/cpp/include/tpy/generator.hpp +47 -0
  83. tpyc/_data/runtime/cpp/include/tpy/iterable_ops.hpp +122 -0
  84. tpyc/_data/runtime/cpp/include/tpy/itertools.hpp +749 -0
  85. tpyc/_data/runtime/cpp/include/tpy/next_iter.hpp +82 -0
  86. tpyc/_data/runtime/cpp/include/tpy/ordered_map.hpp +518 -0
  87. tpyc/_data/runtime/cpp/include/tpy/ordered_set.hpp +337 -0
  88. tpyc/_data/runtime/cpp/include/tpy/own_iter.hpp +54 -0
  89. tpyc/_data/runtime/cpp/include/tpy/pascal_graph_sdl.hpp +192 -0
  90. tpyc/_data/runtime/cpp/include/tpy/printing.hpp +302 -0
  91. tpyc/_data/runtime/cpp/include/tpy/protocols.hpp +61 -0
  92. tpyc/_data/runtime/cpp/include/tpy/range.hpp +115 -0
  93. tpyc/_data/runtime/cpp/include/tpy/ranges.hpp +212 -0
  94. tpyc/_data/runtime/cpp/include/tpy/set_ops.hpp +265 -0
  95. tpyc/_data/runtime/cpp/include/tpy/slice.hpp +47 -0
  96. tpyc/_data/runtime/cpp/include/tpy/span_iter.hpp +42 -0
  97. tpyc/_data/runtime/cpp/include/tpy/stdlib/math.hpp +41 -0
  98. tpyc/_data/runtime/cpp/include/tpy/stdlib/pcre2_h.hpp +96 -0
  99. tpyc/_data/runtime/cpp/include/tpy/stdlib/random.hpp +25 -0
  100. tpyc/_data/runtime/cpp/include/tpy/stdlib/socket_h.hpp +145 -0
  101. tpyc/_data/runtime/cpp/include/tpy/stdlib/time.hpp +62 -0
  102. tpyc/_data/runtime/cpp/include/tpy/system.hpp +121 -0
  103. tpyc/_data/runtime/cpp/include/tpy/throwable.hpp +55 -0
  104. tpyc/_data/runtime/cpp/include/tpy/tpy.hpp +156 -0
  105. tpyc/_data/runtime/cpp/include/tpy/type_name.hpp +77 -0
  106. tpyc/_data/runtime/cpp/include/tpy/type_traits.hpp +240 -0
  107. tpyc/_data/runtime/cpp/include/tpy/uninit_array_storage.hpp +250 -0
  108. tpyc/_data/runtime/cpp/include/tpy/uninit_heap_storage.hpp +277 -0
  109. tpyc/_data/runtime/cpp/include/tpy/varargs.hpp +174 -0
  110. tpyc/_data/runtime/cpp/include/tpy/variant_ref.hpp +118 -0
  111. tpyc/_data/runtime/cpp/src/stdlib/socket_impl.cpp +104 -0
  112. tpyc/_data/runtime/cpp/third_party/README.md +58 -0
  113. tpyc/_data/runtime/cpp/third_party/pcre2/AUTHORS +36 -0
  114. tpyc/_data/runtime/cpp/third_party/pcre2/CMakeLists.txt +1233 -0
  115. tpyc/_data/runtime/cpp/third_party/pcre2/COPYING +5 -0
  116. tpyc/_data/runtime/cpp/third_party/pcre2/ChangeLog +3097 -0
  117. tpyc/_data/runtime/cpp/third_party/pcre2/HACKING +853 -0
  118. tpyc/_data/runtime/cpp/third_party/pcre2/INSTALL +368 -0
  119. tpyc/_data/runtime/cpp/third_party/pcre2/LICENCE +94 -0
  120. tpyc/_data/runtime/cpp/third_party/pcre2/NEWS +492 -0
  121. tpyc/_data/runtime/cpp/third_party/pcre2/NON-AUTOTOOLS-BUILD +430 -0
  122. tpyc/_data/runtime/cpp/third_party/pcre2/README +956 -0
  123. tpyc/_data/runtime/cpp/third_party/pcre2/cmake/COPYING-CMAKE-SCRIPTS +22 -0
  124. tpyc/_data/runtime/cpp/third_party/pcre2/cmake/FindEditline.cmake +16 -0
  125. tpyc/_data/runtime/cpp/third_party/pcre2/cmake/FindPackageHandleStandardArgs.cmake +58 -0
  126. tpyc/_data/runtime/cpp/third_party/pcre2/cmake/FindReadline.cmake +29 -0
  127. tpyc/_data/runtime/cpp/third_party/pcre2/cmake/pcre2-config-version.cmake.in +15 -0
  128. tpyc/_data/runtime/cpp/third_party/pcre2/cmake/pcre2-config.cmake.in +148 -0
  129. tpyc/_data/runtime/cpp/third_party/pcre2/config-cmake.h.in +56 -0
  130. tpyc/_data/runtime/cpp/third_party/pcre2/libpcre2-16.pc.in +13 -0
  131. tpyc/_data/runtime/cpp/third_party/pcre2/libpcre2-32.pc.in +13 -0
  132. tpyc/_data/runtime/cpp/third_party/pcre2/libpcre2-8.pc.in +13 -0
  133. tpyc/_data/runtime/cpp/third_party/pcre2/libpcre2-posix.pc.in +13 -0
  134. tpyc/_data/runtime/cpp/third_party/pcre2/pcre2-config.in +121 -0
  135. tpyc/_data/runtime/cpp/third_party/pcre2/src/config.h +483 -0
  136. tpyc/_data/runtime/cpp/third_party/pcre2/src/config.h.generic +483 -0
  137. tpyc/_data/runtime/cpp/third_party/pcre2/src/config.h.in +460 -0
  138. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2.h +1010 -0
  139. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2.h.generic +1010 -0
  140. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2.h.in +1010 -0
  141. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_auto_possess.c +1371 -0
  142. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_chartables.c +196 -0
  143. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_chartables.c.dist +196 -0
  144. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_chkdint.c +96 -0
  145. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_compile.c +11001 -0
  146. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_config.c +252 -0
  147. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_context.c +510 -0
  148. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_convert.c +1189 -0
  149. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_dfa_match.c +4119 -0
  150. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_dftables.c +297 -0
  151. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_error.c +345 -0
  152. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_extuni.c +162 -0
  153. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_find_bracket.c +219 -0
  154. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_fuzzsupport.c +792 -0
  155. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_internal.h +2084 -0
  156. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_intmodedep.h +940 -0
  157. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_jit_compile.c +14972 -0
  158. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_jit_match.c +200 -0
  159. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_jit_misc.c +234 -0
  160. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_jit_neon_inc.h +354 -0
  161. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_jit_simd_inc.h +2355 -0
  162. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_jit_test.c +2528 -0
  163. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_maketables.c +165 -0
  164. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_match.c +7777 -0
  165. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_match_data.c +185 -0
  166. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_newline.c +243 -0
  167. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_ord2utf.c +120 -0
  168. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_pattern_info.c +432 -0
  169. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_printint.c +886 -0
  170. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_script_run.c +344 -0
  171. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_serialize.c +286 -0
  172. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_string_utils.c +237 -0
  173. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_study.c +1915 -0
  174. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_substitute.c +1009 -0
  175. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_substring.c +550 -0
  176. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_tables.c +234 -0
  177. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_ucd.c +5460 -0
  178. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_ucp.h +396 -0
  179. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_ucptables.c +1533 -0
  180. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_valid_utf.c +398 -0
  181. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2_xclass.c +308 -0
  182. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2demo.c +497 -0
  183. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2grep.c +4606 -0
  184. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2posix.c +425 -0
  185. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2posix.h +187 -0
  186. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2posix_test.c +209 -0
  187. tpyc/_data/runtime/cpp/third_party/pcre2/src/pcre2test.c +9708 -0
  188. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/allocator_src/sljitExecAllocatorApple.c +137 -0
  189. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/allocator_src/sljitExecAllocatorCore.c +327 -0
  190. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/allocator_src/sljitExecAllocatorFreeBSD.c +89 -0
  191. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/allocator_src/sljitExecAllocatorPosix.c +62 -0
  192. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/allocator_src/sljitExecAllocatorWindows.c +40 -0
  193. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/allocator_src/sljitProtExecAllocatorNetBSD.c +72 -0
  194. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/allocator_src/sljitProtExecAllocatorPosix.c +172 -0
  195. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/allocator_src/sljitWXExecAllocatorPosix.c +141 -0
  196. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/allocator_src/sljitWXExecAllocatorWindows.c +102 -0
  197. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitConfig.h +142 -0
  198. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitConfigCPU.h +188 -0
  199. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitConfigInternal.h +907 -0
  200. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitLir.c +3561 -0
  201. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitLir.h +2466 -0
  202. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeARM_32.c +4636 -0
  203. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeARM_64.c +3491 -0
  204. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeARM_T2_32.c +4302 -0
  205. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeLOONGARCH_64.c +3765 -0
  206. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeMIPS_32.c +472 -0
  207. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeMIPS_64.c +387 -0
  208. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeMIPS_common.c +4259 -0
  209. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativePPC_32.c +485 -0
  210. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativePPC_64.c +719 -0
  211. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativePPC_common.c +3161 -0
  212. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeRISCV_32.c +142 -0
  213. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeRISCV_64.c +222 -0
  214. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeRISCV_common.c +3121 -0
  215. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeS390X.c +4526 -0
  216. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeX86_32.c +1685 -0
  217. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeX86_64.c +1398 -0
  218. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitNativeX86_common.c +5001 -0
  219. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitSerialize.c +516 -0
  220. tpyc/_data/runtime/cpp/third_party/pcre2/src/sljit/sljitUtils.c +344 -0
  221. tpyc/_data/runtime/cpp/third_party/pcre2.sources.txt +54 -0
  222. tpyc/_data/runtime/cpp/third_party/pcre2.vendor.json +7 -0
  223. tpyc/build/__init__.py +7 -0
  224. tpyc/build/pcre2.py +122 -0
  225. tpyc/build/third_party.py +413 -0
  226. tpyc/cli.py +822 -0
  227. tpyc/codegen_cpp/__init__.py +18 -0
  228. tpyc/codegen_cpp/builtins.py +484 -0
  229. tpyc/codegen_cpp/context.py +2064 -0
  230. tpyc/codegen_cpp/expressions.py +5940 -0
  231. tpyc/codegen_cpp/functions.py +1913 -0
  232. tpyc/codegen_cpp/gen_async.py +3258 -0
  233. tpyc/codegen_cpp/gen_generators.py +657 -0
  234. tpyc/codegen_cpp/generator.py +2258 -0
  235. tpyc/codegen_cpp/match.py +1997 -0
  236. tpyc/codegen_cpp/param_const.py +172 -0
  237. tpyc/codegen_cpp/protocols.py +907 -0
  238. tpyc/codegen_cpp/records.py +1654 -0
  239. tpyc/codegen_cpp/resumable_cfg.py +1651 -0
  240. tpyc/codegen_cpp/statements.py +4963 -0
  241. tpyc/codegen_cpp/string_dispatch.py +76 -0
  242. tpyc/codegen_cpp/test_context.py +46 -0
  243. tpyc/codegen_cpp/test_param_const.py +113 -0
  244. tpyc/codegen_cpp/test_resumable_cfg.py +182 -0
  245. tpyc/codegen_cpp/type_resolution.py +53 -0
  246. tpyc/codegen_cpp/types.py +436 -0
  247. tpyc/codegen_cpp/variant_access.py +135 -0
  248. tpyc/coercions.py +749 -0
  249. tpyc/compilation_context.py +57 -0
  250. tpyc/compiler.py +3945 -0
  251. tpyc/cycle_detection.py +358 -0
  252. tpyc/diagnostics.py +135 -0
  253. tpyc/dump_types.py +353 -0
  254. tpyc/frontend_diagnostics.py +47 -0
  255. tpyc/frontend_ir/__init__.py +140 -0
  256. tpyc/frontend_ir/lower.py +1098 -0
  257. tpyc/frontend_ir/nodes.py +718 -0
  258. tpyc/frontend_ir/resolver_adapter.py +151 -0
  259. tpyc/frontend_plugin.py +209 -0
  260. tpyc/install_docs.py +81 -0
  261. tpyc/liveness.py +756 -0
  262. tpyc/macro_api.py +1724 -0
  263. tpyc/macro_loader.py +497 -0
  264. tpyc/module_names.py +64 -0
  265. tpyc/modules/__init__.py +31 -0
  266. tpyc/modules/defs.py +89 -0
  267. tpyc/modules/registry.py +36 -0
  268. tpyc/modules/resolver.py +192 -0
  269. tpyc/modules/type_resolution.py +629 -0
  270. tpyc/namespace.py +172 -0
  271. tpyc/parse/__init__.py +84 -0
  272. tpyc/parse/imports.py +490 -0
  273. tpyc/parse/nodes.py +1732 -0
  274. tpyc/parse/parser.py +4043 -0
  275. tpyc/parse/resolve_refs.py +466 -0
  276. tpyc/parse/type_resolver.py +1060 -0
  277. tpyc/prescan.py +254 -0
  278. tpyc/qnames.py +149 -0
  279. tpyc/repl.py +529 -0
  280. tpyc/repl_backends.py +848 -0
  281. tpyc/sema/__init__.py +21 -0
  282. tpyc/sema/analyzer.py +3625 -0
  283. tpyc/sema/bound_check.py +72 -0
  284. tpyc/sema/builder_trace.py +684 -0
  285. tpyc/sema/calls.py +5406 -0
  286. tpyc/sema/compatibility.py +2107 -0
  287. tpyc/sema/context.py +1243 -0
  288. tpyc/sema/expressions.py +3737 -0
  289. tpyc/sema/flow_facts.py +199 -0
  290. tpyc/sema/init_tracker.py +150 -0
  291. tpyc/sema/list_literals.py +69 -0
  292. tpyc/sema/literal_utils.py +27 -0
  293. tpyc/sema/local_deduction.py +1088 -0
  294. tpyc/sema/macros.py +179 -0
  295. tpyc/sema/match.py +1177 -0
  296. tpyc/sema/method_expansion.py +347 -0
  297. tpyc/sema/methods.py +2197 -0
  298. tpyc/sema/mutation_propagation.py +268 -0
  299. tpyc/sema/narrowing.py +857 -0
  300. tpyc/sema/numeric_lattice.py +160 -0
  301. tpyc/sema/operators.py +402 -0
  302. tpyc/sema/overloads.py +841 -0
  303. tpyc/sema/protocols.py +1209 -0
  304. tpyc/sema/reach_analysis.py +202 -0
  305. tpyc/sema/registration.py +3156 -0
  306. tpyc/sema/scope_tracker.py +193 -0
  307. tpyc/sema/statements.py +4426 -0
  308. tpyc/sema/type_ops.py +1879 -0
  309. tpyc/sema/value_range.py +181 -0
  310. tpyc/symbol_binding.py +259 -0
  311. tpyc/test_c3_mro.py +208 -0
  312. tpyc/test_cli_argv.py +52 -0
  313. tpyc/test_compiler.py +559 -0
  314. tpyc/test_contains_type_param.py +101 -0
  315. tpyc/test_cycle_detection.py +221 -0
  316. tpyc/test_dump_types.py +225 -0
  317. tpyc/test_install_docs.py +65 -0
  318. tpyc/test_local_cpp_form.py +135 -0
  319. tpyc/test_macro_loader.py +76 -0
  320. tpyc/test_method_expansion.py +254 -0
  321. tpyc/test_nominal_identity.py +182 -0
  322. tpyc/test_overloads.py +410 -0
  323. tpyc/test_parse.py +303 -0
  324. tpyc/test_parse_type_ref.py +506 -0
  325. tpyc/test_parse_version_info.py +58 -0
  326. tpyc/test_reach_analysis.py +72 -0
  327. tpyc/test_ref_type.py +216 -0
  328. tpyc/test_send_sync_substitution.py +276 -0
  329. tpyc/test_tuple_mutation_propagation.py +206 -0
  330. tpyc/test_type_def_registry.py +1729 -0
  331. tpyc/test_union_types.py +195 -0
  332. tpyc/type_def_registry.py +975 -0
  333. tpyc/typesys.py +5104 -0
@@ -0,0 +1,2061 @@
1
+ # tpy: cpp_namespace("tpystd::tpy")
2
+ from .._typing import overload, Protocol, Self, Iterator, Iterable, Sized
3
+ from tpy import (
4
+ Span, Ptr,
5
+ # Primitive types used in method signatures (forward references within this file)
6
+ UInt64, Int32, Float32, Int8, Int16, Int64, UInt8, UInt16, UInt32,
7
+ Char, String, StrView,
8
+ )
9
+ from .._bootstrap._decorators import readonly, pure, nocopy, Own, dynamic
10
+ from .._bootstrap._extern import native, cpp_template, builtin_type, value_ptr_coercion
11
+ from ..mem import UninitArrayStorage as _UninitArrayStorage
12
+
13
+
14
+ # --- Dynamic protocols (vtable-based runtime dispatch) ---
15
+
16
+ # ABI root for the exception hierarchy. Two virtual methods support
17
+ # polymorphic exception storage (Phase 20):
18
+ # clone() -- heap-allocated polymorphic copy at the concrete type;
19
+ # paired with Box(e.clone()) for Box[Throwable] storage.
20
+ # __raise__() -- re-raises *self as the dynamic type, used by the
21
+ # `raise <expr>` desugar (Stage 3) so a stored exception
22
+ # preserves its concrete subclass through C++ unwinding.
23
+ # `@native + @dynamic` together: the abstract base class is hand-written
24
+ # in runtime/cpp/include/tpy/throwable.hpp as `::tpy::Throwable`. TPy
25
+ # resolves `Throwable` to that C++ name and treats the protocol as
26
+ # @dynamic for the polymorphism predicate (is_polymorphic_class_type)
27
+ # and inheritance-based conformance. Codegen suppresses concept /
28
+ # abstract-base / Adapter emission when both decorators are set.
29
+ # `BaseException` and subclasses inherit Throwable directly; the
30
+ # TPY_THROWABLE_VIRTUALS macro (in throwable.hpp, applied across
31
+ # core.hpp / async.hpp) emits the two overrides on every native
32
+ # exception class.
33
+ @native("tpy::Throwable")
34
+ @dynamic
35
+ class Throwable(Protocol):
36
+ @readonly
37
+ def clone(self) -> Own[Throwable]: ...
38
+
39
+ @readonly
40
+ def __raise__(self) -> None: ...
41
+
42
+
43
+ # --- Structural protocols (concept generated from method signatures) ---
44
+
45
+ class Truthy(Protocol):
46
+ @readonly
47
+ def __bool__(self) -> bool: ...
48
+
49
+
50
+ class Stringable(Protocol):
51
+ @readonly
52
+ def __str__(self) -> str: ...
53
+
54
+
55
+ class Representable(Protocol):
56
+ @readonly
57
+ def __repr__(self) -> str: ...
58
+
59
+
60
+ class Hashable(Protocol):
61
+ @readonly
62
+ def __hash__(self) -> UInt64: ...
63
+
64
+
65
+ class Comparable(Protocol):
66
+ @readonly
67
+ def __lt__(self, other: Self) -> bool: ...
68
+
69
+
70
+ class Equatable(Protocol):
71
+ @readonly
72
+ def __eq__(self, other: Self) -> bool: ...
73
+
74
+
75
+ class Deref[T](Protocol):
76
+ def __deref__(self) -> T: ...
77
+
78
+
79
+ class Spannable[T](Protocol):
80
+ @readonly
81
+ def __span__(self) -> Span[readonly[T]]: ...
82
+
83
+
84
+ class Writable(Protocol):
85
+ def write(self, text: str) -> Int32: ...
86
+
87
+ def flush(self) -> None: ...
88
+
89
+
90
+ class Readable(Protocol):
91
+ def read(self) -> str: ...
92
+
93
+ def readline(self) -> str: ...
94
+
95
+
96
+ class BinaryWritable(Protocol):
97
+ def write(self, data: bytes) -> Int32: ...
98
+
99
+ def flush(self) -> None: ...
100
+
101
+
102
+ class BinaryReadable(Protocol):
103
+ def read(self) -> bytes: ...
104
+
105
+ def readline(self) -> bytes: ...
106
+
107
+
108
+ class Seekable(Protocol):
109
+ def seek(self, pos: Int32, whence: Int32 = 0) -> Int32: ...
110
+
111
+ def tell(self) -> Int32: ...
112
+
113
+
114
+ class Closable(Protocol):
115
+ def close(self) -> None: ...
116
+ # TODO: add `@property closed -> bool` once Protocol+@property is exercised
117
+ # elsewhere in the codebase. CPython's IOBase exposes both close() and a
118
+ # readable `closed` flag; we ship close() only for v1 to keep the protocol
119
+ # on the verified path. Concrete implementations (StringIO/BytesIO) carry
120
+ # the property today, so users still get `obj.closed` -- just not
121
+ # through a `Closable`-typed parameter.
122
+
123
+
124
+ # --- Marker protocols (no methods, map to runtime C++ concepts) ---
125
+
126
+ @native("tpy::NativeIterable")
127
+ class NativeIterable[T](Iterable[T], Protocol): ...
128
+
129
+ @native("tpy::NativeRangeConstructible")
130
+ class NativeRangeConstructible[T](Protocol): ...
131
+
132
+ @native("tpy::ValueType")
133
+ class ValueType(Protocol): ...
134
+
135
+
136
+ @native("tpy::Copyable")
137
+ class Copyable(Protocol): ...
138
+
139
+ @native("tpy::Send")
140
+ class Send(Protocol): ...
141
+
142
+ @native("tpy::Sync")
143
+ class Sync(Protocol): ...
144
+
145
+ @native("std::default_initializable")
146
+ class Default(Protocol): ...
147
+
148
+ @native("tpy::ReturnException")
149
+ class ReturnException(Protocol): ...
150
+
151
+ @native("tpy::Covariant")
152
+ class Covariant[T](Protocol): ...
153
+
154
+ # Fixed-width integer constraints (for generic functions over Int8..UInt64)
155
+ @native("tpy::AnyFixedInt")
156
+ class AnyFixedInt(Protocol): ...
157
+
158
+ @native("tpy::AnyFixedSigned")
159
+ class AnyFixedSigned(Protocol): ...
160
+
161
+ @native("tpy::AnyFixedUnsigned")
162
+ class AnyFixedUnsigned(Protocol): ...
163
+
164
+ # `Poll`'s body lives in this file (cpp_namespace `tpystd::tpy`) rather
165
+ # than alongside `Awaitable` in `tpy/coro/__init__.py` for codegen-
166
+ # ordering reasons: the `Awaitable[T]` concept's body needs `Poll[T]`'s
167
+ # full type, but codegen emits record full-defs after concepts within
168
+ # the same TU. Keeping the body here gets the full def into
169
+ # `_core/_types.hpp`, which `coro.hpp` already includes. The TPy qname
170
+ # is `tpy.coro.Poll` -- decoupled from the file's cpp_namespace -- so
171
+ # users see the same qname they import from (`from tpy.coro import
172
+ # Poll`). The C++ symbol is `::tpystd::tpy::Poll<T>` regardless.
173
+ # `Waker` / `Awaker` live in `tpy/coro/__init__.py`. `Task` is
174
+ # `@builtin_type("tpy.Task")` decorated in `asyncio._executor`.
175
+
176
+
177
+ @builtin_type("tpy.coro.Poll")
178
+ @nocopy
179
+ class Poll[T]:
180
+ """Result of polling an Awaitable: Pending or Ready[T].
181
+
182
+ Single-use: `value()` consumes the contained value. Construct via
183
+ `Poll[T].ready(value)` / `Poll[T].pending()`, or the convenience
184
+ wrappers in `tpy.coro` (`poll_ready` / `poll_pending` /
185
+ `poll_ready_none`).
186
+ """
187
+ _slot: _UninitArrayStorage[T, 1]
188
+ _has: bool
189
+
190
+ def __init__(self) -> None:
191
+ self._slot = _UninitArrayStorage[T, 1]()
192
+ self._has = False
193
+
194
+ def __del__(self) -> None:
195
+ if self._has:
196
+ self._slot.take0()
197
+ self._has = False
198
+
199
+ @staticmethod
200
+ def pending() -> Own["Poll[T]"]:
201
+ return Poll[T]()
202
+
203
+ @staticmethod
204
+ def ready(value: Own[T]) -> Own["Poll[T]"]:
205
+ p = Poll[T]()
206
+ p._slot.init0(value)
207
+ p._has = True
208
+ return p
209
+
210
+ @readonly
211
+ def is_ready(self) -> bool:
212
+ return self._has
213
+
214
+ @readonly
215
+ def is_pending(self) -> bool:
216
+ return not self._has
217
+
218
+ def value(self: Own[Self]) -> Own[T]:
219
+ # `Own[Self]` makes the borrow checker reject a second call --
220
+ # the slot's alive-bit is cleared after the first take0().
221
+ self._has = False
222
+ return self._slot.take0()
223
+
224
+
225
+ # --- Primitive type stubs (methods for builtin types) ---
226
+
227
+ @builtin_type("tpy.Float32")
228
+ @native("float")
229
+ class Float32(Comparable, Equatable):
230
+ # Constructors
231
+ @overload
232
+ @cpp_template("0.0f")
233
+ def __init__(self) -> None: ...
234
+ @overload
235
+ @cpp_template("{0}")
236
+ def __init__(self, x: Float32) -> None: ...
237
+ @overload
238
+ @cpp_template("static_cast<float>({0})")
239
+ def __init__(self, x: float) -> None: ...
240
+ @overload
241
+ @cpp_template("static_cast<float>({0})")
242
+ def __init__(self, x: int) -> None: ...
243
+ @overload
244
+ @cpp_template("static_cast<float>({0})")
245
+ def __init__(self, x: bool) -> None: ...
246
+ @overload
247
+ @native("tpy::float32_from_str", function=True)
248
+ def __init__(self, x: str) -> None: ...
249
+ @overload
250
+ @cpp_template("static_cast<float>({0})")
251
+ def __init__(self, x: Int8) -> None: ...
252
+ @overload
253
+ @cpp_template("static_cast<float>({0})")
254
+ def __init__(self, x: Int16) -> None: ...
255
+ @overload
256
+ @cpp_template("static_cast<float>({0})")
257
+ def __init__(self, x: Int32) -> None: ...
258
+ @overload
259
+ @cpp_template("static_cast<float>({0})")
260
+ def __init__(self, x: Int64) -> None: ...
261
+ @overload
262
+ @cpp_template("static_cast<float>({0})")
263
+ def __init__(self, x: UInt8) -> None: ...
264
+ @overload
265
+ @cpp_template("static_cast<float>({0})")
266
+ def __init__(self, x: UInt16) -> None: ...
267
+ @overload
268
+ @cpp_template("static_cast<float>({0})")
269
+ def __init__(self, x: UInt32) -> None: ...
270
+ @overload
271
+ @cpp_template("static_cast<float>({0})")
272
+ def __init__(self, x: UInt64) -> None: ...
273
+
274
+ # Binary operators: Float32 op T -> result
275
+ @overload
276
+ @cpp_template("({self}) + ({0})")
277
+ def __add__(self, other: Float32) -> Float32: ...
278
+ @overload
279
+ @cpp_template("static_cast<double>({self}) + ({0})")
280
+ def __add__(self, other: float) -> float: ...
281
+ @overload
282
+ @cpp_template("({self}) + static_cast<float>({0})")
283
+ def __add__(self, other: int) -> Float32: ...
284
+ @overload
285
+ @cpp_template("({self}) + static_cast<float>({0})")
286
+ def __add__(self, other: Int32) -> Float32: ...
287
+
288
+ @overload
289
+ @cpp_template("({self}) - ({0})")
290
+ def __sub__(self, other: Float32) -> Float32: ...
291
+ @overload
292
+ @cpp_template("static_cast<double>({self}) - ({0})")
293
+ def __sub__(self, other: float) -> float: ...
294
+ @overload
295
+ @cpp_template("({self}) - static_cast<float>({0})")
296
+ def __sub__(self, other: int) -> Float32: ...
297
+ @overload
298
+ @cpp_template("({self}) - static_cast<float>({0})")
299
+ def __sub__(self, other: Int32) -> Float32: ...
300
+
301
+ @overload
302
+ @cpp_template("({self}) * ({0})")
303
+ def __mul__(self, other: Float32) -> Float32: ...
304
+ @overload
305
+ @cpp_template("static_cast<double>({self}) * ({0})")
306
+ def __mul__(self, other: float) -> float: ...
307
+ @overload
308
+ @cpp_template("({self}) * static_cast<float>({0})")
309
+ def __mul__(self, other: int) -> Float32: ...
310
+ @overload
311
+ @cpp_template("({self}) * static_cast<float>({0})")
312
+ def __mul__(self, other: Int32) -> Float32: ...
313
+
314
+ @overload
315
+ @cpp_template("::tpy::truediv_f32({self}, {0})")
316
+ def __truediv__(self, other: Float32) -> Float32: ...
317
+ @overload
318
+ @cpp_template("::tpy::truediv(static_cast<double>({self}), {0})")
319
+ def __truediv__(self, other: float) -> float: ...
320
+ @overload
321
+ @cpp_template("::tpy::truediv_f32({self}, static_cast<float>({0}))")
322
+ def __truediv__(self, other: int) -> Float32: ...
323
+ @overload
324
+ @cpp_template("::tpy::truediv_f32({self}, static_cast<float>({0}))")
325
+ def __truediv__(self, other: Int32) -> Float32: ...
326
+
327
+ @overload
328
+ @cpp_template("::tpy::floordiv_f32({self}, {0})")
329
+ def __floordiv__(self, other: Float32) -> Float32: ...
330
+ @overload
331
+ @cpp_template("::tpy::floordiv(static_cast<double>({self}), {0})")
332
+ def __floordiv__(self, other: float) -> float: ...
333
+ @overload
334
+ @cpp_template("::tpy::floordiv_f32({self}, static_cast<float>({0}))")
335
+ def __floordiv__(self, other: int) -> Float32: ...
336
+ @overload
337
+ @cpp_template("::tpy::floordiv_f32({self}, static_cast<float>({0}))")
338
+ def __floordiv__(self, other: Int32) -> Float32: ...
339
+
340
+ @overload
341
+ @cpp_template("::tpy::fmod_f32({self}, {0})")
342
+ def __mod__(self, other: Float32) -> Float32: ...
343
+ @overload
344
+ @cpp_template("::tpy::fmod(static_cast<double>({self}), {0})")
345
+ def __mod__(self, other: float) -> float: ...
346
+ @overload
347
+ @cpp_template("::tpy::fmod_f32({self}, static_cast<float>({0}))")
348
+ def __mod__(self, other: int) -> Float32: ...
349
+ @overload
350
+ @cpp_template("::tpy::fmod_f32({self}, static_cast<float>({0}))")
351
+ def __mod__(self, other: Int32) -> Float32: ...
352
+
353
+ @overload
354
+ @cpp_template("std::pow({self}, {0})")
355
+ def __pow__(self, other: Float32) -> Float32: ...
356
+ @overload
357
+ @cpp_template("std::pow(static_cast<double>({self}), {0})")
358
+ def __pow__(self, other: float) -> float: ...
359
+ @overload
360
+ @cpp_template("std::pow({self}, static_cast<float>({0}))")
361
+ def __pow__(self, other: int) -> Float32: ...
362
+ @overload
363
+ @cpp_template("std::pow({self}, static_cast<float>({0}))")
364
+ def __pow__(self, other: Int32) -> Float32: ...
365
+
366
+ # Unary operators
367
+ @cpp_template("+({self})")
368
+ def __pos__(self) -> Float32: ...
369
+ @cpp_template("-({self})")
370
+ def __neg__(self) -> Float32: ...
371
+
372
+ # Reverse operators: T op Float32 -> result
373
+ @overload
374
+ @cpp_template("({0}) + ({self})")
375
+ def __radd__(self, other: Float32) -> Float32: ...
376
+ @overload
377
+ @cpp_template("({0}) + static_cast<double>({self})")
378
+ def __radd__(self, other: float) -> float: ...
379
+ @overload
380
+ @cpp_template("static_cast<float>({0}) + ({self})")
381
+ def __radd__(self, other: int) -> Float32: ...
382
+ @overload
383
+ @cpp_template("static_cast<float>({0}) + ({self})")
384
+ def __radd__(self, other: Int32) -> Float32: ...
385
+
386
+ @overload
387
+ @cpp_template("({0}) - ({self})")
388
+ def __rsub__(self, other: Float32) -> Float32: ...
389
+ @overload
390
+ @cpp_template("({0}) - static_cast<double>({self})")
391
+ def __rsub__(self, other: float) -> float: ...
392
+ @overload
393
+ @cpp_template("static_cast<float>({0}) - ({self})")
394
+ def __rsub__(self, other: int) -> Float32: ...
395
+ @overload
396
+ @cpp_template("static_cast<float>({0}) - ({self})")
397
+ def __rsub__(self, other: Int32) -> Float32: ...
398
+
399
+ @overload
400
+ @cpp_template("({0}) * ({self})")
401
+ def __rmul__(self, other: Float32) -> Float32: ...
402
+ @overload
403
+ @cpp_template("({0}) * static_cast<double>({self})")
404
+ def __rmul__(self, other: float) -> float: ...
405
+ @overload
406
+ @cpp_template("static_cast<float>({0}) * ({self})")
407
+ def __rmul__(self, other: int) -> Float32: ...
408
+ @overload
409
+ @cpp_template("static_cast<float>({0}) * ({self})")
410
+ def __rmul__(self, other: Int32) -> Float32: ...
411
+
412
+ @overload
413
+ @cpp_template("::tpy::truediv_f32({0}, {self})")
414
+ def __rtruediv__(self, other: Float32) -> Float32: ...
415
+ @overload
416
+ @cpp_template("::tpy::truediv({0}, static_cast<double>({self}))")
417
+ def __rtruediv__(self, other: float) -> float: ...
418
+ @overload
419
+ @cpp_template("::tpy::truediv_f32(static_cast<float>({0}), {self})")
420
+ def __rtruediv__(self, other: int) -> Float32: ...
421
+ @overload
422
+ @cpp_template("::tpy::truediv_f32(static_cast<float>({0}), {self})")
423
+ def __rtruediv__(self, other: Int32) -> Float32: ...
424
+
425
+ @overload
426
+ @cpp_template("::tpy::floordiv_f32({0}, {self})")
427
+ def __rfloordiv__(self, other: Float32) -> Float32: ...
428
+ @overload
429
+ @cpp_template("::tpy::floordiv({0}, static_cast<double>({self}))")
430
+ def __rfloordiv__(self, other: float) -> float: ...
431
+ @overload
432
+ @cpp_template("::tpy::floordiv_f32(static_cast<float>({0}), {self})")
433
+ def __rfloordiv__(self, other: int) -> Float32: ...
434
+ @overload
435
+ @cpp_template("::tpy::floordiv_f32(static_cast<float>({0}), {self})")
436
+ def __rfloordiv__(self, other: Int32) -> Float32: ...
437
+
438
+ @overload
439
+ @cpp_template("::tpy::fmod_f32({0}, {self})")
440
+ def __rmod__(self, other: Float32) -> Float32: ...
441
+ @overload
442
+ @cpp_template("::tpy::fmod({0}, static_cast<double>({self}))")
443
+ def __rmod__(self, other: float) -> float: ...
444
+ @overload
445
+ @cpp_template("::tpy::fmod_f32(static_cast<float>({0}), {self})")
446
+ def __rmod__(self, other: int) -> Float32: ...
447
+ @overload
448
+ @cpp_template("::tpy::fmod_f32(static_cast<float>({0}), {self})")
449
+ def __rmod__(self, other: Int32) -> Float32: ...
450
+
451
+ @overload
452
+ @cpp_template("std::pow({0}, {self})")
453
+ def __rpow__(self, other: Float32) -> Float32: ...
454
+ @overload
455
+ @cpp_template("std::pow({0}, static_cast<double>({self}))")
456
+ def __rpow__(self, other: float) -> float: ...
457
+ @overload
458
+ @cpp_template("std::pow(static_cast<float>({0}), {self})")
459
+ def __rpow__(self, other: int) -> Float32: ...
460
+ @overload
461
+ @cpp_template("std::pow(static_cast<float>({0}), {self})")
462
+ def __rpow__(self, other: Int32) -> Float32: ...
463
+
464
+ # Comparison and hashing
465
+ @cpp_template("::tpy::__hash__({self})")
466
+ @readonly
467
+ @pure
468
+ def __hash__(self) -> UInt64: ...
469
+
470
+ @cpp_template("({self} != 0.0f)")
471
+ @readonly
472
+ @pure
473
+ def __bool__(self) -> bool: ...
474
+
475
+ @cpp_template("{self} == {0}")
476
+ @readonly
477
+ @pure
478
+ def __eq__(self, other: Float32) -> bool: ...
479
+
480
+ @cpp_template("{self} < {0}")
481
+ @readonly
482
+ @pure
483
+ def __lt__(self, other: Float32) -> bool: ...
484
+
485
+
486
+ @builtin_type("tpy.Int8")
487
+ @native("int8_t")
488
+ class Int8(Comparable, Equatable, AnyFixedInt, AnyFixedSigned):
489
+ @overload
490
+ @cpp_template("0")
491
+ def __init__(self) -> None: ...
492
+ @overload
493
+ @cpp_template("{0}")
494
+ def __init__(self, x: Int8) -> None: ...
495
+ @overload
496
+ @cpp_template("::tpy::int_cast_check<{cpp}>({0})")
497
+ def __init__[T: AnyFixedInt](self, x: T) -> None: ...
498
+ @overload
499
+ @cpp_template("({0}).to_fixed_check<{cpp}>()")
500
+ def __init__(self, x: int) -> None: ...
501
+ @overload
502
+ @cpp_template("::tpy::from_float_check<{cpp}>({0})")
503
+ def __init__(self, x: float) -> None: ...
504
+ @overload
505
+ @cpp_template("::tpy::from_float_check<{cpp}>(static_cast<double>({0}))")
506
+ def __init__(self, x: Float32) -> None: ...
507
+ @overload
508
+ @cpp_template("::tpy::from_str_check<{cpp}>({0})")
509
+ def __init__(self, x: str) -> None: ...
510
+ @overload
511
+ @cpp_template("static_cast<{cpp}>({0})")
512
+ def __init__(self, x: bool) -> None: ...
513
+ @overload
514
+ @staticmethod
515
+ @cpp_template("static_cast<int8_t>({0})")
516
+ def trunc[T: AnyFixedInt](x: T) -> Int8: ...
517
+ @overload
518
+ @staticmethod
519
+ @cpp_template("({0}).to_fixed_trunc<int8_t>()")
520
+ def trunc(x: int) -> Int8: ...
521
+ # Wrapping arithmetic (mod 2^8). Signed overflow is UB in C++; we
522
+ # route through unsigned to get defined wrap, then cast back.
523
+ @staticmethod
524
+ @cpp_template("static_cast<int8_t>(static_cast<uint8_t>({0}) + static_cast<uint8_t>({1}))")
525
+ def add_wrap(x: Int8, y: Int8) -> Int8: ...
526
+ @staticmethod
527
+ @cpp_template("static_cast<int8_t>(static_cast<uint8_t>({0}) - static_cast<uint8_t>({1}))")
528
+ def sub_wrap(x: Int8, y: Int8) -> Int8: ...
529
+ @staticmethod
530
+ @cpp_template("static_cast<int8_t>(static_cast<uint8_t>({0}) * static_cast<uint8_t>({1}))")
531
+ def mul_wrap(x: Int8, y: Int8) -> Int8: ...
532
+ # Wrapping shifts via unsigned route. Caller must ensure 0 <= n <
533
+ # bitwidth. Signed shr_wrap is logical (zero-fill), not arithmetic.
534
+ @staticmethod
535
+ @cpp_template("static_cast<int8_t>(static_cast<uint8_t>({0}) << ({1}))")
536
+ def shl_wrap(x: Int8, n: Int8) -> Int8: ...
537
+ @staticmethod
538
+ @cpp_template("static_cast<int8_t>(static_cast<uint8_t>({0}) >> ({1}))")
539
+ def shr_wrap(x: Int8, n: Int8) -> Int8: ...
540
+ @cpp_template("::tpy::BigInt({self})")
541
+ def __int__(self) -> int: ...
542
+ @cpp_template("::tpy::add_check<int8_t>({self}, {0})")
543
+ def __add__(self, other: Int8) -> Int8: ...
544
+ @cpp_template("::tpy::sub_check<int8_t>({self}, {0})")
545
+ def __sub__(self, other: Int8) -> Int8: ...
546
+ @cpp_template("::tpy::mul_check<int8_t>({self}, {0})")
547
+ def __mul__(self, other: Int8) -> Int8: ...
548
+ @cpp_template("::tpy::truediv(static_cast<double>({self}), static_cast<double>({0}))")
549
+ def __truediv__(self, other: Int8) -> float: ...
550
+ @cpp_template("::tpy::div_check<int8_t>({self}, {0})")
551
+ def __floordiv__(self, other: Int8) -> Int8: ...
552
+ @cpp_template("::tpy::mod_check<int8_t>({self}, {0})")
553
+ def __mod__(self, other: Int8) -> Int8: ...
554
+ @cpp_template("::tpy::pow_check<int8_t>({self}, {0})")
555
+ def __pow__(self, other: Int8) -> Int8: ...
556
+ @cpp_template("::tpy::lshift_check<int8_t>({self}, {0})")
557
+ def __lshift__(self, other: Int8) -> Int8: ...
558
+ @cpp_template("::tpy::rshift_check<int8_t>({self}, {0})")
559
+ def __rshift__(self, other: Int8) -> Int8: ...
560
+ @cpp_template("static_cast<int8_t>({self} & {0})")
561
+ def __and__(self, other: Int8) -> Int8: ...
562
+ @cpp_template("static_cast<int8_t>({self} | {0})")
563
+ def __or__(self, other: Int8) -> Int8: ...
564
+ @cpp_template("static_cast<int8_t>({self} ^ {0})")
565
+ def __xor__(self, other: Int8) -> Int8: ...
566
+ @cpp_template("::tpy::add_check<int8_t>({0}, {self})")
567
+ def __radd__(self, other: Int8) -> Int8: ...
568
+ @cpp_template("::tpy::sub_check<int8_t>({0}, {self})")
569
+ def __rsub__(self, other: Int8) -> Int8: ...
570
+ @cpp_template("::tpy::mul_check<int8_t>({0}, {self})")
571
+ def __rmul__(self, other: Int8) -> Int8: ...
572
+ @cpp_template("::tpy::truediv(static_cast<double>({0}), static_cast<double>({self}))")
573
+ def __rtruediv__(self, other: Int8) -> float: ...
574
+ @cpp_template("::tpy::div_check<int8_t>({0}, {self})")
575
+ def __rfloordiv__(self, other: Int8) -> Int8: ...
576
+ @cpp_template("::tpy::mod_check<int8_t>({0}, {self})")
577
+ def __rmod__(self, other: Int8) -> Int8: ...
578
+ @cpp_template("::tpy::pow_check<int8_t>({0}, {self})")
579
+ def __rpow__(self, other: Int8) -> Int8: ...
580
+ @cpp_template("::tpy::lshift_check<int8_t>({0}, {self})")
581
+ def __rlshift__(self, other: Int8) -> Int8: ...
582
+ @cpp_template("::tpy::rshift_check<int8_t>({0}, {self})")
583
+ def __rrshift__(self, other: Int8) -> Int8: ...
584
+ @cpp_template("static_cast<int8_t>({0} & {self})")
585
+ def __rand__(self, other: Int8) -> Int8: ...
586
+ @cpp_template("static_cast<int8_t>({0} | {self})")
587
+ def __ror__(self, other: Int8) -> Int8: ...
588
+ @cpp_template("static_cast<int8_t>({0} ^ {self})")
589
+ def __rxor__(self, other: Int8) -> Int8: ...
590
+ @cpp_template("static_cast<int8_t>(~({self}))")
591
+ def __invert__(self) -> Int8: ...
592
+ @cpp_template("+{self}")
593
+ def __pos__(self) -> Int8: ...
594
+ @cpp_template("::tpy::neg_check<int8_t>({self})")
595
+ def __neg__(self) -> Int8: ...
596
+ @cpp_template("({self} != 0)")
597
+ @readonly
598
+ @pure
599
+ def __bool__(self) -> bool: ...
600
+ @cpp_template("{self} == {0}")
601
+ @readonly
602
+ @pure
603
+ def __eq__(self, other: Int8) -> bool: ...
604
+ @cpp_template("::tpy::__hash__({self})")
605
+ @readonly
606
+ @pure
607
+ def __hash__(self) -> UInt64: ...
608
+ @cpp_template("{self} < {0}")
609
+ @readonly
610
+ @pure
611
+ def __lt__(self, other: Int8) -> bool: ...
612
+
613
+
614
+ @builtin_type("tpy.Int16")
615
+ @native("int16_t")
616
+ class Int16(Comparable, Equatable, AnyFixedInt, AnyFixedSigned):
617
+ @overload
618
+ @cpp_template("0")
619
+ def __init__(self) -> None: ...
620
+ @overload
621
+ @cpp_template("{0}")
622
+ def __init__(self, x: Int16) -> None: ...
623
+ @overload
624
+ @cpp_template("::tpy::int_cast_check<{cpp}>({0})")
625
+ def __init__[T: AnyFixedInt](self, x: T) -> None: ...
626
+ @overload
627
+ @cpp_template("({0}).to_fixed_check<{cpp}>()")
628
+ def __init__(self, x: int) -> None: ...
629
+ @overload
630
+ @cpp_template("::tpy::from_float_check<{cpp}>({0})")
631
+ def __init__(self, x: float) -> None: ...
632
+ @overload
633
+ @cpp_template("::tpy::from_float_check<{cpp}>(static_cast<double>({0}))")
634
+ def __init__(self, x: Float32) -> None: ...
635
+ @overload
636
+ @cpp_template("::tpy::from_str_check<{cpp}>({0})")
637
+ def __init__(self, x: str) -> None: ...
638
+ @overload
639
+ @cpp_template("static_cast<{cpp}>({0})")
640
+ def __init__(self, x: bool) -> None: ...
641
+ @overload
642
+ @staticmethod
643
+ @cpp_template("static_cast<int16_t>({0})")
644
+ def trunc[T: AnyFixedInt](x: T) -> Int16: ...
645
+ @overload
646
+ @staticmethod
647
+ @cpp_template("({0}).to_fixed_trunc<int16_t>()")
648
+ def trunc(x: int) -> Int16: ...
649
+ @staticmethod
650
+ @cpp_template("static_cast<int16_t>(static_cast<uint16_t>({0}) + static_cast<uint16_t>({1}))")
651
+ def add_wrap(x: Int16, y: Int16) -> Int16: ...
652
+ @staticmethod
653
+ @cpp_template("static_cast<int16_t>(static_cast<uint16_t>({0}) - static_cast<uint16_t>({1}))")
654
+ def sub_wrap(x: Int16, y: Int16) -> Int16: ...
655
+ @staticmethod
656
+ @cpp_template("static_cast<int16_t>(static_cast<uint16_t>({0}) * static_cast<uint16_t>({1}))")
657
+ def mul_wrap(x: Int16, y: Int16) -> Int16: ...
658
+ @staticmethod
659
+ @cpp_template("static_cast<int16_t>(static_cast<uint16_t>({0}) << ({1}))")
660
+ def shl_wrap(x: Int16, n: Int16) -> Int16: ...
661
+ @staticmethod
662
+ @cpp_template("static_cast<int16_t>(static_cast<uint16_t>({0}) >> ({1}))")
663
+ def shr_wrap(x: Int16, n: Int16) -> Int16: ...
664
+ @cpp_template("::tpy::BigInt({self})")
665
+ def __int__(self) -> int: ...
666
+ @cpp_template("::tpy::add_check<int16_t>({self}, {0})")
667
+ def __add__(self, other: Int16) -> Int16: ...
668
+ @cpp_template("::tpy::sub_check<int16_t>({self}, {0})")
669
+ def __sub__(self, other: Int16) -> Int16: ...
670
+ @cpp_template("::tpy::mul_check<int16_t>({self}, {0})")
671
+ def __mul__(self, other: Int16) -> Int16: ...
672
+ @cpp_template("::tpy::truediv(static_cast<double>({self}), static_cast<double>({0}))")
673
+ def __truediv__(self, other: Int16) -> float: ...
674
+ @cpp_template("::tpy::div_check<int16_t>({self}, {0})")
675
+ def __floordiv__(self, other: Int16) -> Int16: ...
676
+ @cpp_template("::tpy::mod_check<int16_t>({self}, {0})")
677
+ def __mod__(self, other: Int16) -> Int16: ...
678
+ @cpp_template("::tpy::pow_check<int16_t>({self}, {0})")
679
+ def __pow__(self, other: Int16) -> Int16: ...
680
+ @cpp_template("::tpy::lshift_check<int16_t>({self}, {0})")
681
+ def __lshift__(self, other: Int16) -> Int16: ...
682
+ @cpp_template("::tpy::rshift_check<int16_t>({self}, {0})")
683
+ def __rshift__(self, other: Int16) -> Int16: ...
684
+ @cpp_template("static_cast<int16_t>({self} & {0})")
685
+ def __and__(self, other: Int16) -> Int16: ...
686
+ @cpp_template("static_cast<int16_t>({self} | {0})")
687
+ def __or__(self, other: Int16) -> Int16: ...
688
+ @cpp_template("static_cast<int16_t>({self} ^ {0})")
689
+ def __xor__(self, other: Int16) -> Int16: ...
690
+ @cpp_template("::tpy::add_check<int16_t>({0}, {self})")
691
+ def __radd__(self, other: Int16) -> Int16: ...
692
+ @cpp_template("::tpy::sub_check<int16_t>({0}, {self})")
693
+ def __rsub__(self, other: Int16) -> Int16: ...
694
+ @cpp_template("::tpy::mul_check<int16_t>({0}, {self})")
695
+ def __rmul__(self, other: Int16) -> Int16: ...
696
+ @cpp_template("::tpy::truediv(static_cast<double>({0}), static_cast<double>({self}))")
697
+ def __rtruediv__(self, other: Int16) -> float: ...
698
+ @cpp_template("::tpy::div_check<int16_t>({0}, {self})")
699
+ def __rfloordiv__(self, other: Int16) -> Int16: ...
700
+ @cpp_template("::tpy::mod_check<int16_t>({0}, {self})")
701
+ def __rmod__(self, other: Int16) -> Int16: ...
702
+ @cpp_template("::tpy::pow_check<int16_t>({0}, {self})")
703
+ def __rpow__(self, other: Int16) -> Int16: ...
704
+ @cpp_template("::tpy::lshift_check<int16_t>({0}, {self})")
705
+ def __rlshift__(self, other: Int16) -> Int16: ...
706
+ @cpp_template("::tpy::rshift_check<int16_t>({0}, {self})")
707
+ def __rrshift__(self, other: Int16) -> Int16: ...
708
+ @cpp_template("static_cast<int16_t>({0} & {self})")
709
+ def __rand__(self, other: Int16) -> Int16: ...
710
+ @cpp_template("static_cast<int16_t>({0} | {self})")
711
+ def __ror__(self, other: Int16) -> Int16: ...
712
+ @cpp_template("static_cast<int16_t>({0} ^ {self})")
713
+ def __rxor__(self, other: Int16) -> Int16: ...
714
+ @cpp_template("static_cast<int16_t>(~({self}))")
715
+ def __invert__(self) -> Int16: ...
716
+ @cpp_template("+{self}")
717
+ def __pos__(self) -> Int16: ...
718
+ @cpp_template("::tpy::neg_check<int16_t>({self})")
719
+ def __neg__(self) -> Int16: ...
720
+ @cpp_template("({self} != 0)")
721
+ @readonly
722
+ @pure
723
+ def __bool__(self) -> bool: ...
724
+ @cpp_template("{self} == {0}")
725
+ @readonly
726
+ @pure
727
+ def __eq__(self, other: Int16) -> bool: ...
728
+ @cpp_template("::tpy::__hash__({self})")
729
+ @readonly
730
+ @pure
731
+ def __hash__(self) -> UInt64: ...
732
+ @cpp_template("{self} < {0}")
733
+ @readonly
734
+ @pure
735
+ def __lt__(self, other: Int16) -> bool: ...
736
+
737
+
738
+ @builtin_type("tpy.Int32")
739
+ @native("int32_t")
740
+ class Int32(Comparable, Equatable, AnyFixedInt, AnyFixedSigned):
741
+ @overload
742
+ @cpp_template("0")
743
+ def __init__(self) -> None: ...
744
+ @overload
745
+ @cpp_template("{0}")
746
+ def __init__(self, x: Int32) -> None: ...
747
+ @overload
748
+ @cpp_template("::tpy::int_cast_check<{cpp}>({0})")
749
+ def __init__[T: AnyFixedInt](self, x: T) -> None: ...
750
+ @overload
751
+ @cpp_template("({0}).to_fixed_check<{cpp}>()")
752
+ def __init__(self, x: int) -> None: ...
753
+ @overload
754
+ @cpp_template("::tpy::from_float_check<{cpp}>({0})")
755
+ def __init__(self, x: float) -> None: ...
756
+ @overload
757
+ @cpp_template("::tpy::from_float_check<{cpp}>(static_cast<double>({0}))")
758
+ def __init__(self, x: Float32) -> None: ...
759
+ @overload
760
+ @cpp_template("::tpy::from_str_check<{cpp}>({0})")
761
+ def __init__(self, x: str) -> None: ...
762
+ @overload
763
+ @cpp_template("static_cast<{cpp}>({0})")
764
+ def __init__(self, x: bool) -> None: ...
765
+ @overload
766
+ @staticmethod
767
+ @cpp_template("static_cast<int32_t>({0})")
768
+ def trunc[T: AnyFixedInt](x: T) -> Int32: ...
769
+ @overload
770
+ @staticmethod
771
+ @cpp_template("({0}).to_fixed_trunc<int32_t>()")
772
+ def trunc(x: int) -> Int32: ...
773
+ @staticmethod
774
+ @cpp_template("static_cast<int32_t>(static_cast<uint32_t>({0}) + static_cast<uint32_t>({1}))")
775
+ def add_wrap(x: Int32, y: Int32) -> Int32: ...
776
+ @staticmethod
777
+ @cpp_template("static_cast<int32_t>(static_cast<uint32_t>({0}) - static_cast<uint32_t>({1}))")
778
+ def sub_wrap(x: Int32, y: Int32) -> Int32: ...
779
+ @staticmethod
780
+ @cpp_template("static_cast<int32_t>(static_cast<uint32_t>({0}) * static_cast<uint32_t>({1}))")
781
+ def mul_wrap(x: Int32, y: Int32) -> Int32: ...
782
+ @staticmethod
783
+ @cpp_template("static_cast<int32_t>(static_cast<uint32_t>({0}) << ({1}))")
784
+ def shl_wrap(x: Int32, n: Int32) -> Int32: ...
785
+ @staticmethod
786
+ @cpp_template("static_cast<int32_t>(static_cast<uint32_t>({0}) >> ({1}))")
787
+ def shr_wrap(x: Int32, n: Int32) -> Int32: ...
788
+ @cpp_template("::tpy::BigInt({self})")
789
+ def __int__(self) -> int: ...
790
+ @cpp_template("::tpy::add_check<int32_t>({self}, {0})")
791
+ def __add__(self, other: Int32) -> Int32: ...
792
+ @cpp_template("::tpy::sub_check<int32_t>({self}, {0})")
793
+ def __sub__(self, other: Int32) -> Int32: ...
794
+ @cpp_template("::tpy::mul_check<int32_t>({self}, {0})")
795
+ def __mul__(self, other: Int32) -> Int32: ...
796
+ @cpp_template("::tpy::truediv(static_cast<double>({self}), static_cast<double>({0}))")
797
+ def __truediv__(self, other: Int32) -> float: ...
798
+ @cpp_template("::tpy::div_check<int32_t>({self}, {0})")
799
+ def __floordiv__(self, other: Int32) -> Int32: ...
800
+ @cpp_template("::tpy::mod_check<int32_t>({self}, {0})")
801
+ def __mod__(self, other: Int32) -> Int32: ...
802
+ @cpp_template("::tpy::pow_check<int32_t>({self}, {0})")
803
+ def __pow__(self, other: Int32) -> Int32: ...
804
+ @cpp_template("::tpy::lshift_check<int32_t>({self}, {0})")
805
+ def __lshift__(self, other: Int32) -> Int32: ...
806
+ @cpp_template("::tpy::rshift_check<int32_t>({self}, {0})")
807
+ def __rshift__(self, other: Int32) -> Int32: ...
808
+ @cpp_template("static_cast<int32_t>({self} & {0})")
809
+ def __and__(self, other: Int32) -> Int32: ...
810
+ @cpp_template("static_cast<int32_t>({self} | {0})")
811
+ def __or__(self, other: Int32) -> Int32: ...
812
+ @cpp_template("static_cast<int32_t>({self} ^ {0})")
813
+ def __xor__(self, other: Int32) -> Int32: ...
814
+ @cpp_template("::tpy::add_check<int32_t>({0}, {self})")
815
+ def __radd__(self, other: Int32) -> Int32: ...
816
+ @cpp_template("::tpy::sub_check<int32_t>({0}, {self})")
817
+ def __rsub__(self, other: Int32) -> Int32: ...
818
+ @cpp_template("::tpy::mul_check<int32_t>({0}, {self})")
819
+ def __rmul__(self, other: Int32) -> Int32: ...
820
+ @cpp_template("::tpy::truediv(static_cast<double>({0}), static_cast<double>({self}))")
821
+ def __rtruediv__(self, other: Int32) -> float: ...
822
+ @cpp_template("::tpy::div_check<int32_t>({0}, {self})")
823
+ def __rfloordiv__(self, other: Int32) -> Int32: ...
824
+ @cpp_template("::tpy::mod_check<int32_t>({0}, {self})")
825
+ def __rmod__(self, other: Int32) -> Int32: ...
826
+ @cpp_template("::tpy::pow_check<int32_t>({0}, {self})")
827
+ def __rpow__(self, other: Int32) -> Int32: ...
828
+ @cpp_template("::tpy::lshift_check<int32_t>({0}, {self})")
829
+ def __rlshift__(self, other: Int32) -> Int32: ...
830
+ @cpp_template("::tpy::rshift_check<int32_t>({0}, {self})")
831
+ def __rrshift__(self, other: Int32) -> Int32: ...
832
+ @cpp_template("static_cast<int32_t>({0} & {self})")
833
+ def __rand__(self, other: Int32) -> Int32: ...
834
+ @cpp_template("static_cast<int32_t>({0} | {self})")
835
+ def __ror__(self, other: Int32) -> Int32: ...
836
+ @cpp_template("static_cast<int32_t>({0} ^ {self})")
837
+ def __rxor__(self, other: Int32) -> Int32: ...
838
+ @cpp_template("static_cast<int32_t>(~({self}))")
839
+ def __invert__(self) -> Int32: ...
840
+ @cpp_template("+{self}")
841
+ def __pos__(self) -> Int32: ...
842
+ @cpp_template("::tpy::neg_check<int32_t>({self})")
843
+ def __neg__(self) -> Int32: ...
844
+ @cpp_template("({self} != 0)")
845
+ @readonly
846
+ @pure
847
+ def __bool__(self) -> bool: ...
848
+ @cpp_template("{self} == {0}")
849
+ @readonly
850
+ @pure
851
+ def __eq__(self, other: Int32) -> bool: ...
852
+ @cpp_template("::tpy::__hash__({self})")
853
+ @readonly
854
+ @pure
855
+ def __hash__(self) -> UInt64: ...
856
+ @cpp_template("{self} < {0}")
857
+ @readonly
858
+ @pure
859
+ def __lt__(self, other: Int32) -> bool: ...
860
+
861
+
862
+ @builtin_type("tpy.Int64")
863
+ @native("int64_t")
864
+ class Int64(Comparable, Equatable, AnyFixedInt, AnyFixedSigned):
865
+ @overload
866
+ @cpp_template("0")
867
+ def __init__(self) -> None: ...
868
+ @overload
869
+ @cpp_template("{0}")
870
+ def __init__(self, x: Int64) -> None: ...
871
+ @overload
872
+ @cpp_template("::tpy::int_cast_check<{cpp}>({0})")
873
+ def __init__[T: AnyFixedInt](self, x: T) -> None: ...
874
+ @overload
875
+ @cpp_template("({0}).to_fixed_check<{cpp}>()")
876
+ def __init__(self, x: int) -> None: ...
877
+ @overload
878
+ @cpp_template("::tpy::from_float_check<{cpp}>({0})")
879
+ def __init__(self, x: float) -> None: ...
880
+ @overload
881
+ @cpp_template("::tpy::from_float_check<{cpp}>(static_cast<double>({0}))")
882
+ def __init__(self, x: Float32) -> None: ...
883
+ @overload
884
+ @cpp_template("::tpy::from_str_check<{cpp}>({0})")
885
+ def __init__(self, x: str) -> None: ...
886
+ @overload
887
+ @cpp_template("static_cast<{cpp}>({0})")
888
+ def __init__(self, x: bool) -> None: ...
889
+ @overload
890
+ @staticmethod
891
+ @cpp_template("static_cast<int64_t>({0})")
892
+ def trunc[T: AnyFixedInt](x: T) -> Int64: ...
893
+ @overload
894
+ @staticmethod
895
+ @cpp_template("({0}).to_fixed_trunc<int64_t>()")
896
+ def trunc(x: int) -> Int64: ...
897
+ @staticmethod
898
+ @cpp_template("static_cast<int64_t>(static_cast<uint64_t>({0}) + static_cast<uint64_t>({1}))")
899
+ def add_wrap(x: Int64, y: Int64) -> Int64: ...
900
+ @staticmethod
901
+ @cpp_template("static_cast<int64_t>(static_cast<uint64_t>({0}) - static_cast<uint64_t>({1}))")
902
+ def sub_wrap(x: Int64, y: Int64) -> Int64: ...
903
+ @staticmethod
904
+ @cpp_template("static_cast<int64_t>(static_cast<uint64_t>({0}) * static_cast<uint64_t>({1}))")
905
+ def mul_wrap(x: Int64, y: Int64) -> Int64: ...
906
+ @staticmethod
907
+ @cpp_template("static_cast<int64_t>(static_cast<uint64_t>({0}) << ({1}))")
908
+ def shl_wrap(x: Int64, n: Int64) -> Int64: ...
909
+ @staticmethod
910
+ @cpp_template("static_cast<int64_t>(static_cast<uint64_t>({0}) >> ({1}))")
911
+ def shr_wrap(x: Int64, n: Int64) -> Int64: ...
912
+ @cpp_template("::tpy::BigInt({self})")
913
+ def __int__(self) -> int: ...
914
+ @cpp_template("::tpy::add_check<int64_t>({self}, {0})")
915
+ def __add__(self, other: Int64) -> Int64: ...
916
+ @cpp_template("::tpy::sub_check<int64_t>({self}, {0})")
917
+ def __sub__(self, other: Int64) -> Int64: ...
918
+ @cpp_template("::tpy::mul_check<int64_t>({self}, {0})")
919
+ def __mul__(self, other: Int64) -> Int64: ...
920
+ @cpp_template("::tpy::truediv(static_cast<double>({self}), static_cast<double>({0}))")
921
+ def __truediv__(self, other: Int64) -> float: ...
922
+ @cpp_template("::tpy::div_check<int64_t>({self}, {0})")
923
+ def __floordiv__(self, other: Int64) -> Int64: ...
924
+ @cpp_template("::tpy::mod_check<int64_t>({self}, {0})")
925
+ def __mod__(self, other: Int64) -> Int64: ...
926
+ @cpp_template("::tpy::pow_check<int64_t>({self}, {0})")
927
+ def __pow__(self, other: Int64) -> Int64: ...
928
+ @cpp_template("::tpy::lshift_check<int64_t>({self}, {0})")
929
+ def __lshift__(self, other: Int64) -> Int64: ...
930
+ @cpp_template("::tpy::rshift_check<int64_t>({self}, {0})")
931
+ def __rshift__(self, other: Int64) -> Int64: ...
932
+ @cpp_template("static_cast<int64_t>({self} & {0})")
933
+ def __and__(self, other: Int64) -> Int64: ...
934
+ @cpp_template("static_cast<int64_t>({self} | {0})")
935
+ def __or__(self, other: Int64) -> Int64: ...
936
+ @cpp_template("static_cast<int64_t>({self} ^ {0})")
937
+ def __xor__(self, other: Int64) -> Int64: ...
938
+ @cpp_template("::tpy::add_check<int64_t>({0}, {self})")
939
+ def __radd__(self, other: Int64) -> Int64: ...
940
+ @cpp_template("::tpy::sub_check<int64_t>({0}, {self})")
941
+ def __rsub__(self, other: Int64) -> Int64: ...
942
+ @cpp_template("::tpy::mul_check<int64_t>({0}, {self})")
943
+ def __rmul__(self, other: Int64) -> Int64: ...
944
+ @cpp_template("::tpy::truediv(static_cast<double>({0}), static_cast<double>({self}))")
945
+ def __rtruediv__(self, other: Int64) -> float: ...
946
+ @cpp_template("::tpy::div_check<int64_t>({0}, {self})")
947
+ def __rfloordiv__(self, other: Int64) -> Int64: ...
948
+ @cpp_template("::tpy::mod_check<int64_t>({0}, {self})")
949
+ def __rmod__(self, other: Int64) -> Int64: ...
950
+ @cpp_template("::tpy::pow_check<int64_t>({0}, {self})")
951
+ def __rpow__(self, other: Int64) -> Int64: ...
952
+ @cpp_template("::tpy::lshift_check<int64_t>({0}, {self})")
953
+ def __rlshift__(self, other: Int64) -> Int64: ...
954
+ @cpp_template("::tpy::rshift_check<int64_t>({0}, {self})")
955
+ def __rrshift__(self, other: Int64) -> Int64: ...
956
+ @cpp_template("static_cast<int64_t>({0} & {self})")
957
+ def __rand__(self, other: Int64) -> Int64: ...
958
+ @cpp_template("static_cast<int64_t>({0} | {self})")
959
+ def __ror__(self, other: Int64) -> Int64: ...
960
+ @cpp_template("static_cast<int64_t>({0} ^ {self})")
961
+ def __rxor__(self, other: Int64) -> Int64: ...
962
+ @cpp_template("static_cast<int64_t>(~({self}))")
963
+ def __invert__(self) -> Int64: ...
964
+ @cpp_template("+{self}")
965
+ def __pos__(self) -> Int64: ...
966
+ @cpp_template("::tpy::neg_check<int64_t>({self})")
967
+ def __neg__(self) -> Int64: ...
968
+ @cpp_template("({self} != 0)")
969
+ @readonly
970
+ @pure
971
+ def __bool__(self) -> bool: ...
972
+ @cpp_template("{self} == {0}")
973
+ @readonly
974
+ @pure
975
+ def __eq__(self, other: Int64) -> bool: ...
976
+ @cpp_template("::tpy::__hash__({self})")
977
+ @readonly
978
+ @pure
979
+ def __hash__(self) -> UInt64: ...
980
+ @cpp_template("{self} < {0}")
981
+ @readonly
982
+ @pure
983
+ def __lt__(self, other: Int64) -> bool: ...
984
+
985
+
986
+ @builtin_type("tpy.UInt8")
987
+ @native("uint8_t")
988
+ class UInt8(Comparable, Equatable, AnyFixedInt, AnyFixedUnsigned):
989
+ @overload
990
+ @cpp_template("0")
991
+ def __init__(self) -> None: ...
992
+ @overload
993
+ @cpp_template("{0}")
994
+ def __init__(self, x: UInt8) -> None: ...
995
+ @overload
996
+ @cpp_template("::tpy::int_cast_check<{cpp}>({0})")
997
+ def __init__[T: AnyFixedInt](self, x: T) -> None: ...
998
+ @overload
999
+ @cpp_template("({0}).to_fixed_check<{cpp}>()")
1000
+ def __init__(self, x: int) -> None: ...
1001
+ @overload
1002
+ @cpp_template("::tpy::from_float_check<{cpp}>({0})")
1003
+ def __init__(self, x: float) -> None: ...
1004
+ @overload
1005
+ @cpp_template("::tpy::from_float_check<{cpp}>(static_cast<double>({0}))")
1006
+ def __init__(self, x: Float32) -> None: ...
1007
+ @overload
1008
+ @cpp_template("::tpy::from_str_check<{cpp}>({0})")
1009
+ def __init__(self, x: str) -> None: ...
1010
+ @overload
1011
+ @cpp_template("static_cast<{cpp}>({0})")
1012
+ def __init__(self, x: bool) -> None: ...
1013
+ @overload
1014
+ @staticmethod
1015
+ @cpp_template("static_cast<uint8_t>({0})")
1016
+ def trunc[T: AnyFixedInt](x: T) -> UInt8: ...
1017
+ @overload
1018
+ @staticmethod
1019
+ @cpp_template("({0}).to_fixed_trunc<uint8_t>()")
1020
+ def trunc(x: int) -> UInt8: ...
1021
+ @staticmethod
1022
+ @cpp_template("static_cast<uint8_t>({0} + {1})")
1023
+ def add_wrap(x: UInt8, y: UInt8) -> UInt8: ...
1024
+ @staticmethod
1025
+ @cpp_template("static_cast<uint8_t>({0} - {1})")
1026
+ def sub_wrap(x: UInt8, y: UInt8) -> UInt8: ...
1027
+ @staticmethod
1028
+ @cpp_template("static_cast<uint8_t>({0} * {1})")
1029
+ def mul_wrap(x: UInt8, y: UInt8) -> UInt8: ...
1030
+ @staticmethod
1031
+ @cpp_template("static_cast<uint8_t>(static_cast<uint8_t>({0}) << ({1}))")
1032
+ def shl_wrap(x: UInt8, n: UInt8) -> UInt8: ...
1033
+ @staticmethod
1034
+ @cpp_template("static_cast<uint8_t>(static_cast<uint8_t>({0}) >> ({1}))")
1035
+ def shr_wrap(x: UInt8, n: UInt8) -> UInt8: ...
1036
+ @cpp_template("::tpy::BigInt({self})")
1037
+ def __int__(self) -> int: ...
1038
+ @cpp_template("::tpy::add_check<uint8_t>({self}, {0})")
1039
+ def __add__(self, other: UInt8) -> UInt8: ...
1040
+ @cpp_template("::tpy::sub_check<uint8_t>({self}, {0})")
1041
+ def __sub__(self, other: UInt8) -> UInt8: ...
1042
+ @cpp_template("::tpy::mul_check<uint8_t>({self}, {0})")
1043
+ def __mul__(self, other: UInt8) -> UInt8: ...
1044
+ @cpp_template("::tpy::truediv(static_cast<double>({self}), static_cast<double>({0}))")
1045
+ def __truediv__(self, other: UInt8) -> float: ...
1046
+ @cpp_template("::tpy::div_check<uint8_t>({self}, {0})")
1047
+ def __floordiv__(self, other: UInt8) -> UInt8: ...
1048
+ @cpp_template("::tpy::mod_check<uint8_t>({self}, {0})")
1049
+ def __mod__(self, other: UInt8) -> UInt8: ...
1050
+ @cpp_template("::tpy::pow_check<uint8_t>({self}, {0})")
1051
+ def __pow__(self, other: UInt8) -> UInt8: ...
1052
+ @cpp_template("::tpy::lshift_check<uint8_t>({self}, {0})")
1053
+ def __lshift__(self, other: UInt8) -> UInt8: ...
1054
+ @cpp_template("::tpy::rshift_check<uint8_t>({self}, {0})")
1055
+ def __rshift__(self, other: UInt8) -> UInt8: ...
1056
+ @cpp_template("static_cast<uint8_t>({self} & {0})")
1057
+ def __and__(self, other: UInt8) -> UInt8: ...
1058
+ @cpp_template("static_cast<uint8_t>({self} | {0})")
1059
+ def __or__(self, other: UInt8) -> UInt8: ...
1060
+ @cpp_template("static_cast<uint8_t>({self} ^ {0})")
1061
+ def __xor__(self, other: UInt8) -> UInt8: ...
1062
+ @cpp_template("::tpy::add_check<uint8_t>({0}, {self})")
1063
+ def __radd__(self, other: UInt8) -> UInt8: ...
1064
+ @cpp_template("::tpy::sub_check<uint8_t>({0}, {self})")
1065
+ def __rsub__(self, other: UInt8) -> UInt8: ...
1066
+ @cpp_template("::tpy::mul_check<uint8_t>({0}, {self})")
1067
+ def __rmul__(self, other: UInt8) -> UInt8: ...
1068
+ @cpp_template("::tpy::truediv(static_cast<double>({0}), static_cast<double>({self}))")
1069
+ def __rtruediv__(self, other: UInt8) -> float: ...
1070
+ @cpp_template("::tpy::div_check<uint8_t>({0}, {self})")
1071
+ def __rfloordiv__(self, other: UInt8) -> UInt8: ...
1072
+ @cpp_template("::tpy::mod_check<uint8_t>({0}, {self})")
1073
+ def __rmod__(self, other: UInt8) -> UInt8: ...
1074
+ @cpp_template("::tpy::pow_check<uint8_t>({0}, {self})")
1075
+ def __rpow__(self, other: UInt8) -> UInt8: ...
1076
+ @cpp_template("::tpy::lshift_check<uint8_t>({0}, {self})")
1077
+ def __rlshift__(self, other: UInt8) -> UInt8: ...
1078
+ @cpp_template("::tpy::rshift_check<uint8_t>({0}, {self})")
1079
+ def __rrshift__(self, other: UInt8) -> UInt8: ...
1080
+ @cpp_template("static_cast<uint8_t>({0} & {self})")
1081
+ def __rand__(self, other: UInt8) -> UInt8: ...
1082
+ @cpp_template("static_cast<uint8_t>({0} | {self})")
1083
+ def __ror__(self, other: UInt8) -> UInt8: ...
1084
+ @cpp_template("static_cast<uint8_t>({0} ^ {self})")
1085
+ def __rxor__(self, other: UInt8) -> UInt8: ...
1086
+ @cpp_template("static_cast<uint8_t>(~({self}))")
1087
+ def __invert__(self) -> UInt8: ...
1088
+ @cpp_template("+{self}")
1089
+ def __pos__(self) -> UInt8: ...
1090
+ @cpp_template("({self} != 0)")
1091
+ @readonly
1092
+ @pure
1093
+ def __bool__(self) -> bool: ...
1094
+ @cpp_template("{self} == {0}")
1095
+ @readonly
1096
+ @pure
1097
+ def __eq__(self, other: UInt8) -> bool: ...
1098
+ @cpp_template("::tpy::__hash__({self})")
1099
+ @readonly
1100
+ @pure
1101
+ def __hash__(self) -> UInt64: ...
1102
+ @cpp_template("{self} < {0}")
1103
+ @readonly
1104
+ @pure
1105
+ def __lt__(self, other: UInt8) -> bool: ...
1106
+
1107
+
1108
+ @builtin_type("tpy.UInt16")
1109
+ @native("uint16_t")
1110
+ class UInt16(Comparable, Equatable, AnyFixedInt, AnyFixedUnsigned):
1111
+ @overload
1112
+ @cpp_template("0")
1113
+ def __init__(self) -> None: ...
1114
+ @overload
1115
+ @cpp_template("{0}")
1116
+ def __init__(self, x: UInt16) -> None: ...
1117
+ @overload
1118
+ @cpp_template("::tpy::int_cast_check<{cpp}>({0})")
1119
+ def __init__[T: AnyFixedInt](self, x: T) -> None: ...
1120
+ @overload
1121
+ @cpp_template("({0}).to_fixed_check<{cpp}>()")
1122
+ def __init__(self, x: int) -> None: ...
1123
+ @overload
1124
+ @cpp_template("::tpy::from_float_check<{cpp}>({0})")
1125
+ def __init__(self, x: float) -> None: ...
1126
+ @overload
1127
+ @cpp_template("::tpy::from_float_check<{cpp}>(static_cast<double>({0}))")
1128
+ def __init__(self, x: Float32) -> None: ...
1129
+ @overload
1130
+ @cpp_template("::tpy::from_str_check<{cpp}>({0})")
1131
+ def __init__(self, x: str) -> None: ...
1132
+ @overload
1133
+ @cpp_template("static_cast<{cpp}>({0})")
1134
+ def __init__(self, x: bool) -> None: ...
1135
+ @overload
1136
+ @staticmethod
1137
+ @cpp_template("static_cast<uint16_t>({0})")
1138
+ def trunc[T: AnyFixedInt](x: T) -> UInt16: ...
1139
+ @overload
1140
+ @staticmethod
1141
+ @cpp_template("({0}).to_fixed_trunc<uint16_t>()")
1142
+ def trunc(x: int) -> UInt16: ...
1143
+ @staticmethod
1144
+ @cpp_template("static_cast<uint16_t>({0} + {1})")
1145
+ def add_wrap(x: UInt16, y: UInt16) -> UInt16: ...
1146
+ @staticmethod
1147
+ @cpp_template("static_cast<uint16_t>({0} - {1})")
1148
+ def sub_wrap(x: UInt16, y: UInt16) -> UInt16: ...
1149
+ @staticmethod
1150
+ @cpp_template("static_cast<uint16_t>({0} * {1})")
1151
+ def mul_wrap(x: UInt16, y: UInt16) -> UInt16: ...
1152
+ @staticmethod
1153
+ @cpp_template("static_cast<uint16_t>(static_cast<uint16_t>({0}) << ({1}))")
1154
+ def shl_wrap(x: UInt16, n: UInt16) -> UInt16: ...
1155
+ @staticmethod
1156
+ @cpp_template("static_cast<uint16_t>(static_cast<uint16_t>({0}) >> ({1}))")
1157
+ def shr_wrap(x: UInt16, n: UInt16) -> UInt16: ...
1158
+ @cpp_template("::tpy::BigInt({self})")
1159
+ def __int__(self) -> int: ...
1160
+ @cpp_template("::tpy::add_check<uint16_t>({self}, {0})")
1161
+ def __add__(self, other: UInt16) -> UInt16: ...
1162
+ @cpp_template("::tpy::sub_check<uint16_t>({self}, {0})")
1163
+ def __sub__(self, other: UInt16) -> UInt16: ...
1164
+ @cpp_template("::tpy::mul_check<uint16_t>({self}, {0})")
1165
+ def __mul__(self, other: UInt16) -> UInt16: ...
1166
+ @cpp_template("::tpy::truediv(static_cast<double>({self}), static_cast<double>({0}))")
1167
+ def __truediv__(self, other: UInt16) -> float: ...
1168
+ @cpp_template("::tpy::div_check<uint16_t>({self}, {0})")
1169
+ def __floordiv__(self, other: UInt16) -> UInt16: ...
1170
+ @cpp_template("::tpy::mod_check<uint16_t>({self}, {0})")
1171
+ def __mod__(self, other: UInt16) -> UInt16: ...
1172
+ @cpp_template("::tpy::pow_check<uint16_t>({self}, {0})")
1173
+ def __pow__(self, other: UInt16) -> UInt16: ...
1174
+ @cpp_template("::tpy::lshift_check<uint16_t>({self}, {0})")
1175
+ def __lshift__(self, other: UInt16) -> UInt16: ...
1176
+ @cpp_template("::tpy::rshift_check<uint16_t>({self}, {0})")
1177
+ def __rshift__(self, other: UInt16) -> UInt16: ...
1178
+ @cpp_template("static_cast<uint16_t>({self} & {0})")
1179
+ def __and__(self, other: UInt16) -> UInt16: ...
1180
+ @cpp_template("static_cast<uint16_t>({self} | {0})")
1181
+ def __or__(self, other: UInt16) -> UInt16: ...
1182
+ @cpp_template("static_cast<uint16_t>({self} ^ {0})")
1183
+ def __xor__(self, other: UInt16) -> UInt16: ...
1184
+ @cpp_template("::tpy::add_check<uint16_t>({0}, {self})")
1185
+ def __radd__(self, other: UInt16) -> UInt16: ...
1186
+ @cpp_template("::tpy::sub_check<uint16_t>({0}, {self})")
1187
+ def __rsub__(self, other: UInt16) -> UInt16: ...
1188
+ @cpp_template("::tpy::mul_check<uint16_t>({0}, {self})")
1189
+ def __rmul__(self, other: UInt16) -> UInt16: ...
1190
+ @cpp_template("::tpy::truediv(static_cast<double>({0}), static_cast<double>({self}))")
1191
+ def __rtruediv__(self, other: UInt16) -> float: ...
1192
+ @cpp_template("::tpy::div_check<uint16_t>({0}, {self})")
1193
+ def __rfloordiv__(self, other: UInt16) -> UInt16: ...
1194
+ @cpp_template("::tpy::mod_check<uint16_t>({0}, {self})")
1195
+ def __rmod__(self, other: UInt16) -> UInt16: ...
1196
+ @cpp_template("::tpy::pow_check<uint16_t>({0}, {self})")
1197
+ def __rpow__(self, other: UInt16) -> UInt16: ...
1198
+ @cpp_template("::tpy::lshift_check<uint16_t>({0}, {self})")
1199
+ def __rlshift__(self, other: UInt16) -> UInt16: ...
1200
+ @cpp_template("::tpy::rshift_check<uint16_t>({0}, {self})")
1201
+ def __rrshift__(self, other: UInt16) -> UInt16: ...
1202
+ @cpp_template("static_cast<uint16_t>({0} & {self})")
1203
+ def __rand__(self, other: UInt16) -> UInt16: ...
1204
+ @cpp_template("static_cast<uint16_t>({0} | {self})")
1205
+ def __ror__(self, other: UInt16) -> UInt16: ...
1206
+ @cpp_template("static_cast<uint16_t>({0} ^ {self})")
1207
+ def __rxor__(self, other: UInt16) -> UInt16: ...
1208
+ @cpp_template("static_cast<uint16_t>(~({self}))")
1209
+ def __invert__(self) -> UInt16: ...
1210
+ @cpp_template("+{self}")
1211
+ def __pos__(self) -> UInt16: ...
1212
+ @cpp_template("({self} != 0)")
1213
+ @readonly
1214
+ @pure
1215
+ def __bool__(self) -> bool: ...
1216
+ @cpp_template("{self} == {0}")
1217
+ @readonly
1218
+ @pure
1219
+ def __eq__(self, other: UInt16) -> bool: ...
1220
+ @cpp_template("::tpy::__hash__({self})")
1221
+ @readonly
1222
+ @pure
1223
+ def __hash__(self) -> UInt64: ...
1224
+ @cpp_template("{self} < {0}")
1225
+ @readonly
1226
+ @pure
1227
+ def __lt__(self, other: UInt16) -> bool: ...
1228
+
1229
+
1230
+ @builtin_type("tpy.UInt32")
1231
+ @native("uint32_t")
1232
+ class UInt32(Comparable, Equatable, AnyFixedInt, AnyFixedUnsigned):
1233
+ @overload
1234
+ @cpp_template("0")
1235
+ def __init__(self) -> None: ...
1236
+ @overload
1237
+ @cpp_template("{0}")
1238
+ def __init__(self, x: UInt32) -> None: ...
1239
+ @overload
1240
+ @cpp_template("::tpy::int_cast_check<{cpp}>({0})")
1241
+ def __init__[T: AnyFixedInt](self, x: T) -> None: ...
1242
+ @overload
1243
+ @cpp_template("({0}).to_fixed_check<{cpp}>()")
1244
+ def __init__(self, x: int) -> None: ...
1245
+ @overload
1246
+ @cpp_template("::tpy::from_float_check<{cpp}>({0})")
1247
+ def __init__(self, x: float) -> None: ...
1248
+ @overload
1249
+ @cpp_template("::tpy::from_float_check<{cpp}>(static_cast<double>({0}))")
1250
+ def __init__(self, x: Float32) -> None: ...
1251
+ @overload
1252
+ @cpp_template("::tpy::from_str_check<{cpp}>({0})")
1253
+ def __init__(self, x: str) -> None: ...
1254
+ @overload
1255
+ @cpp_template("static_cast<{cpp}>({0})")
1256
+ def __init__(self, x: bool) -> None: ...
1257
+ @overload
1258
+ @staticmethod
1259
+ @cpp_template("static_cast<uint32_t>({0})")
1260
+ def trunc[T: AnyFixedInt](x: T) -> UInt32: ...
1261
+ @overload
1262
+ @staticmethod
1263
+ @cpp_template("({0}).to_fixed_trunc<uint32_t>()")
1264
+ def trunc(x: int) -> UInt32: ...
1265
+ # Wrapping arithmetic: mod 2^32. No overflow check (unlike +, -, *).
1266
+ @staticmethod
1267
+ @cpp_template("static_cast<uint32_t>({0} + {1})")
1268
+ def add_wrap(x: UInt32, y: UInt32) -> UInt32: ...
1269
+ @staticmethod
1270
+ @cpp_template("static_cast<uint32_t>({0} - {1})")
1271
+ def sub_wrap(x: UInt32, y: UInt32) -> UInt32: ...
1272
+ @staticmethod
1273
+ @cpp_template("static_cast<uint32_t>({0} * {1})")
1274
+ def mul_wrap(x: UInt32, y: UInt32) -> UInt32: ...
1275
+ # Inner LHS cast forces the shift at target unsigned width. Without
1276
+ # it, a bare int literal {0} (e.g. shl_wrap(1, 31)) would shift as
1277
+ # signed int -- UB for UInt32 (1 << 31 overflows signed int) and
1278
+ # -Wshift-count-overflow for UInt64 (count >= int width).
1279
+ @staticmethod
1280
+ @cpp_template("static_cast<uint32_t>(static_cast<uint32_t>({0}) << ({1}))")
1281
+ def shl_wrap(x: UInt32, n: UInt32) -> UInt32: ...
1282
+ @staticmethod
1283
+ @cpp_template("static_cast<uint32_t>(static_cast<uint32_t>({0}) >> ({1}))")
1284
+ def shr_wrap(x: UInt32, n: UInt32) -> UInt32: ...
1285
+ @cpp_template("::tpy::BigInt({self})")
1286
+ def __int__(self) -> int: ...
1287
+ @cpp_template("::tpy::add_check<uint32_t>({self}, {0})")
1288
+ def __add__(self, other: UInt32) -> UInt32: ...
1289
+ @cpp_template("::tpy::sub_check<uint32_t>({self}, {0})")
1290
+ def __sub__(self, other: UInt32) -> UInt32: ...
1291
+ @cpp_template("::tpy::mul_check<uint32_t>({self}, {0})")
1292
+ def __mul__(self, other: UInt32) -> UInt32: ...
1293
+ @cpp_template("::tpy::truediv(static_cast<double>({self}), static_cast<double>({0}))")
1294
+ def __truediv__(self, other: UInt32) -> float: ...
1295
+ @cpp_template("::tpy::div_check<uint32_t>({self}, {0})")
1296
+ def __floordiv__(self, other: UInt32) -> UInt32: ...
1297
+ @cpp_template("::tpy::mod_check<uint32_t>({self}, {0})")
1298
+ def __mod__(self, other: UInt32) -> UInt32: ...
1299
+ @cpp_template("::tpy::pow_check<uint32_t>({self}, {0})")
1300
+ def __pow__(self, other: UInt32) -> UInt32: ...
1301
+ @cpp_template("::tpy::lshift_check<uint32_t>({self}, {0})")
1302
+ def __lshift__(self, other: UInt32) -> UInt32: ...
1303
+ @cpp_template("::tpy::rshift_check<uint32_t>({self}, {0})")
1304
+ def __rshift__(self, other: UInt32) -> UInt32: ...
1305
+ @cpp_template("static_cast<uint32_t>({self} & {0})")
1306
+ def __and__(self, other: UInt32) -> UInt32: ...
1307
+ @cpp_template("static_cast<uint32_t>({self} | {0})")
1308
+ def __or__(self, other: UInt32) -> UInt32: ...
1309
+ @cpp_template("static_cast<uint32_t>({self} ^ {0})")
1310
+ def __xor__(self, other: UInt32) -> UInt32: ...
1311
+ @cpp_template("::tpy::add_check<uint32_t>({0}, {self})")
1312
+ def __radd__(self, other: UInt32) -> UInt32: ...
1313
+ @cpp_template("::tpy::sub_check<uint32_t>({0}, {self})")
1314
+ def __rsub__(self, other: UInt32) -> UInt32: ...
1315
+ @cpp_template("::tpy::mul_check<uint32_t>({0}, {self})")
1316
+ def __rmul__(self, other: UInt32) -> UInt32: ...
1317
+ @cpp_template("::tpy::truediv(static_cast<double>({0}), static_cast<double>({self}))")
1318
+ def __rtruediv__(self, other: UInt32) -> float: ...
1319
+ @cpp_template("::tpy::div_check<uint32_t>({0}, {self})")
1320
+ def __rfloordiv__(self, other: UInt32) -> UInt32: ...
1321
+ @cpp_template("::tpy::mod_check<uint32_t>({0}, {self})")
1322
+ def __rmod__(self, other: UInt32) -> UInt32: ...
1323
+ @cpp_template("::tpy::pow_check<uint32_t>({0}, {self})")
1324
+ def __rpow__(self, other: UInt32) -> UInt32: ...
1325
+ @cpp_template("::tpy::lshift_check<uint32_t>({0}, {self})")
1326
+ def __rlshift__(self, other: UInt32) -> UInt32: ...
1327
+ @cpp_template("::tpy::rshift_check<uint32_t>({0}, {self})")
1328
+ def __rrshift__(self, other: UInt32) -> UInt32: ...
1329
+ @cpp_template("static_cast<uint32_t>({0} & {self})")
1330
+ def __rand__(self, other: UInt32) -> UInt32: ...
1331
+ @cpp_template("static_cast<uint32_t>({0} | {self})")
1332
+ def __ror__(self, other: UInt32) -> UInt32: ...
1333
+ @cpp_template("static_cast<uint32_t>({0} ^ {self})")
1334
+ def __rxor__(self, other: UInt32) -> UInt32: ...
1335
+ @cpp_template("static_cast<uint32_t>(~({self}))")
1336
+ def __invert__(self) -> UInt32: ...
1337
+ @cpp_template("+{self}")
1338
+ def __pos__(self) -> UInt32: ...
1339
+ @cpp_template("({self} != 0)")
1340
+ @readonly
1341
+ @pure
1342
+ def __bool__(self) -> bool: ...
1343
+ @cpp_template("{self} == {0}")
1344
+ @readonly
1345
+ @pure
1346
+ def __eq__(self, other: UInt32) -> bool: ...
1347
+ @cpp_template("::tpy::__hash__({self})")
1348
+ @readonly
1349
+ @pure
1350
+ def __hash__(self) -> UInt64: ...
1351
+ @cpp_template("{self} < {0}")
1352
+ @readonly
1353
+ @pure
1354
+ def __lt__(self, other: UInt32) -> bool: ...
1355
+
1356
+
1357
+ @builtin_type("tpy.UInt64")
1358
+ @native("uint64_t")
1359
+ class UInt64(Comparable, Equatable, AnyFixedInt, AnyFixedUnsigned):
1360
+ @overload
1361
+ @cpp_template("0")
1362
+ def __init__(self) -> None: ...
1363
+ @overload
1364
+ @cpp_template("{0}")
1365
+ def __init__(self, x: UInt64) -> None: ...
1366
+ @overload
1367
+ @cpp_template("::tpy::int_cast_check<{cpp}>({0})")
1368
+ def __init__[T: AnyFixedInt](self, x: T) -> None: ...
1369
+ @overload
1370
+ @cpp_template("({0}).to_fixed_check<{cpp}>()")
1371
+ def __init__(self, x: int) -> None: ...
1372
+ @overload
1373
+ @cpp_template("::tpy::from_float_check<{cpp}>({0})")
1374
+ def __init__(self, x: float) -> None: ...
1375
+ @overload
1376
+ @cpp_template("::tpy::from_float_check<{cpp}>(static_cast<double>({0}))")
1377
+ def __init__(self, x: Float32) -> None: ...
1378
+ @overload
1379
+ @cpp_template("::tpy::from_str_check<{cpp}>({0})")
1380
+ def __init__(self, x: str) -> None: ...
1381
+ @overload
1382
+ @cpp_template("static_cast<{cpp}>({0})")
1383
+ def __init__(self, x: bool) -> None: ...
1384
+ @overload
1385
+ @staticmethod
1386
+ @cpp_template("static_cast<uint64_t>({0})")
1387
+ def trunc[T: AnyFixedInt](x: T) -> UInt64: ...
1388
+ @overload
1389
+ @staticmethod
1390
+ @cpp_template("({0}).to_fixed_trunc<uint64_t>()")
1391
+ def trunc(x: int) -> UInt64: ...
1392
+ @staticmethod
1393
+ @cpp_template("static_cast<uint64_t>({0} + {1})")
1394
+ def add_wrap(x: UInt64, y: UInt64) -> UInt64: ...
1395
+ @staticmethod
1396
+ @cpp_template("static_cast<uint64_t>({0} - {1})")
1397
+ def sub_wrap(x: UInt64, y: UInt64) -> UInt64: ...
1398
+ @staticmethod
1399
+ @cpp_template("static_cast<uint64_t>({0} * {1})")
1400
+ def mul_wrap(x: UInt64, y: UInt64) -> UInt64: ...
1401
+ @staticmethod
1402
+ @cpp_template("static_cast<uint64_t>(static_cast<uint64_t>({0}) << ({1}))")
1403
+ def shl_wrap(x: UInt64, n: UInt64) -> UInt64: ...
1404
+ @staticmethod
1405
+ @cpp_template("static_cast<uint64_t>(static_cast<uint64_t>({0}) >> ({1}))")
1406
+ def shr_wrap(x: UInt64, n: UInt64) -> UInt64: ...
1407
+ @cpp_template("::tpy::BigInt({self})")
1408
+ def __int__(self) -> int: ...
1409
+ @cpp_template("::tpy::add_check<uint64_t>({self}, {0})")
1410
+ def __add__(self, other: UInt64) -> UInt64: ...
1411
+ @cpp_template("::tpy::sub_check<uint64_t>({self}, {0})")
1412
+ def __sub__(self, other: UInt64) -> UInt64: ...
1413
+ @cpp_template("::tpy::mul_check<uint64_t>({self}, {0})")
1414
+ def __mul__(self, other: UInt64) -> UInt64: ...
1415
+ @cpp_template("::tpy::truediv(static_cast<double>({self}), static_cast<double>({0}))")
1416
+ def __truediv__(self, other: UInt64) -> float: ...
1417
+ @cpp_template("::tpy::div_check<uint64_t>({self}, {0})")
1418
+ def __floordiv__(self, other: UInt64) -> UInt64: ...
1419
+ @cpp_template("::tpy::mod_check<uint64_t>({self}, {0})")
1420
+ def __mod__(self, other: UInt64) -> UInt64: ...
1421
+ @cpp_template("::tpy::pow_check<uint64_t>({self}, {0})")
1422
+ def __pow__(self, other: UInt64) -> UInt64: ...
1423
+ @cpp_template("::tpy::lshift_check<uint64_t>({self}, {0})")
1424
+ def __lshift__(self, other: UInt64) -> UInt64: ...
1425
+ @cpp_template("::tpy::rshift_check<uint64_t>({self}, {0})")
1426
+ def __rshift__(self, other: UInt64) -> UInt64: ...
1427
+ @cpp_template("static_cast<uint64_t>({self} & {0})")
1428
+ def __and__(self, other: UInt64) -> UInt64: ...
1429
+ @cpp_template("static_cast<uint64_t>({self} | {0})")
1430
+ def __or__(self, other: UInt64) -> UInt64: ...
1431
+ @cpp_template("static_cast<uint64_t>({self} ^ {0})")
1432
+ def __xor__(self, other: UInt64) -> UInt64: ...
1433
+ @cpp_template("::tpy::add_check<uint64_t>({0}, {self})")
1434
+ def __radd__(self, other: UInt64) -> UInt64: ...
1435
+ @cpp_template("::tpy::sub_check<uint64_t>({0}, {self})")
1436
+ def __rsub__(self, other: UInt64) -> UInt64: ...
1437
+ @cpp_template("::tpy::mul_check<uint64_t>({0}, {self})")
1438
+ def __rmul__(self, other: UInt64) -> UInt64: ...
1439
+ @cpp_template("::tpy::truediv(static_cast<double>({0}), static_cast<double>({self}))")
1440
+ def __rtruediv__(self, other: UInt64) -> float: ...
1441
+ @cpp_template("::tpy::div_check<uint64_t>({0}, {self})")
1442
+ def __rfloordiv__(self, other: UInt64) -> UInt64: ...
1443
+ @cpp_template("::tpy::mod_check<uint64_t>({0}, {self})")
1444
+ def __rmod__(self, other: UInt64) -> UInt64: ...
1445
+ @cpp_template("::tpy::pow_check<uint64_t>({0}, {self})")
1446
+ def __rpow__(self, other: UInt64) -> UInt64: ...
1447
+ @cpp_template("::tpy::lshift_check<uint64_t>({0}, {self})")
1448
+ def __rlshift__(self, other: UInt64) -> UInt64: ...
1449
+ @cpp_template("::tpy::rshift_check<uint64_t>({0}, {self})")
1450
+ def __rrshift__(self, other: UInt64) -> UInt64: ...
1451
+ @cpp_template("static_cast<uint64_t>({0} & {self})")
1452
+ def __rand__(self, other: UInt64) -> UInt64: ...
1453
+ @cpp_template("static_cast<uint64_t>({0} | {self})")
1454
+ def __ror__(self, other: UInt64) -> UInt64: ...
1455
+ @cpp_template("static_cast<uint64_t>({0} ^ {self})")
1456
+ def __rxor__(self, other: UInt64) -> UInt64: ...
1457
+ @cpp_template("static_cast<uint64_t>(~({self}))")
1458
+ def __invert__(self) -> UInt64: ...
1459
+ @cpp_template("+{self}")
1460
+ def __pos__(self) -> UInt64: ...
1461
+ @cpp_template("({self} != 0)")
1462
+ @readonly
1463
+ @pure
1464
+ def __bool__(self) -> bool: ...
1465
+ @cpp_template("{self} == {0}")
1466
+ @readonly
1467
+ @pure
1468
+ def __eq__(self, other: UInt64) -> bool: ...
1469
+ @cpp_template("::tpy::__hash__({self})")
1470
+ @readonly
1471
+ @pure
1472
+ def __hash__(self) -> UInt64: ...
1473
+ @cpp_template("{self} < {0}")
1474
+ @readonly
1475
+ @pure
1476
+ def __lt__(self, other: UInt64) -> bool: ...
1477
+
1478
+
1479
+ @builtin_type("tpy.Char")
1480
+ @native("char")
1481
+ class Char(Sized, Equatable):
1482
+ @overload
1483
+ @cpp_template("'\\0'")
1484
+ def __init__(self) -> None: ...
1485
+ @overload
1486
+ @cpp_template("static_cast<char>({0})")
1487
+ def __init__(self, x: Int32) -> None: ...
1488
+ @overload
1489
+ @cpp_template("static_cast<char>(({0}).to_fixed_check<int32_t>())")
1490
+ def __init__(self, x: int) -> None: ...
1491
+ @overload
1492
+ @native("tpy::char_from_str", function=True)
1493
+ def __init__(self, x: str) -> None: ...
1494
+ @overload
1495
+ @native("tpy::char_from_str", function=True)
1496
+ def __init__(self, x: String) -> None: ...
1497
+ @overload
1498
+ @native("tpy::char_from_str", function=True)
1499
+ def __init__(self, x: StrView) -> None: ...
1500
+
1501
+ @cpp_template("::tpy::__hash__({self})")
1502
+ @readonly
1503
+ @pure
1504
+ def __hash__(self) -> UInt64: ...
1505
+
1506
+ @overload
1507
+ @cpp_template("::tpy::str_concat(::tpy::char_to_str({self}), ::tpy::char_to_str({0}))")
1508
+ @readonly
1509
+ def __add__(self, other: Char) -> String: ...
1510
+ @overload
1511
+ @cpp_template("::tpy::str_concat(::tpy::char_to_str({self}), {0})")
1512
+ @readonly
1513
+ def __add__(self, other: str) -> String: ...
1514
+ @overload
1515
+ @cpp_template("::tpy::str_concat(::tpy::char_to_str({self}), {0})")
1516
+ @readonly
1517
+ def __add__(self, other: String) -> String: ...
1518
+ @overload
1519
+ @cpp_template("::tpy::str_concat(::tpy::char_to_str({self}), {0})")
1520
+ @readonly
1521
+ def __add__(self, other: StrView) -> String: ...
1522
+
1523
+ @cpp_template("::tpy::str_repeat(::tpy::char_to_str({self}), {0})")
1524
+ @readonly
1525
+ @pure
1526
+ def __mul__(self, n: Int32) -> str: ...
1527
+
1528
+ @cpp_template("::tpy::str_repeat(::tpy::char_to_str({self}), {0})")
1529
+ @readonly
1530
+ @pure
1531
+ def __rmul__(self, n: Int32) -> str: ...
1532
+
1533
+ @cpp_template("{self} == {0}")
1534
+ @readonly
1535
+ @pure
1536
+ def __eq__(self, other: Char) -> bool: ...
1537
+
1538
+ @cpp_template("1")
1539
+ @readonly
1540
+ @pure
1541
+ def __len__(self) -> Int32: ...
1542
+
1543
+
1544
+
1545
+ @builtin_type("tpy.String")
1546
+ @native("std::string")
1547
+ class String(NativeIterable[Char], Iterable[Char], Comparable, Equatable):
1548
+ @overload
1549
+ @cpp_template("std::string()")
1550
+ def __init__(self) -> None: ...
1551
+ @overload
1552
+ @cpp_template("std::string({0})")
1553
+ def __init__(self, x: str) -> None: ...
1554
+ @overload
1555
+ @cpp_template("std::string({0})")
1556
+ def __init__(self, x: String) -> None: ...
1557
+ @overload
1558
+ @cpp_template("std::string({0})")
1559
+ def __init__(self, x: StrView) -> None: ...
1560
+ @overload
1561
+ @cpp_template("std::string(::tpy::bool_to_str({0}))")
1562
+ def __init__(self, x: bool) -> None: ...
1563
+ @overload
1564
+ @cpp_template("std::string(::tpy::char_to_str({0}))")
1565
+ def __init__(self, x: Char) -> None: ...
1566
+ @overload
1567
+ @cpp_template("::tpy::fixed_to_str<int8_t>({0})")
1568
+ def __init__(self, x: Int8) -> None: ...
1569
+ @overload
1570
+ @cpp_template("::tpy::fixed_to_str<int16_t>({0})")
1571
+ def __init__(self, x: Int16) -> None: ...
1572
+ @overload
1573
+ @cpp_template("::tpy::fixed_to_str<int32_t>({0})")
1574
+ def __init__(self, x: Int32) -> None: ...
1575
+ @overload
1576
+ @cpp_template("::tpy::fixed_to_str<int64_t>({0})")
1577
+ def __init__(self, x: Int64) -> None: ...
1578
+ @overload
1579
+ @cpp_template("::tpy::fixed_to_str<uint8_t>({0})")
1580
+ def __init__(self, x: UInt8) -> None: ...
1581
+ @overload
1582
+ @cpp_template("::tpy::fixed_to_str<uint16_t>({0})")
1583
+ def __init__(self, x: UInt16) -> None: ...
1584
+ @overload
1585
+ @cpp_template("::tpy::fixed_to_str<uint32_t>({0})")
1586
+ def __init__(self, x: UInt32) -> None: ...
1587
+ @overload
1588
+ @cpp_template("::tpy::fixed_to_str<uint64_t>({0})")
1589
+ def __init__(self, x: UInt64) -> None: ...
1590
+ @overload
1591
+ @cpp_template("({0}).to_string()")
1592
+ def __init__(self, x: int) -> None: ...
1593
+ @overload
1594
+ @native("tpy::float_to_str", function=True)
1595
+ def __init__(self, x: float) -> None: ...
1596
+ @overload
1597
+ @cpp_template("::tpy::float_to_str(static_cast<double>({0}))")
1598
+ def __init__(self, x: Float32) -> None: ...
1599
+
1600
+ @cpp_template("::tpy::__iter__({self})")
1601
+ @readonly
1602
+ @pure
1603
+ def __iter__(self) -> Iterator[Char]: ...
1604
+
1605
+ @cpp_template("static_cast<int32_t>({self}.size())")
1606
+ @readonly
1607
+ @pure
1608
+ def __len__(self) -> Int32: ...
1609
+
1610
+ @overload
1611
+ @cpp_template("::tpy::__getitem__({self}, {0})")
1612
+ @readonly
1613
+ @pure
1614
+ def __getitem__(self, index: Int32) -> Char: ...
1615
+
1616
+ @overload
1617
+ @cpp_template("::tpy::str_slice({self}, {0})")
1618
+ @readonly
1619
+ @pure
1620
+ def __getitem__(self, index: basic_slice) -> StrView: ...
1621
+
1622
+ @overload
1623
+ @cpp_template("::tpy::str_stepped_slice({self}, {0})")
1624
+ @readonly
1625
+ @pure
1626
+ def __getitem__(self, index: slice) -> str: ...
1627
+
1628
+ @overload
1629
+ @cpp_template("::tpy::str_concat({self}, {0})")
1630
+ def __add__(self, other: str) -> String: ...
1631
+ @overload
1632
+ @cpp_template("::tpy::str_concat({self}, {0})")
1633
+ def __add__(self, other: String) -> String: ...
1634
+ @overload
1635
+ @cpp_template("::tpy::str_concat({self}, {0})")
1636
+ def __add__(self, other: StrView) -> String: ...
1637
+ @overload
1638
+ @cpp_template("::tpy::str_concat({self}, ::tpy::char_to_str({0}))")
1639
+ def __add__(self, other: Char) -> String: ...
1640
+
1641
+ @cpp_template("::tpy::str_repeat({self}, {0})")
1642
+ @readonly
1643
+ @pure
1644
+ def __mul__(self, n: Int32) -> str: ...
1645
+
1646
+ @cpp_template("::tpy::str_repeat({self}, {0})")
1647
+ @readonly
1648
+ @pure
1649
+ def __rmul__(self, n: Int32) -> str: ...
1650
+
1651
+ @overload
1652
+ @cpp_template("::tpy::str_split_whitespace({self})")
1653
+ @readonly
1654
+ @pure
1655
+ def split(self) -> Own[list[str]]: ...
1656
+ @overload
1657
+ @cpp_template("::tpy::str_split({self}, {0})")
1658
+ @readonly
1659
+ @pure
1660
+ def split(self, sep: str) -> Own[list[str]]: ...
1661
+ @overload
1662
+ @cpp_template("::tpy::str_split({self}, {0}, {1})")
1663
+ @readonly
1664
+ @pure
1665
+ def split(self, sep: str, maxsplit: Int32) -> Own[list[str]]: ...
1666
+
1667
+ @cpp_template("::tpy::str_join({self}, {0})")
1668
+ @readonly
1669
+ @pure
1670
+ def join(self, items: Iterable[str]) -> str: ...
1671
+
1672
+ @cpp_template("::tpy::str_strip({self})")
1673
+ @readonly
1674
+ @pure
1675
+ def strip(self) -> StrView: ...
1676
+
1677
+ @cpp_template("::tpy::str_lstrip({self})")
1678
+ @readonly
1679
+ @pure
1680
+ def lstrip(self) -> StrView: ...
1681
+
1682
+ @cpp_template("::tpy::str_rstrip({self})")
1683
+ @readonly
1684
+ @pure
1685
+ def rstrip(self) -> StrView: ...
1686
+
1687
+ @cpp_template("::tpy::str_replace({self}, {0}, {1})")
1688
+ @readonly
1689
+ @pure
1690
+ def replace(self, old: str, new: str) -> str: ...
1691
+
1692
+ @cpp_template("::tpy::str_find({self}, {0})")
1693
+ @readonly
1694
+ @pure
1695
+ def find(self, sub: str) -> Int32: ...
1696
+
1697
+ @cpp_template("::tpy::str_rfind({self}, {0})")
1698
+ @readonly
1699
+ @pure
1700
+ def rfind(self, sub: str) -> Int32: ...
1701
+
1702
+ @cpp_template("::tpy::str_index({self}, {0})")
1703
+ @readonly
1704
+ @pure
1705
+ def index(self, sub: str) -> Int32: ...
1706
+
1707
+ @cpp_template("::tpy::str_startswith({self}, {0})")
1708
+ @readonly
1709
+ @pure
1710
+ def startswith(self, prefix: str) -> bool: ...
1711
+
1712
+ @cpp_template("::tpy::str_endswith({self}, {0})")
1713
+ @readonly
1714
+ @pure
1715
+ def endswith(self, suffix: str) -> bool: ...
1716
+
1717
+ @cpp_template("::tpy::str_upper({self})")
1718
+ @readonly
1719
+ @pure
1720
+ def upper(self) -> str: ...
1721
+
1722
+ @cpp_template("::tpy::str_lower({self})")
1723
+ @readonly
1724
+ @pure
1725
+ def lower(self) -> str: ...
1726
+
1727
+ @cpp_template("::tpy::str_count({self}, {0})")
1728
+ @readonly
1729
+ @pure
1730
+ def count(self, sub: str) -> Int32: ...
1731
+
1732
+ @cpp_template("::tpy::str_isdigit({self})")
1733
+ @readonly
1734
+ @pure
1735
+ def isdigit(self) -> bool: ...
1736
+
1737
+ @cpp_template("::tpy::str_isalpha({self})")
1738
+ @readonly
1739
+ @pure
1740
+ def isalpha(self) -> bool: ...
1741
+
1742
+ @cpp_template("::tpy::str_isalnum({self})")
1743
+ @readonly
1744
+ @pure
1745
+ def isalnum(self) -> bool: ...
1746
+
1747
+ @cpp_template("::tpy::str_isspace({self})")
1748
+ @readonly
1749
+ @pure
1750
+ def isspace(self) -> bool: ...
1751
+
1752
+ @cpp_template("::tpy::str_isupper({self})")
1753
+ @readonly
1754
+ @pure
1755
+ def isupper(self) -> bool: ...
1756
+
1757
+ @cpp_template("::tpy::str_islower({self})")
1758
+ @readonly
1759
+ @pure
1760
+ def islower(self) -> bool: ...
1761
+
1762
+ @cpp_template("::tpy::str_capitalize({self})")
1763
+ @readonly
1764
+ @pure
1765
+ def capitalize(self) -> str: ...
1766
+
1767
+ @cpp_template("::tpy::str_title({self})")
1768
+ @readonly
1769
+ @pure
1770
+ def title(self) -> str: ...
1771
+
1772
+ @cpp_template("::tpy::str_swapcase({self})")
1773
+ @readonly
1774
+ @pure
1775
+ def swapcase(self) -> str: ...
1776
+
1777
+ @cpp_template("::tpy::str_removeprefix({self}, {0})")
1778
+ @readonly
1779
+ @pure
1780
+ def removeprefix(self, prefix: str) -> StrView: ...
1781
+
1782
+ @cpp_template("::tpy::str_removesuffix({self}, {0})")
1783
+ @readonly
1784
+ @pure
1785
+ def removesuffix(self, suffix: str) -> StrView: ...
1786
+
1787
+ @cpp_template("::tpy::str_rindex({self}, {0})")
1788
+ @readonly
1789
+ @pure
1790
+ def rindex(self, sub: str) -> Int32: ...
1791
+
1792
+ @cpp_template("::tpy::str_splitlines({self})")
1793
+ @readonly
1794
+ @pure
1795
+ def splitlines(self) -> Own[list[str]]: ...
1796
+
1797
+ @cpp_template("(!{self}.empty())")
1798
+ @readonly
1799
+ @pure
1800
+ def __bool__(self) -> bool: ...
1801
+
1802
+ @cpp_template("::tpy::__hash__({self})")
1803
+ @readonly
1804
+ @pure
1805
+ def __hash__(self) -> UInt64: ...
1806
+
1807
+ @cpp_template("{self} == {0}")
1808
+ @readonly
1809
+ @pure
1810
+ def __eq__(self, other: String) -> bool: ...
1811
+
1812
+ @cpp_template("{self} < {0}")
1813
+ @readonly
1814
+ @pure
1815
+ def __lt__(self, other: String) -> bool: ...
1816
+
1817
+
1818
+
1819
+ @builtin_type("tpy.FStr")
1820
+ class FStr:
1821
+ """Compile-time f-string decomposition marker.
1822
+
1823
+ When an f-string is passed to an FStr parameter, the compiler keeps the
1824
+ f-string decomposed (format template + individual expressions) instead of
1825
+ lowering to std::format. Used with call macros for zero-copy logging.
1826
+ """
1827
+ pass
1828
+
1829
+
1830
+ @builtin_type("tpy.StrView")
1831
+ @native("std::string_view")
1832
+ class StrView(NativeIterable[Char], Iterable[Char], Comparable, Equatable):
1833
+ @overload
1834
+ @cpp_template("std::string_view()")
1835
+ def __init__(self) -> None: ...
1836
+ @overload
1837
+ @cpp_template("{0}")
1838
+ def __init__(self, x: str) -> None: ...
1839
+ @overload
1840
+ @cpp_template("std::string_view({0})")
1841
+ def __init__(self, x: String) -> None: ...
1842
+ @overload
1843
+ @cpp_template("{0}")
1844
+ def __init__(self, x: StrView) -> None: ...
1845
+
1846
+ @cpp_template("::tpy::__iter__({self})")
1847
+ @readonly
1848
+ @pure
1849
+ def __iter__(self) -> Iterator[Char]: ...
1850
+
1851
+ @cpp_template("static_cast<int32_t>({self}.size())")
1852
+ @readonly
1853
+ @pure
1854
+ def __len__(self) -> Int32: ...
1855
+
1856
+ @overload
1857
+ @cpp_template("::tpy::__getitem__({self}, {0})")
1858
+ @readonly
1859
+ @pure
1860
+ def __getitem__(self, index: Int32) -> Char: ...
1861
+
1862
+ @overload
1863
+ @cpp_template("::tpy::str_slice({self}, {0})")
1864
+ @readonly
1865
+ @pure
1866
+ def __getitem__(self, index: basic_slice) -> StrView: ...
1867
+
1868
+ @overload
1869
+ @cpp_template("::tpy::str_stepped_slice({self}, {0})")
1870
+ @readonly
1871
+ @pure
1872
+ def __getitem__(self, index: slice) -> str: ...
1873
+
1874
+ @overload
1875
+ @cpp_template("::tpy::str_concat({self}, {0})")
1876
+ def __add__(self, other: str) -> String: ...
1877
+ @overload
1878
+ @cpp_template("::tpy::str_concat({self}, {0})")
1879
+ def __add__(self, other: String) -> String: ...
1880
+ @overload
1881
+ @cpp_template("::tpy::str_concat({self}, {0})")
1882
+ def __add__(self, other: StrView) -> String: ...
1883
+ @overload
1884
+ @cpp_template("::tpy::str_concat({self}, ::tpy::char_to_str({0}))")
1885
+ def __add__(self, other: Char) -> String: ...
1886
+
1887
+ @cpp_template("::tpy::str_repeat({self}, {0})")
1888
+ @readonly
1889
+ @pure
1890
+ def __mul__(self, n: Int32) -> str: ...
1891
+
1892
+ @cpp_template("::tpy::str_repeat({self}, {0})")
1893
+ @readonly
1894
+ @pure
1895
+ def __rmul__(self, n: Int32) -> str: ...
1896
+
1897
+ @overload
1898
+ @cpp_template("::tpy::str_split_whitespace({self})")
1899
+ @readonly
1900
+ @pure
1901
+ def split(self) -> Own[list[str]]: ...
1902
+ @overload
1903
+ @cpp_template("::tpy::str_split({self}, {0})")
1904
+ @readonly
1905
+ @pure
1906
+ def split(self, sep: str) -> Own[list[str]]: ...
1907
+ @overload
1908
+ @cpp_template("::tpy::str_split({self}, {0}, {1})")
1909
+ @readonly
1910
+ @pure
1911
+ def split(self, sep: str, maxsplit: Int32) -> Own[list[str]]: ...
1912
+
1913
+ @cpp_template("::tpy::str_join({self}, {0})")
1914
+ @readonly
1915
+ @pure
1916
+ def join(self, items: Iterable[str]) -> str: ...
1917
+
1918
+ @cpp_template("::tpy::str_strip({self})")
1919
+ @readonly
1920
+ @pure
1921
+ def strip(self) -> StrView: ...
1922
+
1923
+ @cpp_template("::tpy::str_lstrip({self})")
1924
+ @readonly
1925
+ @pure
1926
+ def lstrip(self) -> StrView: ...
1927
+
1928
+ @cpp_template("::tpy::str_rstrip({self})")
1929
+ @readonly
1930
+ @pure
1931
+ def rstrip(self) -> StrView: ...
1932
+
1933
+ @cpp_template("::tpy::str_replace({self}, {0}, {1})")
1934
+ @readonly
1935
+ @pure
1936
+ def replace(self, old: str, new: str) -> str: ...
1937
+
1938
+ @cpp_template("::tpy::str_find({self}, {0})")
1939
+ @readonly
1940
+ @pure
1941
+ def find(self, sub: str) -> Int32: ...
1942
+
1943
+ @cpp_template("::tpy::str_rfind({self}, {0})")
1944
+ @readonly
1945
+ @pure
1946
+ def rfind(self, sub: str) -> Int32: ...
1947
+
1948
+ @cpp_template("::tpy::str_index({self}, {0})")
1949
+ @readonly
1950
+ @pure
1951
+ def index(self, sub: str) -> Int32: ...
1952
+
1953
+ @cpp_template("::tpy::str_startswith({self}, {0})")
1954
+ @readonly
1955
+ @pure
1956
+ def startswith(self, prefix: str) -> bool: ...
1957
+
1958
+ @cpp_template("::tpy::str_endswith({self}, {0})")
1959
+ @readonly
1960
+ @pure
1961
+ def endswith(self, suffix: str) -> bool: ...
1962
+
1963
+ @cpp_template("::tpy::str_upper({self})")
1964
+ @readonly
1965
+ @pure
1966
+ def upper(self) -> str: ...
1967
+
1968
+ @cpp_template("::tpy::str_lower({self})")
1969
+ @readonly
1970
+ @pure
1971
+ def lower(self) -> str: ...
1972
+
1973
+ @cpp_template("::tpy::str_count({self}, {0})")
1974
+ @readonly
1975
+ @pure
1976
+ def count(self, sub: str) -> Int32: ...
1977
+
1978
+ @cpp_template("::tpy::str_isdigit({self})")
1979
+ @readonly
1980
+ @pure
1981
+ def isdigit(self) -> bool: ...
1982
+
1983
+ @cpp_template("::tpy::str_isalpha({self})")
1984
+ @readonly
1985
+ @pure
1986
+ def isalpha(self) -> bool: ...
1987
+
1988
+ @cpp_template("::tpy::str_isalnum({self})")
1989
+ @readonly
1990
+ @pure
1991
+ def isalnum(self) -> bool: ...
1992
+
1993
+ @cpp_template("::tpy::str_isspace({self})")
1994
+ @readonly
1995
+ @pure
1996
+ def isspace(self) -> bool: ...
1997
+
1998
+ @cpp_template("::tpy::str_isupper({self})")
1999
+ @readonly
2000
+ @pure
2001
+ def isupper(self) -> bool: ...
2002
+
2003
+ @cpp_template("::tpy::str_islower({self})")
2004
+ @readonly
2005
+ @pure
2006
+ def islower(self) -> bool: ...
2007
+
2008
+ @cpp_template("::tpy::str_capitalize({self})")
2009
+ @readonly
2010
+ @pure
2011
+ def capitalize(self) -> str: ...
2012
+
2013
+ @cpp_template("::tpy::str_title({self})")
2014
+ @readonly
2015
+ @pure
2016
+ def title(self) -> str: ...
2017
+
2018
+ @cpp_template("::tpy::str_swapcase({self})")
2019
+ @readonly
2020
+ @pure
2021
+ def swapcase(self) -> str: ...
2022
+
2023
+ @cpp_template("::tpy::str_removeprefix({self}, {0})")
2024
+ @readonly
2025
+ @pure
2026
+ def removeprefix(self, prefix: str) -> StrView: ...
2027
+
2028
+ @cpp_template("::tpy::str_removesuffix({self}, {0})")
2029
+ @readonly
2030
+ @pure
2031
+ def removesuffix(self, suffix: str) -> StrView: ...
2032
+
2033
+ @cpp_template("::tpy::str_rindex({self}, {0})")
2034
+ @readonly
2035
+ @pure
2036
+ def rindex(self, sub: str) -> Int32: ...
2037
+
2038
+ @cpp_template("::tpy::str_splitlines({self})")
2039
+ @readonly
2040
+ @pure
2041
+ def splitlines(self) -> Own[list[str]]: ...
2042
+
2043
+ @cpp_template("(!{self}.empty())")
2044
+ @readonly
2045
+ @pure
2046
+ def __bool__(self) -> bool: ...
2047
+
2048
+ @cpp_template("::tpy::__hash__({self})")
2049
+ @readonly
2050
+ @pure
2051
+ def __hash__(self) -> UInt64: ...
2052
+
2053
+ @cpp_template("{self} == {0}")
2054
+ @readonly
2055
+ @pure
2056
+ def __eq__(self, other: StrView) -> bool: ...
2057
+
2058
+ @cpp_template("{self} < {0}")
2059
+ @readonly
2060
+ @pure
2061
+ def __lt__(self, other: StrView) -> bool: ...