numba-cuda 0.22.0__cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.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.
- _numba_cuda_redirector.pth +4 -0
- _numba_cuda_redirector.py +89 -0
- numba_cuda/VERSION +1 -0
- numba_cuda/__init__.py +6 -0
- numba_cuda/_version.py +11 -0
- numba_cuda/numba/cuda/__init__.py +70 -0
- numba_cuda/numba/cuda/_internal/cuda_bf16.py +16394 -0
- numba_cuda/numba/cuda/_internal/cuda_fp16.py +8112 -0
- numba_cuda/numba/cuda/api.py +580 -0
- numba_cuda/numba/cuda/api_util.py +76 -0
- numba_cuda/numba/cuda/args.py +72 -0
- numba_cuda/numba/cuda/bf16.py +397 -0
- numba_cuda/numba/cuda/cache_hints.py +287 -0
- numba_cuda/numba/cuda/cext/__init__.py +2 -0
- numba_cuda/numba/cuda/cext/_devicearray.cpp +159 -0
- numba_cuda/numba/cuda/cext/_devicearray.cpython-313-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_devicearray.h +29 -0
- numba_cuda/numba/cuda/cext/_dispatcher.cpp +1098 -0
- numba_cuda/numba/cuda/cext/_dispatcher.cpython-313-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_hashtable.cpp +532 -0
- numba_cuda/numba/cuda/cext/_hashtable.h +135 -0
- numba_cuda/numba/cuda/cext/_helperlib.c +71 -0
- numba_cuda/numba/cuda/cext/_helperlib.cpython-313-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_helpermod.c +82 -0
- numba_cuda/numba/cuda/cext/_pymodule.h +38 -0
- numba_cuda/numba/cuda/cext/_typeconv.cpp +206 -0
- numba_cuda/numba/cuda/cext/_typeconv.cpython-313-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_typeof.cpp +1159 -0
- numba_cuda/numba/cuda/cext/_typeof.h +19 -0
- numba_cuda/numba/cuda/cext/capsulethunk.h +111 -0
- numba_cuda/numba/cuda/cext/mviewbuf.c +385 -0
- numba_cuda/numba/cuda/cext/mviewbuf.cpython-313-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/typeconv.cpp +212 -0
- numba_cuda/numba/cuda/cext/typeconv.hpp +101 -0
- numba_cuda/numba/cuda/cg.py +67 -0
- numba_cuda/numba/cuda/cgutils.py +1294 -0
- numba_cuda/numba/cuda/cloudpickle/__init__.py +21 -0
- numba_cuda/numba/cuda/cloudpickle/cloudpickle.py +1598 -0
- numba_cuda/numba/cuda/cloudpickle/cloudpickle_fast.py +17 -0
- numba_cuda/numba/cuda/codegen.py +541 -0
- numba_cuda/numba/cuda/compiler.py +1396 -0
- numba_cuda/numba/cuda/core/analysis.py +758 -0
- numba_cuda/numba/cuda/core/annotations/__init__.py +0 -0
- numba_cuda/numba/cuda/core/annotations/pretty_annotate.py +288 -0
- numba_cuda/numba/cuda/core/annotations/type_annotations.py +305 -0
- numba_cuda/numba/cuda/core/base.py +1332 -0
- numba_cuda/numba/cuda/core/boxing.py +1411 -0
- numba_cuda/numba/cuda/core/bytecode.py +728 -0
- numba_cuda/numba/cuda/core/byteflow.py +2346 -0
- numba_cuda/numba/cuda/core/caching.py +744 -0
- numba_cuda/numba/cuda/core/callconv.py +392 -0
- numba_cuda/numba/cuda/core/codegen.py +171 -0
- numba_cuda/numba/cuda/core/compiler.py +199 -0
- numba_cuda/numba/cuda/core/compiler_lock.py +85 -0
- numba_cuda/numba/cuda/core/compiler_machinery.py +497 -0
- numba_cuda/numba/cuda/core/config.py +650 -0
- numba_cuda/numba/cuda/core/consts.py +124 -0
- numba_cuda/numba/cuda/core/controlflow.py +989 -0
- numba_cuda/numba/cuda/core/entrypoints.py +57 -0
- numba_cuda/numba/cuda/core/environment.py +66 -0
- numba_cuda/numba/cuda/core/errors.py +917 -0
- numba_cuda/numba/cuda/core/event.py +511 -0
- numba_cuda/numba/cuda/core/funcdesc.py +330 -0
- numba_cuda/numba/cuda/core/generators.py +387 -0
- numba_cuda/numba/cuda/core/imputils.py +509 -0
- numba_cuda/numba/cuda/core/inline_closurecall.py +1787 -0
- numba_cuda/numba/cuda/core/interpreter.py +3617 -0
- numba_cuda/numba/cuda/core/ir.py +1812 -0
- numba_cuda/numba/cuda/core/ir_utils.py +2638 -0
- numba_cuda/numba/cuda/core/optional.py +129 -0
- numba_cuda/numba/cuda/core/options.py +262 -0
- numba_cuda/numba/cuda/core/postproc.py +249 -0
- numba_cuda/numba/cuda/core/pythonapi.py +1859 -0
- numba_cuda/numba/cuda/core/registry.py +46 -0
- numba_cuda/numba/cuda/core/removerefctpass.py +123 -0
- numba_cuda/numba/cuda/core/rewrites/__init__.py +26 -0
- numba_cuda/numba/cuda/core/rewrites/ir_print.py +91 -0
- numba_cuda/numba/cuda/core/rewrites/registry.py +104 -0
- numba_cuda/numba/cuda/core/rewrites/static_binop.py +41 -0
- numba_cuda/numba/cuda/core/rewrites/static_getitem.py +189 -0
- numba_cuda/numba/cuda/core/rewrites/static_raise.py +100 -0
- numba_cuda/numba/cuda/core/sigutils.py +68 -0
- numba_cuda/numba/cuda/core/ssa.py +498 -0
- numba_cuda/numba/cuda/core/targetconfig.py +330 -0
- numba_cuda/numba/cuda/core/tracing.py +231 -0
- numba_cuda/numba/cuda/core/transforms.py +956 -0
- numba_cuda/numba/cuda/core/typed_passes.py +867 -0
- numba_cuda/numba/cuda/core/typeinfer.py +1950 -0
- numba_cuda/numba/cuda/core/unsafe/__init__.py +0 -0
- numba_cuda/numba/cuda/core/unsafe/bytes.py +67 -0
- numba_cuda/numba/cuda/core/unsafe/eh.py +67 -0
- numba_cuda/numba/cuda/core/unsafe/refcount.py +98 -0
- numba_cuda/numba/cuda/core/untyped_passes.py +1979 -0
- numba_cuda/numba/cuda/cpython/builtins.py +1153 -0
- numba_cuda/numba/cuda/cpython/charseq.py +1218 -0
- numba_cuda/numba/cuda/cpython/cmathimpl.py +560 -0
- numba_cuda/numba/cuda/cpython/enumimpl.py +103 -0
- numba_cuda/numba/cuda/cpython/iterators.py +167 -0
- numba_cuda/numba/cuda/cpython/listobj.py +1326 -0
- numba_cuda/numba/cuda/cpython/mathimpl.py +499 -0
- numba_cuda/numba/cuda/cpython/numbers.py +1475 -0
- numba_cuda/numba/cuda/cpython/rangeobj.py +289 -0
- numba_cuda/numba/cuda/cpython/slicing.py +322 -0
- numba_cuda/numba/cuda/cpython/tupleobj.py +456 -0
- numba_cuda/numba/cuda/cpython/unicode.py +2865 -0
- numba_cuda/numba/cuda/cpython/unicode_support.py +1597 -0
- numba_cuda/numba/cuda/cpython/unsafe/__init__.py +0 -0
- numba_cuda/numba/cuda/cpython/unsafe/numbers.py +64 -0
- numba_cuda/numba/cuda/cpython/unsafe/tuple.py +92 -0
- numba_cuda/numba/cuda/cuda_paths.py +691 -0
- numba_cuda/numba/cuda/cudadecl.py +543 -0
- numba_cuda/numba/cuda/cudadrv/__init__.py +14 -0
- numba_cuda/numba/cuda/cudadrv/devicearray.py +954 -0
- numba_cuda/numba/cuda/cudadrv/devices.py +249 -0
- numba_cuda/numba/cuda/cudadrv/driver.py +3238 -0
- numba_cuda/numba/cuda/cudadrv/drvapi.py +435 -0
- numba_cuda/numba/cuda/cudadrv/dummyarray.py +562 -0
- numba_cuda/numba/cuda/cudadrv/enums.py +613 -0
- numba_cuda/numba/cuda/cudadrv/error.py +48 -0
- numba_cuda/numba/cuda/cudadrv/libs.py +220 -0
- numba_cuda/numba/cuda/cudadrv/linkable_code.py +184 -0
- numba_cuda/numba/cuda/cudadrv/mappings.py +14 -0
- numba_cuda/numba/cuda/cudadrv/ndarray.py +26 -0
- numba_cuda/numba/cuda/cudadrv/nvrtc.py +193 -0
- numba_cuda/numba/cuda/cudadrv/nvvm.py +756 -0
- numba_cuda/numba/cuda/cudadrv/rtapi.py +13 -0
- numba_cuda/numba/cuda/cudadrv/runtime.py +34 -0
- numba_cuda/numba/cuda/cudaimpl.py +983 -0
- numba_cuda/numba/cuda/cudamath.py +149 -0
- numba_cuda/numba/cuda/datamodel/__init__.py +7 -0
- numba_cuda/numba/cuda/datamodel/cuda_manager.py +66 -0
- numba_cuda/numba/cuda/datamodel/cuda_models.py +1446 -0
- numba_cuda/numba/cuda/datamodel/cuda_packer.py +224 -0
- numba_cuda/numba/cuda/datamodel/cuda_registry.py +22 -0
- numba_cuda/numba/cuda/datamodel/cuda_testing.py +153 -0
- numba_cuda/numba/cuda/datamodel/manager.py +11 -0
- numba_cuda/numba/cuda/datamodel/models.py +9 -0
- numba_cuda/numba/cuda/datamodel/packer.py +9 -0
- numba_cuda/numba/cuda/datamodel/registry.py +11 -0
- numba_cuda/numba/cuda/datamodel/testing.py +11 -0
- numba_cuda/numba/cuda/debuginfo.py +997 -0
- numba_cuda/numba/cuda/decorators.py +294 -0
- numba_cuda/numba/cuda/descriptor.py +35 -0
- numba_cuda/numba/cuda/device_init.py +155 -0
- numba_cuda/numba/cuda/deviceufunc.py +1021 -0
- numba_cuda/numba/cuda/dispatcher.py +2463 -0
- numba_cuda/numba/cuda/errors.py +72 -0
- numba_cuda/numba/cuda/extending.py +697 -0
- numba_cuda/numba/cuda/flags.py +178 -0
- numba_cuda/numba/cuda/fp16.py +357 -0
- numba_cuda/numba/cuda/include/12/cuda_bf16.h +5118 -0
- numba_cuda/numba/cuda/include/12/cuda_bf16.hpp +3865 -0
- numba_cuda/numba/cuda/include/12/cuda_fp16.h +5363 -0
- numba_cuda/numba/cuda/include/12/cuda_fp16.hpp +3483 -0
- numba_cuda/numba/cuda/include/13/cuda_bf16.h +5118 -0
- numba_cuda/numba/cuda/include/13/cuda_bf16.hpp +3865 -0
- numba_cuda/numba/cuda/include/13/cuda_fp16.h +5363 -0
- numba_cuda/numba/cuda/include/13/cuda_fp16.hpp +3483 -0
- numba_cuda/numba/cuda/initialize.py +24 -0
- numba_cuda/numba/cuda/intrinsics.py +531 -0
- numba_cuda/numba/cuda/itanium_mangler.py +214 -0
- numba_cuda/numba/cuda/kernels/__init__.py +2 -0
- numba_cuda/numba/cuda/kernels/reduction.py +265 -0
- numba_cuda/numba/cuda/kernels/transpose.py +65 -0
- numba_cuda/numba/cuda/libdevice.py +3386 -0
- numba_cuda/numba/cuda/libdevicedecl.py +20 -0
- numba_cuda/numba/cuda/libdevicefuncs.py +1060 -0
- numba_cuda/numba/cuda/libdeviceimpl.py +88 -0
- numba_cuda/numba/cuda/locks.py +19 -0
- numba_cuda/numba/cuda/lowering.py +1980 -0
- numba_cuda/numba/cuda/mathimpl.py +374 -0
- numba_cuda/numba/cuda/memory_management/__init__.py +4 -0
- numba_cuda/numba/cuda/memory_management/memsys.cu +99 -0
- numba_cuda/numba/cuda/memory_management/memsys.cuh +22 -0
- numba_cuda/numba/cuda/memory_management/nrt.cu +212 -0
- numba_cuda/numba/cuda/memory_management/nrt.cuh +48 -0
- numba_cuda/numba/cuda/memory_management/nrt.py +390 -0
- numba_cuda/numba/cuda/memory_management/nrt_context.py +438 -0
- numba_cuda/numba/cuda/misc/appdirs.py +594 -0
- numba_cuda/numba/cuda/misc/cffiimpl.py +24 -0
- numba_cuda/numba/cuda/misc/coverage_support.py +43 -0
- numba_cuda/numba/cuda/misc/dump_style.py +41 -0
- numba_cuda/numba/cuda/misc/findlib.py +75 -0
- numba_cuda/numba/cuda/misc/firstlinefinder.py +96 -0
- numba_cuda/numba/cuda/misc/gdb_hook.py +240 -0
- numba_cuda/numba/cuda/misc/literal.py +28 -0
- numba_cuda/numba/cuda/misc/llvm_pass_timings.py +412 -0
- numba_cuda/numba/cuda/misc/special.py +94 -0
- numba_cuda/numba/cuda/models.py +56 -0
- numba_cuda/numba/cuda/np/arraymath.py +5130 -0
- numba_cuda/numba/cuda/np/arrayobj.py +7635 -0
- numba_cuda/numba/cuda/np/extensions.py +11 -0
- numba_cuda/numba/cuda/np/linalg.py +3087 -0
- numba_cuda/numba/cuda/np/math/__init__.py +0 -0
- numba_cuda/numba/cuda/np/math/cmathimpl.py +558 -0
- numba_cuda/numba/cuda/np/math/mathimpl.py +487 -0
- numba_cuda/numba/cuda/np/math/numbers.py +1461 -0
- numba_cuda/numba/cuda/np/npdatetime.py +969 -0
- numba_cuda/numba/cuda/np/npdatetime_helpers.py +217 -0
- numba_cuda/numba/cuda/np/npyfuncs.py +1808 -0
- numba_cuda/numba/cuda/np/npyimpl.py +1027 -0
- numba_cuda/numba/cuda/np/numpy_support.py +798 -0
- numba_cuda/numba/cuda/np/polynomial/__init__.py +4 -0
- numba_cuda/numba/cuda/np/polynomial/polynomial_core.py +242 -0
- numba_cuda/numba/cuda/np/polynomial/polynomial_functions.py +380 -0
- numba_cuda/numba/cuda/np/ufunc/__init__.py +4 -0
- numba_cuda/numba/cuda/np/ufunc/decorators.py +203 -0
- numba_cuda/numba/cuda/np/ufunc/sigparse.py +68 -0
- numba_cuda/numba/cuda/np/ufunc/ufuncbuilder.py +65 -0
- numba_cuda/numba/cuda/np/ufunc_db.py +1282 -0
- numba_cuda/numba/cuda/np/unsafe/__init__.py +0 -0
- numba_cuda/numba/cuda/np/unsafe/ndarray.py +84 -0
- numba_cuda/numba/cuda/nvvmutils.py +254 -0
- numba_cuda/numba/cuda/printimpl.py +126 -0
- numba_cuda/numba/cuda/random.py +308 -0
- numba_cuda/numba/cuda/reshape_funcs.cu +156 -0
- numba_cuda/numba/cuda/serialize.py +267 -0
- numba_cuda/numba/cuda/simulator/__init__.py +63 -0
- numba_cuda/numba/cuda/simulator/_internal/__init__.py +4 -0
- numba_cuda/numba/cuda/simulator/_internal/cuda_bf16.py +2 -0
- numba_cuda/numba/cuda/simulator/api.py +179 -0
- numba_cuda/numba/cuda/simulator/bf16.py +4 -0
- numba_cuda/numba/cuda/simulator/compiler.py +38 -0
- numba_cuda/numba/cuda/simulator/cudadrv/__init__.py +11 -0
- numba_cuda/numba/cuda/simulator/cudadrv/devicearray.py +462 -0
- numba_cuda/numba/cuda/simulator/cudadrv/devices.py +122 -0
- numba_cuda/numba/cuda/simulator/cudadrv/driver.py +66 -0
- numba_cuda/numba/cuda/simulator/cudadrv/drvapi.py +7 -0
- numba_cuda/numba/cuda/simulator/cudadrv/dummyarray.py +7 -0
- numba_cuda/numba/cuda/simulator/cudadrv/error.py +10 -0
- numba_cuda/numba/cuda/simulator/cudadrv/libs.py +10 -0
- numba_cuda/numba/cuda/simulator/cudadrv/linkable_code.py +61 -0
- numba_cuda/numba/cuda/simulator/cudadrv/nvrtc.py +11 -0
- numba_cuda/numba/cuda/simulator/cudadrv/nvvm.py +32 -0
- numba_cuda/numba/cuda/simulator/cudadrv/runtime.py +22 -0
- numba_cuda/numba/cuda/simulator/dispatcher.py +11 -0
- numba_cuda/numba/cuda/simulator/kernel.py +320 -0
- numba_cuda/numba/cuda/simulator/kernelapi.py +509 -0
- numba_cuda/numba/cuda/simulator/memory_management/__init__.py +4 -0
- numba_cuda/numba/cuda/simulator/memory_management/nrt.py +21 -0
- numba_cuda/numba/cuda/simulator/reduction.py +19 -0
- numba_cuda/numba/cuda/simulator/tests/support.py +4 -0
- numba_cuda/numba/cuda/simulator/vector_types.py +65 -0
- numba_cuda/numba/cuda/simulator_init.py +18 -0
- numba_cuda/numba/cuda/stubs.py +624 -0
- numba_cuda/numba/cuda/target.py +505 -0
- numba_cuda/numba/cuda/testing.py +347 -0
- numba_cuda/numba/cuda/tests/__init__.py +62 -0
- numba_cuda/numba/cuda/tests/benchmarks/__init__.py +0 -0
- numba_cuda/numba/cuda/tests/benchmarks/test_kernel_launch.py +119 -0
- numba_cuda/numba/cuda/tests/cloudpickle_main_class.py +9 -0
- numba_cuda/numba/cuda/tests/core/serialize_usecases.py +113 -0
- numba_cuda/numba/cuda/tests/core/test_itanium_mangler.py +83 -0
- numba_cuda/numba/cuda/tests/core/test_serialize.py +371 -0
- numba_cuda/numba/cuda/tests/cudadrv/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_array_attr.py +147 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_context_stack.py +161 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_array_slicing.py +397 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_auto_context.py +24 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_devicerecord.py +180 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_driver.py +313 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_memory.py +191 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_ndarray.py +621 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_deallocations.py +247 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_detect.py +100 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_emm_plugins.py +200 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_events.py +53 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_host_alloc.py +72 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_init.py +138 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_inline_ptx.py +43 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_is_fp16.py +15 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_linkable_code.py +58 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_linker.py +348 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_managed_alloc.py +128 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_module_callbacks.py +301 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvjitlink.py +174 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvrtc.py +28 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvvm_driver.py +185 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_pinned.py +39 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_profiler.py +23 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_reset_device.py +38 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_runtime.py +48 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_select_device.py +44 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_streams.py +127 -0
- numba_cuda/numba/cuda/tests/cudapy/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/cudapy/cache_usecases.py +231 -0
- numba_cuda/numba/cuda/tests/cudapy/cache_with_cpu_usecases.py +50 -0
- numba_cuda/numba/cuda/tests/cudapy/cg_cache_usecases.py +36 -0
- numba_cuda/numba/cuda/tests/cudapy/complex_usecases.py +116 -0
- numba_cuda/numba/cuda/tests/cudapy/enum_usecases.py +59 -0
- numba_cuda/numba/cuda/tests/cudapy/extensions_usecases.py +62 -0
- numba_cuda/numba/cuda/tests/cudapy/jitlink.ptx +28 -0
- numba_cuda/numba/cuda/tests/cudapy/overload_usecases.py +33 -0
- numba_cuda/numba/cuda/tests/cudapy/recursion_usecases.py +104 -0
- numba_cuda/numba/cuda/tests/cudapy/test_alignment.py +47 -0
- numba_cuda/numba/cuda/tests/cudapy/test_analysis.py +1122 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array.py +344 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_alignment.py +268 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_args.py +203 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_methods.py +63 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_reductions.py +360 -0
- numba_cuda/numba/cuda/tests/cudapy/test_atomics.py +1815 -0
- numba_cuda/numba/cuda/tests/cudapy/test_bfloat16.py +599 -0
- numba_cuda/numba/cuda/tests/cudapy/test_bfloat16_bindings.py +377 -0
- numba_cuda/numba/cuda/tests/cudapy/test_blackscholes.py +160 -0
- numba_cuda/numba/cuda/tests/cudapy/test_boolean.py +27 -0
- numba_cuda/numba/cuda/tests/cudapy/test_byteflow.py +98 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cache_hints.py +210 -0
- numba_cuda/numba/cuda/tests/cudapy/test_caching.py +683 -0
- numba_cuda/numba/cuda/tests/cudapy/test_casting.py +265 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cffi.py +42 -0
- numba_cuda/numba/cuda/tests/cudapy/test_compiler.py +718 -0
- numba_cuda/numba/cuda/tests/cudapy/test_complex.py +370 -0
- numba_cuda/numba/cuda/tests/cudapy/test_complex_kernel.py +23 -0
- numba_cuda/numba/cuda/tests/cudapy/test_const_string.py +142 -0
- numba_cuda/numba/cuda/tests/cudapy/test_constmem.py +178 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cooperative_groups.py +193 -0
- numba_cuda/numba/cuda/tests/cudapy/test_copy_propagate.py +131 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cuda_array_interface.py +438 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cuda_jit_no_types.py +94 -0
- numba_cuda/numba/cuda/tests/cudapy/test_datetime.py +101 -0
- numba_cuda/numba/cuda/tests/cudapy/test_debug.py +105 -0
- numba_cuda/numba/cuda/tests/cudapy/test_debuginfo.py +978 -0
- numba_cuda/numba/cuda/tests/cudapy/test_debuginfo_types.py +476 -0
- numba_cuda/numba/cuda/tests/cudapy/test_device_func.py +500 -0
- numba_cuda/numba/cuda/tests/cudapy/test_dispatcher.py +820 -0
- numba_cuda/numba/cuda/tests/cudapy/test_enums.py +152 -0
- numba_cuda/numba/cuda/tests/cudapy/test_errors.py +111 -0
- numba_cuda/numba/cuda/tests/cudapy/test_exception.py +170 -0
- numba_cuda/numba/cuda/tests/cudapy/test_extending.py +1088 -0
- numba_cuda/numba/cuda/tests/cudapy/test_extending_types.py +71 -0
- numba_cuda/numba/cuda/tests/cudapy/test_fastmath.py +265 -0
- numba_cuda/numba/cuda/tests/cudapy/test_flow_control.py +1433 -0
- numba_cuda/numba/cuda/tests/cudapy/test_forall.py +57 -0
- numba_cuda/numba/cuda/tests/cudapy/test_freevar.py +34 -0
- numba_cuda/numba/cuda/tests/cudapy/test_frexp_ldexp.py +69 -0
- numba_cuda/numba/cuda/tests/cudapy/test_globals.py +62 -0
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc.py +474 -0
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scalar.py +167 -0
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scheduling.py +92 -0
- numba_cuda/numba/cuda/tests/cudapy/test_idiv.py +39 -0
- numba_cuda/numba/cuda/tests/cudapy/test_inline.py +170 -0
- numba_cuda/numba/cuda/tests/cudapy/test_inspect.py +255 -0
- numba_cuda/numba/cuda/tests/cudapy/test_intrinsics.py +1219 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ipc.py +263 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ir.py +598 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ir_utils.py +276 -0
- numba_cuda/numba/cuda/tests/cudapy/test_iterators.py +101 -0
- numba_cuda/numba/cuda/tests/cudapy/test_lang.py +68 -0
- numba_cuda/numba/cuda/tests/cudapy/test_laplace.py +123 -0
- numba_cuda/numba/cuda/tests/cudapy/test_libdevice.py +194 -0
- numba_cuda/numba/cuda/tests/cudapy/test_lineinfo.py +220 -0
- numba_cuda/numba/cuda/tests/cudapy/test_localmem.py +173 -0
- numba_cuda/numba/cuda/tests/cudapy/test_make_function_to_jit_function.py +364 -0
- numba_cuda/numba/cuda/tests/cudapy/test_mandel.py +47 -0
- numba_cuda/numba/cuda/tests/cudapy/test_math.py +842 -0
- numba_cuda/numba/cuda/tests/cudapy/test_matmul.py +76 -0
- numba_cuda/numba/cuda/tests/cudapy/test_minmax.py +78 -0
- numba_cuda/numba/cuda/tests/cudapy/test_montecarlo.py +25 -0
- numba_cuda/numba/cuda/tests/cudapy/test_multigpu.py +145 -0
- numba_cuda/numba/cuda/tests/cudapy/test_multiprocessing.py +39 -0
- numba_cuda/numba/cuda/tests/cudapy/test_multithreads.py +82 -0
- numba_cuda/numba/cuda/tests/cudapy/test_nondet.py +53 -0
- numba_cuda/numba/cuda/tests/cudapy/test_operator.py +504 -0
- numba_cuda/numba/cuda/tests/cudapy/test_optimization.py +93 -0
- numba_cuda/numba/cuda/tests/cudapy/test_overload.py +402 -0
- numba_cuda/numba/cuda/tests/cudapy/test_powi.py +128 -0
- numba_cuda/numba/cuda/tests/cudapy/test_print.py +193 -0
- numba_cuda/numba/cuda/tests/cudapy/test_py2_div_issue.py +37 -0
- numba_cuda/numba/cuda/tests/cudapy/test_random.py +117 -0
- numba_cuda/numba/cuda/tests/cudapy/test_record_dtype.py +614 -0
- numba_cuda/numba/cuda/tests/cudapy/test_recursion.py +130 -0
- numba_cuda/numba/cuda/tests/cudapy/test_reduction.py +94 -0
- numba_cuda/numba/cuda/tests/cudapy/test_retrieve_autoconverted_arrays.py +83 -0
- numba_cuda/numba/cuda/tests/cudapy/test_serialize.py +86 -0
- numba_cuda/numba/cuda/tests/cudapy/test_slicing.py +40 -0
- numba_cuda/numba/cuda/tests/cudapy/test_sm.py +457 -0
- numba_cuda/numba/cuda/tests/cudapy/test_sm_creation.py +233 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ssa.py +454 -0
- numba_cuda/numba/cuda/tests/cudapy/test_stream_api.py +56 -0
- numba_cuda/numba/cuda/tests/cudapy/test_sync.py +277 -0
- numba_cuda/numba/cuda/tests/cudapy/test_tracing.py +200 -0
- numba_cuda/numba/cuda/tests/cudapy/test_transpose.py +90 -0
- numba_cuda/numba/cuda/tests/cudapy/test_typeconv.py +333 -0
- numba_cuda/numba/cuda/tests/cudapy/test_typeinfer.py +538 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ufuncs.py +585 -0
- numba_cuda/numba/cuda/tests/cudapy/test_userexc.py +42 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vector_type.py +485 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize.py +312 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_complex.py +23 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_decor.py +183 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_device.py +40 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_scalar_arg.py +40 -0
- numba_cuda/numba/cuda/tests/cudapy/test_warning.py +206 -0
- numba_cuda/numba/cuda/tests/cudapy/test_warp_ops.py +446 -0
- numba_cuda/numba/cuda/tests/cudasim/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/cudasim/support.py +9 -0
- numba_cuda/numba/cuda/tests/cudasim/test_cudasim_issues.py +111 -0
- numba_cuda/numba/cuda/tests/data/__init__.py +2 -0
- numba_cuda/numba/cuda/tests/data/cta_barrier.cu +28 -0
- numba_cuda/numba/cuda/tests/data/cuda_include.cu +10 -0
- numba_cuda/numba/cuda/tests/data/error.cu +12 -0
- numba_cuda/numba/cuda/tests/data/include/add.cuh +8 -0
- numba_cuda/numba/cuda/tests/data/jitlink.cu +28 -0
- numba_cuda/numba/cuda/tests/data/jitlink.ptx +49 -0
- numba_cuda/numba/cuda/tests/data/warn.cu +12 -0
- numba_cuda/numba/cuda/tests/doc_examples/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/__init__.py +2 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/functions.cu +54 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/include/mul.cuh +8 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/saxpy.cu +14 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_cg.py +86 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_cpointer.py +68 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_cpu_gpu_compat.py +81 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_ffi.py +141 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_laplace.py +160 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_matmul.py +180 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_montecarlo.py +119 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_random.py +66 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_reduction.py +80 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_sessionize.py +206 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_ufunc.py +53 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_vecadd.py +76 -0
- numba_cuda/numba/cuda/tests/nocuda/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/nocuda/test_dummyarray.py +452 -0
- numba_cuda/numba/cuda/tests/nocuda/test_function_resolution.py +48 -0
- numba_cuda/numba/cuda/tests/nocuda/test_import.py +63 -0
- numba_cuda/numba/cuda/tests/nocuda/test_library_lookup.py +252 -0
- numba_cuda/numba/cuda/tests/nocuda/test_nvvm.py +59 -0
- numba_cuda/numba/cuda/tests/nrt/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/nrt/test_nrt.py +387 -0
- numba_cuda/numba/cuda/tests/nrt/test_nrt_refct.py +124 -0
- numba_cuda/numba/cuda/tests/support.py +900 -0
- numba_cuda/numba/cuda/typeconv/__init__.py +4 -0
- numba_cuda/numba/cuda/typeconv/castgraph.py +137 -0
- numba_cuda/numba/cuda/typeconv/rules.py +63 -0
- numba_cuda/numba/cuda/typeconv/typeconv.py +121 -0
- numba_cuda/numba/cuda/types/__init__.py +233 -0
- numba_cuda/numba/cuda/types/__init__.pyi +167 -0
- numba_cuda/numba/cuda/types/abstract.py +9 -0
- numba_cuda/numba/cuda/types/common.py +9 -0
- numba_cuda/numba/cuda/types/containers.py +9 -0
- numba_cuda/numba/cuda/types/cuda_abstract.py +533 -0
- numba_cuda/numba/cuda/types/cuda_common.py +110 -0
- numba_cuda/numba/cuda/types/cuda_containers.py +971 -0
- numba_cuda/numba/cuda/types/cuda_function_type.py +230 -0
- numba_cuda/numba/cuda/types/cuda_functions.py +798 -0
- numba_cuda/numba/cuda/types/cuda_iterators.py +120 -0
- numba_cuda/numba/cuda/types/cuda_misc.py +569 -0
- numba_cuda/numba/cuda/types/cuda_npytypes.py +690 -0
- numba_cuda/numba/cuda/types/cuda_scalars.py +280 -0
- numba_cuda/numba/cuda/types/ext_types.py +101 -0
- numba_cuda/numba/cuda/types/function_type.py +11 -0
- numba_cuda/numba/cuda/types/functions.py +9 -0
- numba_cuda/numba/cuda/types/iterators.py +9 -0
- numba_cuda/numba/cuda/types/misc.py +9 -0
- numba_cuda/numba/cuda/types/npytypes.py +9 -0
- numba_cuda/numba/cuda/types/scalars.py +9 -0
- numba_cuda/numba/cuda/typing/__init__.py +19 -0
- numba_cuda/numba/cuda/typing/arraydecl.py +939 -0
- numba_cuda/numba/cuda/typing/asnumbatype.py +130 -0
- numba_cuda/numba/cuda/typing/bufproto.py +70 -0
- numba_cuda/numba/cuda/typing/builtins.py +1209 -0
- numba_cuda/numba/cuda/typing/cffi_utils.py +219 -0
- numba_cuda/numba/cuda/typing/cmathdecl.py +47 -0
- numba_cuda/numba/cuda/typing/collections.py +138 -0
- numba_cuda/numba/cuda/typing/context.py +782 -0
- numba_cuda/numba/cuda/typing/ctypes_utils.py +125 -0
- numba_cuda/numba/cuda/typing/dictdecl.py +63 -0
- numba_cuda/numba/cuda/typing/enumdecl.py +74 -0
- numba_cuda/numba/cuda/typing/listdecl.py +147 -0
- numba_cuda/numba/cuda/typing/mathdecl.py +158 -0
- numba_cuda/numba/cuda/typing/npdatetime.py +322 -0
- numba_cuda/numba/cuda/typing/npydecl.py +749 -0
- numba_cuda/numba/cuda/typing/setdecl.py +115 -0
- numba_cuda/numba/cuda/typing/templates.py +1446 -0
- numba_cuda/numba/cuda/typing/typeof.py +301 -0
- numba_cuda/numba/cuda/ufuncs.py +746 -0
- numba_cuda/numba/cuda/utils.py +724 -0
- numba_cuda/numba/cuda/vector_types.py +214 -0
- numba_cuda/numba/cuda/vectorizers.py +260 -0
- numba_cuda-0.22.0.dist-info/METADATA +109 -0
- numba_cuda-0.22.0.dist-info/RECORD +487 -0
- numba_cuda-0.22.0.dist-info/WHEEL +6 -0
- numba_cuda-0.22.0.dist-info/licenses/LICENSE +26 -0
- numba_cuda-0.22.0.dist-info/licenses/LICENSE.numba +24 -0
- numba_cuda-0.22.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1597 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
This module contains support functions for more advanced unicode operations.
|
|
6
|
+
This is not a public API and is for Numba internal use only. Most of the
|
|
7
|
+
functions are relatively straightforward translations of the functions with the
|
|
8
|
+
same name in CPython.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from collections import namedtuple
|
|
12
|
+
from enum import IntEnum
|
|
13
|
+
|
|
14
|
+
import llvmlite.ir
|
|
15
|
+
import numpy as np
|
|
16
|
+
|
|
17
|
+
from numba.cuda import types
|
|
18
|
+
from numba.cuda import cgutils
|
|
19
|
+
from numba.cuda.core.imputils import impl_ret_untracked
|
|
20
|
+
|
|
21
|
+
from numba.cuda.extending import overload, register_jitable
|
|
22
|
+
from numba.cuda.extending import intrinsic
|
|
23
|
+
from numba.cuda.core.errors import TypingError
|
|
24
|
+
|
|
25
|
+
# This is equivalent to the struct `_PyUnicode_TypeRecord defined in CPython's
|
|
26
|
+
# Objects/unicodectype.c
|
|
27
|
+
typerecord = namedtuple("typerecord", "upper lower title decimal digit flags")
|
|
28
|
+
|
|
29
|
+
# The Py_UCS4 type from CPython:
|
|
30
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Include/unicodeobject.h#L112 # noqa: E501
|
|
31
|
+
_Py_UCS4 = types.uint32
|
|
32
|
+
|
|
33
|
+
# ------------------------------------------------------------------------------
|
|
34
|
+
# Start code related to/from CPython's unicodectype impl
|
|
35
|
+
#
|
|
36
|
+
# NOTE: the original source at:
|
|
37
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c # noqa: E501
|
|
38
|
+
# contains this statement:
|
|
39
|
+
#
|
|
40
|
+
# /*
|
|
41
|
+
# Unicode character type helpers.
|
|
42
|
+
#
|
|
43
|
+
# Written by Marc-Andre Lemburg (mal@lemburg.com).
|
|
44
|
+
# Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com)
|
|
45
|
+
#
|
|
46
|
+
# Copyright (c) Corporation for National Research Initiatives.
|
|
47
|
+
#
|
|
48
|
+
# */
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# This enum contains the values defined in CPython's Objects/unicodectype.c that
|
|
52
|
+
# provide masks for use against the various members of the typerecord
|
|
53
|
+
#
|
|
54
|
+
# See: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L13-L27 # noqa: E501
|
|
55
|
+
#
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
_Py_TAB = 0x9
|
|
59
|
+
_Py_LINEFEED = 0xA
|
|
60
|
+
_Py_CARRIAGE_RETURN = 0xD
|
|
61
|
+
_Py_SPACE = 0x20
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class _PyUnicode_TyperecordMasks(IntEnum):
|
|
65
|
+
ALPHA_MASK = 0x01
|
|
66
|
+
DECIMAL_MASK = 0x02
|
|
67
|
+
DIGIT_MASK = 0x04
|
|
68
|
+
LOWER_MASK = 0x08
|
|
69
|
+
LINEBREAK_MASK = 0x10
|
|
70
|
+
SPACE_MASK = 0x20
|
|
71
|
+
TITLE_MASK = 0x40
|
|
72
|
+
UPPER_MASK = 0x80
|
|
73
|
+
XID_START_MASK = 0x100
|
|
74
|
+
XID_CONTINUE_MASK = 0x200
|
|
75
|
+
PRINTABLE_MASK = 0x400
|
|
76
|
+
NUMERIC_MASK = 0x800
|
|
77
|
+
CASE_IGNORABLE_MASK = 0x1000
|
|
78
|
+
CASED_MASK = 0x2000
|
|
79
|
+
EXTENDED_CASE_MASK = 0x4000
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _PyUnicode_gettyperecord(a):
|
|
83
|
+
raise RuntimeError("Calling the Python definition is invalid")
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@intrinsic
|
|
87
|
+
def _gettyperecord_impl(typingctx, codepoint):
|
|
88
|
+
"""
|
|
89
|
+
Provides the binding to numba_gettyperecord, returns a `typerecord`
|
|
90
|
+
namedtuple of properties from the codepoint.
|
|
91
|
+
"""
|
|
92
|
+
if not isinstance(codepoint, types.Integer):
|
|
93
|
+
raise TypingError("codepoint must be an integer")
|
|
94
|
+
|
|
95
|
+
def details(context, builder, signature, args):
|
|
96
|
+
ll_void = context.get_value_type(types.void)
|
|
97
|
+
ll_Py_UCS4 = context.get_value_type(_Py_UCS4)
|
|
98
|
+
ll_intc = context.get_value_type(types.intc)
|
|
99
|
+
ll_intc_ptr = ll_intc.as_pointer()
|
|
100
|
+
ll_uchar = context.get_value_type(types.uchar)
|
|
101
|
+
ll_uchar_ptr = ll_uchar.as_pointer()
|
|
102
|
+
ll_ushort = context.get_value_type(types.ushort)
|
|
103
|
+
ll_ushort_ptr = ll_ushort.as_pointer()
|
|
104
|
+
fnty = llvmlite.ir.FunctionType(
|
|
105
|
+
ll_void,
|
|
106
|
+
[
|
|
107
|
+
ll_Py_UCS4, # code
|
|
108
|
+
ll_intc_ptr, # upper
|
|
109
|
+
ll_intc_ptr, # lower
|
|
110
|
+
ll_intc_ptr, # title
|
|
111
|
+
ll_uchar_ptr, # decimal
|
|
112
|
+
ll_uchar_ptr, # digit
|
|
113
|
+
ll_ushort_ptr, # flags
|
|
114
|
+
],
|
|
115
|
+
)
|
|
116
|
+
fn = cgutils.get_or_insert_function(
|
|
117
|
+
builder.module, fnty, name="numba_gettyperecord"
|
|
118
|
+
)
|
|
119
|
+
upper = cgutils.alloca_once(builder, ll_intc, name="upper")
|
|
120
|
+
lower = cgutils.alloca_once(builder, ll_intc, name="lower")
|
|
121
|
+
title = cgutils.alloca_once(builder, ll_intc, name="title")
|
|
122
|
+
decimal = cgutils.alloca_once(builder, ll_uchar, name="decimal")
|
|
123
|
+
digit = cgutils.alloca_once(builder, ll_uchar, name="digit")
|
|
124
|
+
flags = cgutils.alloca_once(builder, ll_ushort, name="flags")
|
|
125
|
+
|
|
126
|
+
byref = [upper, lower, title, decimal, digit, flags]
|
|
127
|
+
builder.call(fn, [args[0]] + byref)
|
|
128
|
+
buf = []
|
|
129
|
+
for x in byref:
|
|
130
|
+
buf.append(builder.load(x))
|
|
131
|
+
|
|
132
|
+
res = context.make_tuple(builder, signature.return_type, tuple(buf))
|
|
133
|
+
return impl_ret_untracked(context, builder, signature.return_type, res)
|
|
134
|
+
|
|
135
|
+
tupty = types.NamedTuple(
|
|
136
|
+
[
|
|
137
|
+
types.intc,
|
|
138
|
+
types.intc,
|
|
139
|
+
types.intc,
|
|
140
|
+
types.uchar,
|
|
141
|
+
types.uchar,
|
|
142
|
+
types.ushort,
|
|
143
|
+
],
|
|
144
|
+
typerecord,
|
|
145
|
+
)
|
|
146
|
+
sig = tupty(_Py_UCS4)
|
|
147
|
+
return sig, details
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
@overload(_PyUnicode_gettyperecord)
|
|
151
|
+
def gettyperecord_impl(a):
|
|
152
|
+
"""
|
|
153
|
+
Provides a _PyUnicode_gettyperecord binding, for convenience it will accept
|
|
154
|
+
single character strings and code points.
|
|
155
|
+
"""
|
|
156
|
+
if isinstance(a, types.UnicodeType):
|
|
157
|
+
from numba.cuda.cpython.unicode import _get_code_point
|
|
158
|
+
|
|
159
|
+
def impl(a):
|
|
160
|
+
if len(a) > 1:
|
|
161
|
+
msg = "gettyperecord takes a single unicode character"
|
|
162
|
+
raise ValueError(msg)
|
|
163
|
+
code_point = _get_code_point(a, 0)
|
|
164
|
+
data = _gettyperecord_impl(_Py_UCS4(code_point))
|
|
165
|
+
return data
|
|
166
|
+
|
|
167
|
+
return impl
|
|
168
|
+
if isinstance(a, types.Integer):
|
|
169
|
+
return lambda a: _gettyperecord_impl(_Py_UCS4(a))
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
# whilst it's possible to grab the _PyUnicode_ExtendedCase symbol as it's global
|
|
173
|
+
# it is safer to use a defined api:
|
|
174
|
+
@intrinsic
|
|
175
|
+
def _PyUnicode_ExtendedCase(typingctx, index):
|
|
176
|
+
"""
|
|
177
|
+
Accessor function for the _PyUnicode_ExtendedCase array, binds to
|
|
178
|
+
numba_get_PyUnicode_ExtendedCase which wraps the array and does the lookup
|
|
179
|
+
"""
|
|
180
|
+
if not isinstance(index, types.Integer):
|
|
181
|
+
raise TypingError("Expected an index")
|
|
182
|
+
|
|
183
|
+
def details(context, builder, signature, args):
|
|
184
|
+
ll_Py_UCS4 = context.get_value_type(_Py_UCS4)
|
|
185
|
+
ll_intc = context.get_value_type(types.intc)
|
|
186
|
+
fnty = llvmlite.ir.FunctionType(ll_Py_UCS4, [ll_intc])
|
|
187
|
+
fn = cgutils.get_or_insert_function(
|
|
188
|
+
builder.module, fnty, name="numba_get_PyUnicode_ExtendedCase"
|
|
189
|
+
)
|
|
190
|
+
return builder.call(fn, [args[0]])
|
|
191
|
+
|
|
192
|
+
sig = _Py_UCS4(types.intc)
|
|
193
|
+
return sig, details
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
# The following functions are replications of the functions with the same name
|
|
197
|
+
# in CPython's Objects/unicodectype.c
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L64-L71 # noqa: E501
|
|
201
|
+
@register_jitable
|
|
202
|
+
def _PyUnicode_ToTitlecase(ch):
|
|
203
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
204
|
+
if ctype.flags & _PyUnicode_TyperecordMasks.EXTENDED_CASE_MASK:
|
|
205
|
+
return _PyUnicode_ExtendedCase(ctype.title & 0xFFFF)
|
|
206
|
+
return ch + ctype.title
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L76-L81 # noqa: E501
|
|
210
|
+
@register_jitable
|
|
211
|
+
def _PyUnicode_IsTitlecase(ch):
|
|
212
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
213
|
+
return ctype.flags & _PyUnicode_TyperecordMasks.TITLE_MASK != 0
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L86-L91 # noqa: E501
|
|
217
|
+
@register_jitable
|
|
218
|
+
def _PyUnicode_IsXidStart(ch):
|
|
219
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
220
|
+
return ctype.flags & _PyUnicode_TyperecordMasks.XID_START_MASK != 0
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L96-L101 # noqa: E501
|
|
224
|
+
@register_jitable
|
|
225
|
+
def _PyUnicode_IsXidContinue(ch):
|
|
226
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
227
|
+
return ctype.flags & _PyUnicode_TyperecordMasks.XID_CONTINUE_MASK != 0
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
@register_jitable
|
|
231
|
+
def _PyUnicode_ToDecimalDigit(ch):
|
|
232
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
233
|
+
if ctype.flags & _PyUnicode_TyperecordMasks.DECIMAL_MASK:
|
|
234
|
+
return ctype.decimal
|
|
235
|
+
return -1
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L123-L1128 # noqa: E501
|
|
239
|
+
@register_jitable
|
|
240
|
+
def _PyUnicode_ToDigit(ch):
|
|
241
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
242
|
+
if ctype.flags & _PyUnicode_TyperecordMasks.DIGIT_MASK:
|
|
243
|
+
return ctype.digit
|
|
244
|
+
return -1
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L140-L145 # noqa: E501
|
|
248
|
+
@register_jitable
|
|
249
|
+
def _PyUnicode_IsNumeric(ch):
|
|
250
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
251
|
+
return ctype.flags & _PyUnicode_TyperecordMasks.NUMERIC_MASK != 0
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L160-L165 # noqa: E501
|
|
255
|
+
@register_jitable
|
|
256
|
+
def _PyUnicode_IsPrintable(ch):
|
|
257
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
258
|
+
return ctype.flags & _PyUnicode_TyperecordMasks.PRINTABLE_MASK != 0
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L170-L175 # noqa: E501
|
|
262
|
+
@register_jitable
|
|
263
|
+
def _PyUnicode_IsLowercase(ch):
|
|
264
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
265
|
+
return ctype.flags & _PyUnicode_TyperecordMasks.LOWER_MASK != 0
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L180-L185 # noqa: E501
|
|
269
|
+
@register_jitable
|
|
270
|
+
def _PyUnicode_IsUppercase(ch):
|
|
271
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
272
|
+
return ctype.flags & _PyUnicode_TyperecordMasks.UPPER_MASK != 0
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
@register_jitable
|
|
276
|
+
def _PyUnicode_IsLineBreak(ch):
|
|
277
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
278
|
+
return ctype.flags & _PyUnicode_TyperecordMasks.LINEBREAK_MASK != 0
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
@register_jitable
|
|
282
|
+
def _PyUnicode_ToUppercase(ch):
|
|
283
|
+
raise NotImplementedError
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
@register_jitable
|
|
287
|
+
def _PyUnicode_ToLowercase(ch):
|
|
288
|
+
raise NotImplementedError
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
# From: https://github.com/python/cpython/blob/201c8f79450628241574fba940e08107178dc3a5/Objects/unicodectype.c#L211-L225 # noqa: E501
|
|
292
|
+
@register_jitable
|
|
293
|
+
def _PyUnicode_ToLowerFull(ch, res):
|
|
294
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
295
|
+
if ctype.flags & _PyUnicode_TyperecordMasks.EXTENDED_CASE_MASK:
|
|
296
|
+
index = ctype.lower & 0xFFFF
|
|
297
|
+
n = ctype.lower >> 24
|
|
298
|
+
for i in range(n):
|
|
299
|
+
res[i] = _PyUnicode_ExtendedCase(index + i)
|
|
300
|
+
return n
|
|
301
|
+
res[0] = ch + ctype.lower
|
|
302
|
+
return 1
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
# From: https://github.com/python/cpython/blob/201c8f79450628241574fba940e08107178dc3a5/Objects/unicodectype.c#L227-L241 # noqa: E501
|
|
306
|
+
@register_jitable
|
|
307
|
+
def _PyUnicode_ToTitleFull(ch, res):
|
|
308
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
309
|
+
if ctype.flags & _PyUnicode_TyperecordMasks.EXTENDED_CASE_MASK:
|
|
310
|
+
index = ctype.title & 0xFFFF
|
|
311
|
+
n = ctype.title >> 24
|
|
312
|
+
for i in range(n):
|
|
313
|
+
res[i] = _PyUnicode_ExtendedCase(index + i)
|
|
314
|
+
return n
|
|
315
|
+
res[0] = ch + ctype.title
|
|
316
|
+
return 1
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L243-L257 # noqa: E501
|
|
320
|
+
@register_jitable
|
|
321
|
+
def _PyUnicode_ToUpperFull(ch, res):
|
|
322
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
323
|
+
if ctype.flags & _PyUnicode_TyperecordMasks.EXTENDED_CASE_MASK:
|
|
324
|
+
index = ctype.upper & 0xFFFF
|
|
325
|
+
n = ctype.upper >> 24
|
|
326
|
+
for i in range(n):
|
|
327
|
+
# Perhaps needed to use unicode._set_code_point() here
|
|
328
|
+
res[i] = _PyUnicode_ExtendedCase(index + i)
|
|
329
|
+
return n
|
|
330
|
+
res[0] = ch + ctype.upper
|
|
331
|
+
return 1
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L259-L272 # noqa: E501
|
|
335
|
+
@register_jitable
|
|
336
|
+
def _PyUnicode_ToFoldedFull(ch, res):
|
|
337
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
338
|
+
extended_case_mask = _PyUnicode_TyperecordMasks.EXTENDED_CASE_MASK
|
|
339
|
+
if ctype.flags & extended_case_mask and (ctype.lower >> 20) & 7:
|
|
340
|
+
index = (ctype.lower & 0xFFFF) + (ctype.lower >> 24)
|
|
341
|
+
n = (ctype.lower >> 20) & 7
|
|
342
|
+
for i in range(n):
|
|
343
|
+
res[i] = _PyUnicode_ExtendedCase(index + i)
|
|
344
|
+
return n
|
|
345
|
+
return _PyUnicode_ToLowerFull(ch, res)
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L274-L279 # noqa: E501
|
|
349
|
+
@register_jitable
|
|
350
|
+
def _PyUnicode_IsCased(ch):
|
|
351
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
352
|
+
return ctype.flags & _PyUnicode_TyperecordMasks.CASED_MASK != 0
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L281-L286 # noqa: E501
|
|
356
|
+
@register_jitable
|
|
357
|
+
def _PyUnicode_IsCaseIgnorable(ch):
|
|
358
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
359
|
+
return ctype.flags & _PyUnicode_TyperecordMasks.CASE_IGNORABLE_MASK != 0
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L123-L135 # noqa: E501
|
|
363
|
+
@register_jitable
|
|
364
|
+
def _PyUnicode_IsDigit(ch):
|
|
365
|
+
if _PyUnicode_ToDigit(ch) < 0:
|
|
366
|
+
return 0
|
|
367
|
+
return 1
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L106-L118 # noqa: E501
|
|
371
|
+
@register_jitable
|
|
372
|
+
def _PyUnicode_IsDecimalDigit(ch):
|
|
373
|
+
if _PyUnicode_ToDecimalDigit(ch) < 0:
|
|
374
|
+
return 0
|
|
375
|
+
return 1
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Objects/unicodectype.c#L291-L296 # noqa: E501
|
|
379
|
+
@register_jitable
|
|
380
|
+
def _PyUnicode_IsSpace(ch):
|
|
381
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
382
|
+
return ctype.flags & _PyUnicode_TyperecordMasks.SPACE_MASK != 0
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
@register_jitable
|
|
386
|
+
def _PyUnicode_IsAlpha(ch):
|
|
387
|
+
ctype = _PyUnicode_gettyperecord(ch)
|
|
388
|
+
return ctype.flags & _PyUnicode_TyperecordMasks.ALPHA_MASK != 0
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
# End code related to/from CPython's unicodectype impl
|
|
392
|
+
# ------------------------------------------------------------------------------
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
# ------------------------------------------------------------------------------
|
|
396
|
+
# Start code related to/from CPython's pyctype
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
# From the definition in CPython's Include/pyctype.h
|
|
400
|
+
# From: https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Include/pyctype.h#L5-L11 # noqa: E501
|
|
401
|
+
class _PY_CTF(IntEnum):
|
|
402
|
+
LOWER = 0x01
|
|
403
|
+
UPPER = 0x02
|
|
404
|
+
ALPHA = 0x01 | 0x02
|
|
405
|
+
DIGIT = 0x04
|
|
406
|
+
ALNUM = 0x01 | 0x02 | 0x04
|
|
407
|
+
SPACE = 0x08
|
|
408
|
+
XDIGIT = 0x10
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
# From the definition in CPython's Python/pyctype.c
|
|
412
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Python/pyctype.c#L5 # noqa: E501
|
|
413
|
+
_Py_ctype_table = np.array(
|
|
414
|
+
[
|
|
415
|
+
0, # 0x0 '\x00'
|
|
416
|
+
0, # 0x1 '\x01'
|
|
417
|
+
0, # 0x2 '\x02'
|
|
418
|
+
0, # 0x3 '\x03'
|
|
419
|
+
0, # 0x4 '\x04'
|
|
420
|
+
0, # 0x5 '\x05'
|
|
421
|
+
0, # 0x6 '\x06'
|
|
422
|
+
0, # 0x7 '\x07'
|
|
423
|
+
0, # 0x8 '\x08'
|
|
424
|
+
_PY_CTF.SPACE, # 0x9 '\t'
|
|
425
|
+
_PY_CTF.SPACE, # 0xa '\n'
|
|
426
|
+
_PY_CTF.SPACE, # 0xb '\v'
|
|
427
|
+
_PY_CTF.SPACE, # 0xc '\f'
|
|
428
|
+
_PY_CTF.SPACE, # 0xd '\r'
|
|
429
|
+
0, # 0xe '\x0e'
|
|
430
|
+
0, # 0xf '\x0f'
|
|
431
|
+
0, # 0x10 '\x10'
|
|
432
|
+
0, # 0x11 '\x11'
|
|
433
|
+
0, # 0x12 '\x12'
|
|
434
|
+
0, # 0x13 '\x13'
|
|
435
|
+
0, # 0x14 '\x14'
|
|
436
|
+
0, # 0x15 '\x15'
|
|
437
|
+
0, # 0x16 '\x16'
|
|
438
|
+
0, # 0x17 '\x17'
|
|
439
|
+
0, # 0x18 '\x18'
|
|
440
|
+
0, # 0x19 '\x19'
|
|
441
|
+
0, # 0x1a '\x1a'
|
|
442
|
+
0, # 0x1b '\x1b'
|
|
443
|
+
0, # 0x1c '\x1c'
|
|
444
|
+
0, # 0x1d '\x1d'
|
|
445
|
+
0, # 0x1e '\x1e'
|
|
446
|
+
0, # 0x1f '\x1f'
|
|
447
|
+
_PY_CTF.SPACE, # 0x20 ' '
|
|
448
|
+
0, # 0x21 '!'
|
|
449
|
+
0, # 0x22 '"'
|
|
450
|
+
0, # 0x23 '#'
|
|
451
|
+
0, # 0x24 '$'
|
|
452
|
+
0, # 0x25 '%'
|
|
453
|
+
0, # 0x26 '&'
|
|
454
|
+
0, # 0x27 "'"
|
|
455
|
+
0, # 0x28 '('
|
|
456
|
+
0, # 0x29 ')'
|
|
457
|
+
0, # 0x2a '*'
|
|
458
|
+
0, # 0x2b '+'
|
|
459
|
+
0, # 0x2c ','
|
|
460
|
+
0, # 0x2d '-'
|
|
461
|
+
0, # 0x2e '.'
|
|
462
|
+
0, # 0x2f '/'
|
|
463
|
+
_PY_CTF.DIGIT | _PY_CTF.XDIGIT, # 0x30 '0'
|
|
464
|
+
_PY_CTF.DIGIT | _PY_CTF.XDIGIT, # 0x31 '1'
|
|
465
|
+
_PY_CTF.DIGIT | _PY_CTF.XDIGIT, # 0x32 '2'
|
|
466
|
+
_PY_CTF.DIGIT | _PY_CTF.XDIGIT, # 0x33 '3'
|
|
467
|
+
_PY_CTF.DIGIT | _PY_CTF.XDIGIT, # 0x34 '4'
|
|
468
|
+
_PY_CTF.DIGIT | _PY_CTF.XDIGIT, # 0x35 '5'
|
|
469
|
+
_PY_CTF.DIGIT | _PY_CTF.XDIGIT, # 0x36 '6'
|
|
470
|
+
_PY_CTF.DIGIT | _PY_CTF.XDIGIT, # 0x37 '7'
|
|
471
|
+
_PY_CTF.DIGIT | _PY_CTF.XDIGIT, # 0x38 '8'
|
|
472
|
+
_PY_CTF.DIGIT | _PY_CTF.XDIGIT, # 0x39 '9'
|
|
473
|
+
0, # 0x3a ':'
|
|
474
|
+
0, # 0x3b ';'
|
|
475
|
+
0, # 0x3c '<'
|
|
476
|
+
0, # 0x3d '='
|
|
477
|
+
0, # 0x3e '>'
|
|
478
|
+
0, # 0x3f '?'
|
|
479
|
+
0, # 0x40 '@'
|
|
480
|
+
_PY_CTF.UPPER | _PY_CTF.XDIGIT, # 0x41 'A'
|
|
481
|
+
_PY_CTF.UPPER | _PY_CTF.XDIGIT, # 0x42 'B'
|
|
482
|
+
_PY_CTF.UPPER | _PY_CTF.XDIGIT, # 0x43 'C'
|
|
483
|
+
_PY_CTF.UPPER | _PY_CTF.XDIGIT, # 0x44 'D'
|
|
484
|
+
_PY_CTF.UPPER | _PY_CTF.XDIGIT, # 0x45 'E'
|
|
485
|
+
_PY_CTF.UPPER | _PY_CTF.XDIGIT, # 0x46 'F'
|
|
486
|
+
_PY_CTF.UPPER, # 0x47 'G'
|
|
487
|
+
_PY_CTF.UPPER, # 0x48 'H'
|
|
488
|
+
_PY_CTF.UPPER, # 0x49 'I'
|
|
489
|
+
_PY_CTF.UPPER, # 0x4a 'J'
|
|
490
|
+
_PY_CTF.UPPER, # 0x4b 'K'
|
|
491
|
+
_PY_CTF.UPPER, # 0x4c 'L'
|
|
492
|
+
_PY_CTF.UPPER, # 0x4d 'M'
|
|
493
|
+
_PY_CTF.UPPER, # 0x4e 'N'
|
|
494
|
+
_PY_CTF.UPPER, # 0x4f 'O'
|
|
495
|
+
_PY_CTF.UPPER, # 0x50 'P'
|
|
496
|
+
_PY_CTF.UPPER, # 0x51 'Q'
|
|
497
|
+
_PY_CTF.UPPER, # 0x52 'R'
|
|
498
|
+
_PY_CTF.UPPER, # 0x53 'S'
|
|
499
|
+
_PY_CTF.UPPER, # 0x54 'T'
|
|
500
|
+
_PY_CTF.UPPER, # 0x55 'U'
|
|
501
|
+
_PY_CTF.UPPER, # 0x56 'V'
|
|
502
|
+
_PY_CTF.UPPER, # 0x57 'W'
|
|
503
|
+
_PY_CTF.UPPER, # 0x58 'X'
|
|
504
|
+
_PY_CTF.UPPER, # 0x59 'Y'
|
|
505
|
+
_PY_CTF.UPPER, # 0x5a 'Z'
|
|
506
|
+
0, # 0x5b '['
|
|
507
|
+
0, # 0x5c '\\'
|
|
508
|
+
0, # 0x5d ']'
|
|
509
|
+
0, # 0x5e '^'
|
|
510
|
+
0, # 0x5f '_'
|
|
511
|
+
0, # 0x60 '`'
|
|
512
|
+
_PY_CTF.LOWER | _PY_CTF.XDIGIT, # 0x61 'a'
|
|
513
|
+
_PY_CTF.LOWER | _PY_CTF.XDIGIT, # 0x62 'b'
|
|
514
|
+
_PY_CTF.LOWER | _PY_CTF.XDIGIT, # 0x63 'c'
|
|
515
|
+
_PY_CTF.LOWER | _PY_CTF.XDIGIT, # 0x64 'd'
|
|
516
|
+
_PY_CTF.LOWER | _PY_CTF.XDIGIT, # 0x65 'e'
|
|
517
|
+
_PY_CTF.LOWER | _PY_CTF.XDIGIT, # 0x66 'f'
|
|
518
|
+
_PY_CTF.LOWER, # 0x67 'g'
|
|
519
|
+
_PY_CTF.LOWER, # 0x68 'h'
|
|
520
|
+
_PY_CTF.LOWER, # 0x69 'i'
|
|
521
|
+
_PY_CTF.LOWER, # 0x6a 'j'
|
|
522
|
+
_PY_CTF.LOWER, # 0x6b 'k'
|
|
523
|
+
_PY_CTF.LOWER, # 0x6c 'l'
|
|
524
|
+
_PY_CTF.LOWER, # 0x6d 'm'
|
|
525
|
+
_PY_CTF.LOWER, # 0x6e 'n'
|
|
526
|
+
_PY_CTF.LOWER, # 0x6f 'o'
|
|
527
|
+
_PY_CTF.LOWER, # 0x70 'p'
|
|
528
|
+
_PY_CTF.LOWER, # 0x71 'q'
|
|
529
|
+
_PY_CTF.LOWER, # 0x72 'r'
|
|
530
|
+
_PY_CTF.LOWER, # 0x73 's'
|
|
531
|
+
_PY_CTF.LOWER, # 0x74 't'
|
|
532
|
+
_PY_CTF.LOWER, # 0x75 'u'
|
|
533
|
+
_PY_CTF.LOWER, # 0x76 'v'
|
|
534
|
+
_PY_CTF.LOWER, # 0x77 'w'
|
|
535
|
+
_PY_CTF.LOWER, # 0x78 'x'
|
|
536
|
+
_PY_CTF.LOWER, # 0x79 'y'
|
|
537
|
+
_PY_CTF.LOWER, # 0x7a 'z'
|
|
538
|
+
0, # 0x7b '{'
|
|
539
|
+
0, # 0x7c '|'
|
|
540
|
+
0, # 0x7d '}'
|
|
541
|
+
0, # 0x7e '~'
|
|
542
|
+
0, # 0x7f '\x7f'
|
|
543
|
+
0,
|
|
544
|
+
0,
|
|
545
|
+
0,
|
|
546
|
+
0,
|
|
547
|
+
0,
|
|
548
|
+
0,
|
|
549
|
+
0,
|
|
550
|
+
0,
|
|
551
|
+
0,
|
|
552
|
+
0,
|
|
553
|
+
0,
|
|
554
|
+
0,
|
|
555
|
+
0,
|
|
556
|
+
0,
|
|
557
|
+
0,
|
|
558
|
+
0,
|
|
559
|
+
0,
|
|
560
|
+
0,
|
|
561
|
+
0,
|
|
562
|
+
0,
|
|
563
|
+
0,
|
|
564
|
+
0,
|
|
565
|
+
0,
|
|
566
|
+
0,
|
|
567
|
+
0,
|
|
568
|
+
0,
|
|
569
|
+
0,
|
|
570
|
+
0,
|
|
571
|
+
0,
|
|
572
|
+
0,
|
|
573
|
+
0,
|
|
574
|
+
0,
|
|
575
|
+
0,
|
|
576
|
+
0,
|
|
577
|
+
0,
|
|
578
|
+
0,
|
|
579
|
+
0,
|
|
580
|
+
0,
|
|
581
|
+
0,
|
|
582
|
+
0,
|
|
583
|
+
0,
|
|
584
|
+
0,
|
|
585
|
+
0,
|
|
586
|
+
0,
|
|
587
|
+
0,
|
|
588
|
+
0,
|
|
589
|
+
0,
|
|
590
|
+
0,
|
|
591
|
+
0,
|
|
592
|
+
0,
|
|
593
|
+
0,
|
|
594
|
+
0,
|
|
595
|
+
0,
|
|
596
|
+
0,
|
|
597
|
+
0,
|
|
598
|
+
0,
|
|
599
|
+
0,
|
|
600
|
+
0,
|
|
601
|
+
0,
|
|
602
|
+
0,
|
|
603
|
+
0,
|
|
604
|
+
0,
|
|
605
|
+
0,
|
|
606
|
+
0,
|
|
607
|
+
0,
|
|
608
|
+
0,
|
|
609
|
+
0,
|
|
610
|
+
0,
|
|
611
|
+
0,
|
|
612
|
+
0,
|
|
613
|
+
0,
|
|
614
|
+
0,
|
|
615
|
+
0,
|
|
616
|
+
0,
|
|
617
|
+
0,
|
|
618
|
+
0,
|
|
619
|
+
0,
|
|
620
|
+
0,
|
|
621
|
+
0,
|
|
622
|
+
0,
|
|
623
|
+
0,
|
|
624
|
+
0,
|
|
625
|
+
0,
|
|
626
|
+
0,
|
|
627
|
+
0,
|
|
628
|
+
0,
|
|
629
|
+
0,
|
|
630
|
+
0,
|
|
631
|
+
0,
|
|
632
|
+
0,
|
|
633
|
+
0,
|
|
634
|
+
0,
|
|
635
|
+
0,
|
|
636
|
+
0,
|
|
637
|
+
0,
|
|
638
|
+
0,
|
|
639
|
+
0,
|
|
640
|
+
0,
|
|
641
|
+
0,
|
|
642
|
+
0,
|
|
643
|
+
0,
|
|
644
|
+
0,
|
|
645
|
+
0,
|
|
646
|
+
0,
|
|
647
|
+
0,
|
|
648
|
+
0,
|
|
649
|
+
0,
|
|
650
|
+
0,
|
|
651
|
+
0,
|
|
652
|
+
0,
|
|
653
|
+
0,
|
|
654
|
+
0,
|
|
655
|
+
0,
|
|
656
|
+
0,
|
|
657
|
+
0,
|
|
658
|
+
0,
|
|
659
|
+
0,
|
|
660
|
+
0,
|
|
661
|
+
0,
|
|
662
|
+
0,
|
|
663
|
+
0,
|
|
664
|
+
0,
|
|
665
|
+
0,
|
|
666
|
+
0,
|
|
667
|
+
0,
|
|
668
|
+
0,
|
|
669
|
+
0,
|
|
670
|
+
0,
|
|
671
|
+
],
|
|
672
|
+
dtype=np.intc,
|
|
673
|
+
)
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
# From the definition in CPython's Python/pyctype.c
|
|
677
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Python/pyctype.c#L145 # noqa: E501
|
|
678
|
+
_Py_ctype_tolower = np.array(
|
|
679
|
+
[
|
|
680
|
+
0x00,
|
|
681
|
+
0x01,
|
|
682
|
+
0x02,
|
|
683
|
+
0x03,
|
|
684
|
+
0x04,
|
|
685
|
+
0x05,
|
|
686
|
+
0x06,
|
|
687
|
+
0x07,
|
|
688
|
+
0x08,
|
|
689
|
+
0x09,
|
|
690
|
+
0x0A,
|
|
691
|
+
0x0B,
|
|
692
|
+
0x0C,
|
|
693
|
+
0x0D,
|
|
694
|
+
0x0E,
|
|
695
|
+
0x0F,
|
|
696
|
+
0x10,
|
|
697
|
+
0x11,
|
|
698
|
+
0x12,
|
|
699
|
+
0x13,
|
|
700
|
+
0x14,
|
|
701
|
+
0x15,
|
|
702
|
+
0x16,
|
|
703
|
+
0x17,
|
|
704
|
+
0x18,
|
|
705
|
+
0x19,
|
|
706
|
+
0x1A,
|
|
707
|
+
0x1B,
|
|
708
|
+
0x1C,
|
|
709
|
+
0x1D,
|
|
710
|
+
0x1E,
|
|
711
|
+
0x1F,
|
|
712
|
+
0x20,
|
|
713
|
+
0x21,
|
|
714
|
+
0x22,
|
|
715
|
+
0x23,
|
|
716
|
+
0x24,
|
|
717
|
+
0x25,
|
|
718
|
+
0x26,
|
|
719
|
+
0x27,
|
|
720
|
+
0x28,
|
|
721
|
+
0x29,
|
|
722
|
+
0x2A,
|
|
723
|
+
0x2B,
|
|
724
|
+
0x2C,
|
|
725
|
+
0x2D,
|
|
726
|
+
0x2E,
|
|
727
|
+
0x2F,
|
|
728
|
+
0x30,
|
|
729
|
+
0x31,
|
|
730
|
+
0x32,
|
|
731
|
+
0x33,
|
|
732
|
+
0x34,
|
|
733
|
+
0x35,
|
|
734
|
+
0x36,
|
|
735
|
+
0x37,
|
|
736
|
+
0x38,
|
|
737
|
+
0x39,
|
|
738
|
+
0x3A,
|
|
739
|
+
0x3B,
|
|
740
|
+
0x3C,
|
|
741
|
+
0x3D,
|
|
742
|
+
0x3E,
|
|
743
|
+
0x3F,
|
|
744
|
+
0x40,
|
|
745
|
+
0x61,
|
|
746
|
+
0x62,
|
|
747
|
+
0x63,
|
|
748
|
+
0x64,
|
|
749
|
+
0x65,
|
|
750
|
+
0x66,
|
|
751
|
+
0x67,
|
|
752
|
+
0x68,
|
|
753
|
+
0x69,
|
|
754
|
+
0x6A,
|
|
755
|
+
0x6B,
|
|
756
|
+
0x6C,
|
|
757
|
+
0x6D,
|
|
758
|
+
0x6E,
|
|
759
|
+
0x6F,
|
|
760
|
+
0x70,
|
|
761
|
+
0x71,
|
|
762
|
+
0x72,
|
|
763
|
+
0x73,
|
|
764
|
+
0x74,
|
|
765
|
+
0x75,
|
|
766
|
+
0x76,
|
|
767
|
+
0x77,
|
|
768
|
+
0x78,
|
|
769
|
+
0x79,
|
|
770
|
+
0x7A,
|
|
771
|
+
0x5B,
|
|
772
|
+
0x5C,
|
|
773
|
+
0x5D,
|
|
774
|
+
0x5E,
|
|
775
|
+
0x5F,
|
|
776
|
+
0x60,
|
|
777
|
+
0x61,
|
|
778
|
+
0x62,
|
|
779
|
+
0x63,
|
|
780
|
+
0x64,
|
|
781
|
+
0x65,
|
|
782
|
+
0x66,
|
|
783
|
+
0x67,
|
|
784
|
+
0x68,
|
|
785
|
+
0x69,
|
|
786
|
+
0x6A,
|
|
787
|
+
0x6B,
|
|
788
|
+
0x6C,
|
|
789
|
+
0x6D,
|
|
790
|
+
0x6E,
|
|
791
|
+
0x6F,
|
|
792
|
+
0x70,
|
|
793
|
+
0x71,
|
|
794
|
+
0x72,
|
|
795
|
+
0x73,
|
|
796
|
+
0x74,
|
|
797
|
+
0x75,
|
|
798
|
+
0x76,
|
|
799
|
+
0x77,
|
|
800
|
+
0x78,
|
|
801
|
+
0x79,
|
|
802
|
+
0x7A,
|
|
803
|
+
0x7B,
|
|
804
|
+
0x7C,
|
|
805
|
+
0x7D,
|
|
806
|
+
0x7E,
|
|
807
|
+
0x7F,
|
|
808
|
+
0x80,
|
|
809
|
+
0x81,
|
|
810
|
+
0x82,
|
|
811
|
+
0x83,
|
|
812
|
+
0x84,
|
|
813
|
+
0x85,
|
|
814
|
+
0x86,
|
|
815
|
+
0x87,
|
|
816
|
+
0x88,
|
|
817
|
+
0x89,
|
|
818
|
+
0x8A,
|
|
819
|
+
0x8B,
|
|
820
|
+
0x8C,
|
|
821
|
+
0x8D,
|
|
822
|
+
0x8E,
|
|
823
|
+
0x8F,
|
|
824
|
+
0x90,
|
|
825
|
+
0x91,
|
|
826
|
+
0x92,
|
|
827
|
+
0x93,
|
|
828
|
+
0x94,
|
|
829
|
+
0x95,
|
|
830
|
+
0x96,
|
|
831
|
+
0x97,
|
|
832
|
+
0x98,
|
|
833
|
+
0x99,
|
|
834
|
+
0x9A,
|
|
835
|
+
0x9B,
|
|
836
|
+
0x9C,
|
|
837
|
+
0x9D,
|
|
838
|
+
0x9E,
|
|
839
|
+
0x9F,
|
|
840
|
+
0xA0,
|
|
841
|
+
0xA1,
|
|
842
|
+
0xA2,
|
|
843
|
+
0xA3,
|
|
844
|
+
0xA4,
|
|
845
|
+
0xA5,
|
|
846
|
+
0xA6,
|
|
847
|
+
0xA7,
|
|
848
|
+
0xA8,
|
|
849
|
+
0xA9,
|
|
850
|
+
0xAA,
|
|
851
|
+
0xAB,
|
|
852
|
+
0xAC,
|
|
853
|
+
0xAD,
|
|
854
|
+
0xAE,
|
|
855
|
+
0xAF,
|
|
856
|
+
0xB0,
|
|
857
|
+
0xB1,
|
|
858
|
+
0xB2,
|
|
859
|
+
0xB3,
|
|
860
|
+
0xB4,
|
|
861
|
+
0xB5,
|
|
862
|
+
0xB6,
|
|
863
|
+
0xB7,
|
|
864
|
+
0xB8,
|
|
865
|
+
0xB9,
|
|
866
|
+
0xBA,
|
|
867
|
+
0xBB,
|
|
868
|
+
0xBC,
|
|
869
|
+
0xBD,
|
|
870
|
+
0xBE,
|
|
871
|
+
0xBF,
|
|
872
|
+
0xC0,
|
|
873
|
+
0xC1,
|
|
874
|
+
0xC2,
|
|
875
|
+
0xC3,
|
|
876
|
+
0xC4,
|
|
877
|
+
0xC5,
|
|
878
|
+
0xC6,
|
|
879
|
+
0xC7,
|
|
880
|
+
0xC8,
|
|
881
|
+
0xC9,
|
|
882
|
+
0xCA,
|
|
883
|
+
0xCB,
|
|
884
|
+
0xCC,
|
|
885
|
+
0xCD,
|
|
886
|
+
0xCE,
|
|
887
|
+
0xCF,
|
|
888
|
+
0xD0,
|
|
889
|
+
0xD1,
|
|
890
|
+
0xD2,
|
|
891
|
+
0xD3,
|
|
892
|
+
0xD4,
|
|
893
|
+
0xD5,
|
|
894
|
+
0xD6,
|
|
895
|
+
0xD7,
|
|
896
|
+
0xD8,
|
|
897
|
+
0xD9,
|
|
898
|
+
0xDA,
|
|
899
|
+
0xDB,
|
|
900
|
+
0xDC,
|
|
901
|
+
0xDD,
|
|
902
|
+
0xDE,
|
|
903
|
+
0xDF,
|
|
904
|
+
0xE0,
|
|
905
|
+
0xE1,
|
|
906
|
+
0xE2,
|
|
907
|
+
0xE3,
|
|
908
|
+
0xE4,
|
|
909
|
+
0xE5,
|
|
910
|
+
0xE6,
|
|
911
|
+
0xE7,
|
|
912
|
+
0xE8,
|
|
913
|
+
0xE9,
|
|
914
|
+
0xEA,
|
|
915
|
+
0xEB,
|
|
916
|
+
0xEC,
|
|
917
|
+
0xED,
|
|
918
|
+
0xEE,
|
|
919
|
+
0xEF,
|
|
920
|
+
0xF0,
|
|
921
|
+
0xF1,
|
|
922
|
+
0xF2,
|
|
923
|
+
0xF3,
|
|
924
|
+
0xF4,
|
|
925
|
+
0xF5,
|
|
926
|
+
0xF6,
|
|
927
|
+
0xF7,
|
|
928
|
+
0xF8,
|
|
929
|
+
0xF9,
|
|
930
|
+
0xFA,
|
|
931
|
+
0xFB,
|
|
932
|
+
0xFC,
|
|
933
|
+
0xFD,
|
|
934
|
+
0xFE,
|
|
935
|
+
0xFF,
|
|
936
|
+
],
|
|
937
|
+
dtype=np.uint8,
|
|
938
|
+
)
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
# From the definition in CPython's Python/pyctype.c
|
|
942
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Python/pyctype.c#L180
|
|
943
|
+
_Py_ctype_toupper = np.array(
|
|
944
|
+
[
|
|
945
|
+
0x00,
|
|
946
|
+
0x01,
|
|
947
|
+
0x02,
|
|
948
|
+
0x03,
|
|
949
|
+
0x04,
|
|
950
|
+
0x05,
|
|
951
|
+
0x06,
|
|
952
|
+
0x07,
|
|
953
|
+
0x08,
|
|
954
|
+
0x09,
|
|
955
|
+
0x0A,
|
|
956
|
+
0x0B,
|
|
957
|
+
0x0C,
|
|
958
|
+
0x0D,
|
|
959
|
+
0x0E,
|
|
960
|
+
0x0F,
|
|
961
|
+
0x10,
|
|
962
|
+
0x11,
|
|
963
|
+
0x12,
|
|
964
|
+
0x13,
|
|
965
|
+
0x14,
|
|
966
|
+
0x15,
|
|
967
|
+
0x16,
|
|
968
|
+
0x17,
|
|
969
|
+
0x18,
|
|
970
|
+
0x19,
|
|
971
|
+
0x1A,
|
|
972
|
+
0x1B,
|
|
973
|
+
0x1C,
|
|
974
|
+
0x1D,
|
|
975
|
+
0x1E,
|
|
976
|
+
0x1F,
|
|
977
|
+
0x20,
|
|
978
|
+
0x21,
|
|
979
|
+
0x22,
|
|
980
|
+
0x23,
|
|
981
|
+
0x24,
|
|
982
|
+
0x25,
|
|
983
|
+
0x26,
|
|
984
|
+
0x27,
|
|
985
|
+
0x28,
|
|
986
|
+
0x29,
|
|
987
|
+
0x2A,
|
|
988
|
+
0x2B,
|
|
989
|
+
0x2C,
|
|
990
|
+
0x2D,
|
|
991
|
+
0x2E,
|
|
992
|
+
0x2F,
|
|
993
|
+
0x30,
|
|
994
|
+
0x31,
|
|
995
|
+
0x32,
|
|
996
|
+
0x33,
|
|
997
|
+
0x34,
|
|
998
|
+
0x35,
|
|
999
|
+
0x36,
|
|
1000
|
+
0x37,
|
|
1001
|
+
0x38,
|
|
1002
|
+
0x39,
|
|
1003
|
+
0x3A,
|
|
1004
|
+
0x3B,
|
|
1005
|
+
0x3C,
|
|
1006
|
+
0x3D,
|
|
1007
|
+
0x3E,
|
|
1008
|
+
0x3F,
|
|
1009
|
+
0x40,
|
|
1010
|
+
0x41,
|
|
1011
|
+
0x42,
|
|
1012
|
+
0x43,
|
|
1013
|
+
0x44,
|
|
1014
|
+
0x45,
|
|
1015
|
+
0x46,
|
|
1016
|
+
0x47,
|
|
1017
|
+
0x48,
|
|
1018
|
+
0x49,
|
|
1019
|
+
0x4A,
|
|
1020
|
+
0x4B,
|
|
1021
|
+
0x4C,
|
|
1022
|
+
0x4D,
|
|
1023
|
+
0x4E,
|
|
1024
|
+
0x4F,
|
|
1025
|
+
0x50,
|
|
1026
|
+
0x51,
|
|
1027
|
+
0x52,
|
|
1028
|
+
0x53,
|
|
1029
|
+
0x54,
|
|
1030
|
+
0x55,
|
|
1031
|
+
0x56,
|
|
1032
|
+
0x57,
|
|
1033
|
+
0x58,
|
|
1034
|
+
0x59,
|
|
1035
|
+
0x5A,
|
|
1036
|
+
0x5B,
|
|
1037
|
+
0x5C,
|
|
1038
|
+
0x5D,
|
|
1039
|
+
0x5E,
|
|
1040
|
+
0x5F,
|
|
1041
|
+
0x60,
|
|
1042
|
+
0x41,
|
|
1043
|
+
0x42,
|
|
1044
|
+
0x43,
|
|
1045
|
+
0x44,
|
|
1046
|
+
0x45,
|
|
1047
|
+
0x46,
|
|
1048
|
+
0x47,
|
|
1049
|
+
0x48,
|
|
1050
|
+
0x49,
|
|
1051
|
+
0x4A,
|
|
1052
|
+
0x4B,
|
|
1053
|
+
0x4C,
|
|
1054
|
+
0x4D,
|
|
1055
|
+
0x4E,
|
|
1056
|
+
0x4F,
|
|
1057
|
+
0x50,
|
|
1058
|
+
0x51,
|
|
1059
|
+
0x52,
|
|
1060
|
+
0x53,
|
|
1061
|
+
0x54,
|
|
1062
|
+
0x55,
|
|
1063
|
+
0x56,
|
|
1064
|
+
0x57,
|
|
1065
|
+
0x58,
|
|
1066
|
+
0x59,
|
|
1067
|
+
0x5A,
|
|
1068
|
+
0x7B,
|
|
1069
|
+
0x7C,
|
|
1070
|
+
0x7D,
|
|
1071
|
+
0x7E,
|
|
1072
|
+
0x7F,
|
|
1073
|
+
0x80,
|
|
1074
|
+
0x81,
|
|
1075
|
+
0x82,
|
|
1076
|
+
0x83,
|
|
1077
|
+
0x84,
|
|
1078
|
+
0x85,
|
|
1079
|
+
0x86,
|
|
1080
|
+
0x87,
|
|
1081
|
+
0x88,
|
|
1082
|
+
0x89,
|
|
1083
|
+
0x8A,
|
|
1084
|
+
0x8B,
|
|
1085
|
+
0x8C,
|
|
1086
|
+
0x8D,
|
|
1087
|
+
0x8E,
|
|
1088
|
+
0x8F,
|
|
1089
|
+
0x90,
|
|
1090
|
+
0x91,
|
|
1091
|
+
0x92,
|
|
1092
|
+
0x93,
|
|
1093
|
+
0x94,
|
|
1094
|
+
0x95,
|
|
1095
|
+
0x96,
|
|
1096
|
+
0x97,
|
|
1097
|
+
0x98,
|
|
1098
|
+
0x99,
|
|
1099
|
+
0x9A,
|
|
1100
|
+
0x9B,
|
|
1101
|
+
0x9C,
|
|
1102
|
+
0x9D,
|
|
1103
|
+
0x9E,
|
|
1104
|
+
0x9F,
|
|
1105
|
+
0xA0,
|
|
1106
|
+
0xA1,
|
|
1107
|
+
0xA2,
|
|
1108
|
+
0xA3,
|
|
1109
|
+
0xA4,
|
|
1110
|
+
0xA5,
|
|
1111
|
+
0xA6,
|
|
1112
|
+
0xA7,
|
|
1113
|
+
0xA8,
|
|
1114
|
+
0xA9,
|
|
1115
|
+
0xAA,
|
|
1116
|
+
0xAB,
|
|
1117
|
+
0xAC,
|
|
1118
|
+
0xAD,
|
|
1119
|
+
0xAE,
|
|
1120
|
+
0xAF,
|
|
1121
|
+
0xB0,
|
|
1122
|
+
0xB1,
|
|
1123
|
+
0xB2,
|
|
1124
|
+
0xB3,
|
|
1125
|
+
0xB4,
|
|
1126
|
+
0xB5,
|
|
1127
|
+
0xB6,
|
|
1128
|
+
0xB7,
|
|
1129
|
+
0xB8,
|
|
1130
|
+
0xB9,
|
|
1131
|
+
0xBA,
|
|
1132
|
+
0xBB,
|
|
1133
|
+
0xBC,
|
|
1134
|
+
0xBD,
|
|
1135
|
+
0xBE,
|
|
1136
|
+
0xBF,
|
|
1137
|
+
0xC0,
|
|
1138
|
+
0xC1,
|
|
1139
|
+
0xC2,
|
|
1140
|
+
0xC3,
|
|
1141
|
+
0xC4,
|
|
1142
|
+
0xC5,
|
|
1143
|
+
0xC6,
|
|
1144
|
+
0xC7,
|
|
1145
|
+
0xC8,
|
|
1146
|
+
0xC9,
|
|
1147
|
+
0xCA,
|
|
1148
|
+
0xCB,
|
|
1149
|
+
0xCC,
|
|
1150
|
+
0xCD,
|
|
1151
|
+
0xCE,
|
|
1152
|
+
0xCF,
|
|
1153
|
+
0xD0,
|
|
1154
|
+
0xD1,
|
|
1155
|
+
0xD2,
|
|
1156
|
+
0xD3,
|
|
1157
|
+
0xD4,
|
|
1158
|
+
0xD5,
|
|
1159
|
+
0xD6,
|
|
1160
|
+
0xD7,
|
|
1161
|
+
0xD8,
|
|
1162
|
+
0xD9,
|
|
1163
|
+
0xDA,
|
|
1164
|
+
0xDB,
|
|
1165
|
+
0xDC,
|
|
1166
|
+
0xDD,
|
|
1167
|
+
0xDE,
|
|
1168
|
+
0xDF,
|
|
1169
|
+
0xE0,
|
|
1170
|
+
0xE1,
|
|
1171
|
+
0xE2,
|
|
1172
|
+
0xE3,
|
|
1173
|
+
0xE4,
|
|
1174
|
+
0xE5,
|
|
1175
|
+
0xE6,
|
|
1176
|
+
0xE7,
|
|
1177
|
+
0xE8,
|
|
1178
|
+
0xE9,
|
|
1179
|
+
0xEA,
|
|
1180
|
+
0xEB,
|
|
1181
|
+
0xEC,
|
|
1182
|
+
0xED,
|
|
1183
|
+
0xEE,
|
|
1184
|
+
0xEF,
|
|
1185
|
+
0xF0,
|
|
1186
|
+
0xF1,
|
|
1187
|
+
0xF2,
|
|
1188
|
+
0xF3,
|
|
1189
|
+
0xF4,
|
|
1190
|
+
0xF5,
|
|
1191
|
+
0xF6,
|
|
1192
|
+
0xF7,
|
|
1193
|
+
0xF8,
|
|
1194
|
+
0xF9,
|
|
1195
|
+
0xFA,
|
|
1196
|
+
0xFB,
|
|
1197
|
+
0xFC,
|
|
1198
|
+
0xFD,
|
|
1199
|
+
0xFE,
|
|
1200
|
+
0xFF,
|
|
1201
|
+
],
|
|
1202
|
+
dtype=np.uint8,
|
|
1203
|
+
)
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
class _PY_CTF_LB(IntEnum):
|
|
1207
|
+
LINE_BREAK = 0x01
|
|
1208
|
+
LINE_FEED = 0x02
|
|
1209
|
+
CARRIAGE_RETURN = 0x04
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
_Py_ctype_islinebreak = np.array(
|
|
1213
|
+
[
|
|
1214
|
+
0,
|
|
1215
|
+
0,
|
|
1216
|
+
0,
|
|
1217
|
+
0,
|
|
1218
|
+
0,
|
|
1219
|
+
0,
|
|
1220
|
+
0,
|
|
1221
|
+
0,
|
|
1222
|
+
0,
|
|
1223
|
+
0,
|
|
1224
|
+
_PY_CTF_LB.LINE_BREAK | _PY_CTF_LB.LINE_FEED, # 0xa '\n'
|
|
1225
|
+
_PY_CTF_LB.LINE_BREAK, # 0xb '\v'
|
|
1226
|
+
_PY_CTF_LB.LINE_BREAK, # 0xc '\f'
|
|
1227
|
+
_PY_CTF_LB.LINE_BREAK | _PY_CTF_LB.CARRIAGE_RETURN, # 0xd '\r'
|
|
1228
|
+
0,
|
|
1229
|
+
0,
|
|
1230
|
+
0,
|
|
1231
|
+
0,
|
|
1232
|
+
0,
|
|
1233
|
+
0,
|
|
1234
|
+
0,
|
|
1235
|
+
0,
|
|
1236
|
+
0,
|
|
1237
|
+
0,
|
|
1238
|
+
0,
|
|
1239
|
+
0,
|
|
1240
|
+
0,
|
|
1241
|
+
0,
|
|
1242
|
+
_PY_CTF_LB.LINE_BREAK, # 0x1c '\x1c'
|
|
1243
|
+
_PY_CTF_LB.LINE_BREAK, # 0x1d '\x1d'
|
|
1244
|
+
_PY_CTF_LB.LINE_BREAK, # 0x1e '\x1e'
|
|
1245
|
+
0,
|
|
1246
|
+
0,
|
|
1247
|
+
0,
|
|
1248
|
+
0,
|
|
1249
|
+
0,
|
|
1250
|
+
0,
|
|
1251
|
+
0,
|
|
1252
|
+
0,
|
|
1253
|
+
0,
|
|
1254
|
+
0,
|
|
1255
|
+
0,
|
|
1256
|
+
0,
|
|
1257
|
+
0,
|
|
1258
|
+
0,
|
|
1259
|
+
0,
|
|
1260
|
+
0,
|
|
1261
|
+
0,
|
|
1262
|
+
0,
|
|
1263
|
+
0,
|
|
1264
|
+
0,
|
|
1265
|
+
0,
|
|
1266
|
+
0,
|
|
1267
|
+
0,
|
|
1268
|
+
0,
|
|
1269
|
+
0,
|
|
1270
|
+
0,
|
|
1271
|
+
0,
|
|
1272
|
+
0,
|
|
1273
|
+
0,
|
|
1274
|
+
0,
|
|
1275
|
+
0,
|
|
1276
|
+
0,
|
|
1277
|
+
0,
|
|
1278
|
+
0,
|
|
1279
|
+
0,
|
|
1280
|
+
0,
|
|
1281
|
+
0,
|
|
1282
|
+
0,
|
|
1283
|
+
0,
|
|
1284
|
+
0,
|
|
1285
|
+
0,
|
|
1286
|
+
0,
|
|
1287
|
+
0,
|
|
1288
|
+
0,
|
|
1289
|
+
0,
|
|
1290
|
+
0,
|
|
1291
|
+
0,
|
|
1292
|
+
0,
|
|
1293
|
+
0,
|
|
1294
|
+
0,
|
|
1295
|
+
0,
|
|
1296
|
+
0,
|
|
1297
|
+
0,
|
|
1298
|
+
0,
|
|
1299
|
+
0,
|
|
1300
|
+
0,
|
|
1301
|
+
0,
|
|
1302
|
+
0,
|
|
1303
|
+
0,
|
|
1304
|
+
0,
|
|
1305
|
+
0,
|
|
1306
|
+
0,
|
|
1307
|
+
0,
|
|
1308
|
+
0,
|
|
1309
|
+
0,
|
|
1310
|
+
0,
|
|
1311
|
+
0,
|
|
1312
|
+
0,
|
|
1313
|
+
0,
|
|
1314
|
+
0,
|
|
1315
|
+
0,
|
|
1316
|
+
0,
|
|
1317
|
+
0,
|
|
1318
|
+
0,
|
|
1319
|
+
0,
|
|
1320
|
+
0,
|
|
1321
|
+
0,
|
|
1322
|
+
0,
|
|
1323
|
+
0,
|
|
1324
|
+
0,
|
|
1325
|
+
0,
|
|
1326
|
+
0,
|
|
1327
|
+
0,
|
|
1328
|
+
0,
|
|
1329
|
+
0,
|
|
1330
|
+
0,
|
|
1331
|
+
0,
|
|
1332
|
+
0,
|
|
1333
|
+
0,
|
|
1334
|
+
0,
|
|
1335
|
+
0,
|
|
1336
|
+
0,
|
|
1337
|
+
0,
|
|
1338
|
+
0,
|
|
1339
|
+
0,
|
|
1340
|
+
0,
|
|
1341
|
+
0,
|
|
1342
|
+
0,
|
|
1343
|
+
0,
|
|
1344
|
+
0,
|
|
1345
|
+
0,
|
|
1346
|
+
0,
|
|
1347
|
+
_PY_CTF_LB.LINE_BREAK, # 0x85 '\x85'
|
|
1348
|
+
0,
|
|
1349
|
+
0,
|
|
1350
|
+
0,
|
|
1351
|
+
0,
|
|
1352
|
+
0,
|
|
1353
|
+
0,
|
|
1354
|
+
0,
|
|
1355
|
+
0,
|
|
1356
|
+
0,
|
|
1357
|
+
0,
|
|
1358
|
+
0,
|
|
1359
|
+
0,
|
|
1360
|
+
0,
|
|
1361
|
+
0,
|
|
1362
|
+
0,
|
|
1363
|
+
0,
|
|
1364
|
+
0,
|
|
1365
|
+
0,
|
|
1366
|
+
0,
|
|
1367
|
+
0,
|
|
1368
|
+
0,
|
|
1369
|
+
0,
|
|
1370
|
+
0,
|
|
1371
|
+
0,
|
|
1372
|
+
0,
|
|
1373
|
+
0,
|
|
1374
|
+
0,
|
|
1375
|
+
0,
|
|
1376
|
+
0,
|
|
1377
|
+
0,
|
|
1378
|
+
0,
|
|
1379
|
+
0,
|
|
1380
|
+
0,
|
|
1381
|
+
0,
|
|
1382
|
+
0,
|
|
1383
|
+
0,
|
|
1384
|
+
0,
|
|
1385
|
+
0,
|
|
1386
|
+
0,
|
|
1387
|
+
0,
|
|
1388
|
+
0,
|
|
1389
|
+
0,
|
|
1390
|
+
0,
|
|
1391
|
+
0,
|
|
1392
|
+
0,
|
|
1393
|
+
0,
|
|
1394
|
+
0,
|
|
1395
|
+
0,
|
|
1396
|
+
0,
|
|
1397
|
+
0,
|
|
1398
|
+
0,
|
|
1399
|
+
0,
|
|
1400
|
+
0,
|
|
1401
|
+
0,
|
|
1402
|
+
0,
|
|
1403
|
+
0,
|
|
1404
|
+
0,
|
|
1405
|
+
0,
|
|
1406
|
+
0,
|
|
1407
|
+
0,
|
|
1408
|
+
0,
|
|
1409
|
+
0,
|
|
1410
|
+
0,
|
|
1411
|
+
0,
|
|
1412
|
+
0,
|
|
1413
|
+
0,
|
|
1414
|
+
0,
|
|
1415
|
+
0,
|
|
1416
|
+
0,
|
|
1417
|
+
0,
|
|
1418
|
+
0,
|
|
1419
|
+
0,
|
|
1420
|
+
0,
|
|
1421
|
+
0,
|
|
1422
|
+
0,
|
|
1423
|
+
0,
|
|
1424
|
+
0,
|
|
1425
|
+
0,
|
|
1426
|
+
0,
|
|
1427
|
+
0,
|
|
1428
|
+
0,
|
|
1429
|
+
0,
|
|
1430
|
+
0,
|
|
1431
|
+
0,
|
|
1432
|
+
0,
|
|
1433
|
+
0,
|
|
1434
|
+
0,
|
|
1435
|
+
0,
|
|
1436
|
+
0,
|
|
1437
|
+
0,
|
|
1438
|
+
0,
|
|
1439
|
+
0,
|
|
1440
|
+
0,
|
|
1441
|
+
0,
|
|
1442
|
+
0,
|
|
1443
|
+
0,
|
|
1444
|
+
0,
|
|
1445
|
+
0,
|
|
1446
|
+
0,
|
|
1447
|
+
0,
|
|
1448
|
+
0,
|
|
1449
|
+
0,
|
|
1450
|
+
0,
|
|
1451
|
+
0,
|
|
1452
|
+
0,
|
|
1453
|
+
0,
|
|
1454
|
+
0,
|
|
1455
|
+
0,
|
|
1456
|
+
0,
|
|
1457
|
+
0,
|
|
1458
|
+
0,
|
|
1459
|
+
0,
|
|
1460
|
+
0,
|
|
1461
|
+
0,
|
|
1462
|
+
0,
|
|
1463
|
+
0,
|
|
1464
|
+
0,
|
|
1465
|
+
0,
|
|
1466
|
+
0,
|
|
1467
|
+
0,
|
|
1468
|
+
0,
|
|
1469
|
+
0,
|
|
1470
|
+
],
|
|
1471
|
+
dtype=np.intc,
|
|
1472
|
+
)
|
|
1473
|
+
|
|
1474
|
+
|
|
1475
|
+
# Translation of:
|
|
1476
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Include/pymacro.h#L25 # noqa: E501
|
|
1477
|
+
@register_jitable
|
|
1478
|
+
def _Py_CHARMASK(ch):
|
|
1479
|
+
"""
|
|
1480
|
+
Equivalent to the CPython macro `Py_CHARMASK()`, masks off all but the
|
|
1481
|
+
lowest 256 bits of ch.
|
|
1482
|
+
"""
|
|
1483
|
+
return types.uint8(ch) & types.uint8(0xFF)
|
|
1484
|
+
|
|
1485
|
+
|
|
1486
|
+
# Translation of:
|
|
1487
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Include/pyctype.h#L30 # noqa: E501
|
|
1488
|
+
@register_jitable
|
|
1489
|
+
def _Py_TOUPPER(ch):
|
|
1490
|
+
"""
|
|
1491
|
+
Equivalent to the CPython macro `Py_TOUPPER()` converts an ASCII range
|
|
1492
|
+
code point to the upper equivalent
|
|
1493
|
+
"""
|
|
1494
|
+
return _Py_ctype_toupper[_Py_CHARMASK(ch)]
|
|
1495
|
+
|
|
1496
|
+
|
|
1497
|
+
# Translation of:
|
|
1498
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Include/pyctype.h#L29 # noqa: E501
|
|
1499
|
+
@register_jitable
|
|
1500
|
+
def _Py_TOLOWER(ch):
|
|
1501
|
+
"""
|
|
1502
|
+
Equivalent to the CPython macro `Py_TOLOWER()` converts an ASCII range
|
|
1503
|
+
code point to the lower equivalent
|
|
1504
|
+
"""
|
|
1505
|
+
return _Py_ctype_tolower[_Py_CHARMASK(ch)]
|
|
1506
|
+
|
|
1507
|
+
|
|
1508
|
+
# Translation of:
|
|
1509
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Include/pyctype.h#L18 # noqa: E501
|
|
1510
|
+
@register_jitable
|
|
1511
|
+
def _Py_ISLOWER(ch):
|
|
1512
|
+
"""
|
|
1513
|
+
Equivalent to the CPython macro `Py_ISLOWER()`
|
|
1514
|
+
"""
|
|
1515
|
+
return _Py_ctype_table[_Py_CHARMASK(ch)] & _PY_CTF.LOWER
|
|
1516
|
+
|
|
1517
|
+
|
|
1518
|
+
# Translation of:
|
|
1519
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Include/pyctype.h#L19 # noqa: E501
|
|
1520
|
+
@register_jitable
|
|
1521
|
+
def _Py_ISUPPER(ch):
|
|
1522
|
+
"""
|
|
1523
|
+
Equivalent to the CPython macro `Py_ISUPPER()`
|
|
1524
|
+
"""
|
|
1525
|
+
return _Py_ctype_table[_Py_CHARMASK(ch)] & _PY_CTF.UPPER
|
|
1526
|
+
|
|
1527
|
+
|
|
1528
|
+
# Translation of:
|
|
1529
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Include/pyctype.h#L20 # noqa: E501
|
|
1530
|
+
@register_jitable
|
|
1531
|
+
def _Py_ISALPHA(ch):
|
|
1532
|
+
"""
|
|
1533
|
+
Equivalent to the CPython macro `Py_ISALPHA()`
|
|
1534
|
+
"""
|
|
1535
|
+
return _Py_ctype_table[_Py_CHARMASK(ch)] & _PY_CTF.ALPHA
|
|
1536
|
+
|
|
1537
|
+
|
|
1538
|
+
# Translation of:
|
|
1539
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Include/pyctype.h#L21 # noqa: E501
|
|
1540
|
+
@register_jitable
|
|
1541
|
+
def _Py_ISDIGIT(ch):
|
|
1542
|
+
"""
|
|
1543
|
+
Equivalent to the CPython macro `Py_ISDIGIT()`
|
|
1544
|
+
"""
|
|
1545
|
+
return _Py_ctype_table[_Py_CHARMASK(ch)] & _PY_CTF.DIGIT
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
# Translation of:
|
|
1549
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Include/pyctype.h#L22 # noqa: E501
|
|
1550
|
+
@register_jitable
|
|
1551
|
+
def _Py_ISXDIGIT(ch):
|
|
1552
|
+
"""
|
|
1553
|
+
Equivalent to the CPython macro `Py_ISXDIGIT()`
|
|
1554
|
+
"""
|
|
1555
|
+
return _Py_ctype_table[_Py_CHARMASK(ch)] & _PY_CTF.XDIGIT
|
|
1556
|
+
|
|
1557
|
+
|
|
1558
|
+
# Translation of:
|
|
1559
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Include/pyctype.h#L23 # noqa: E501
|
|
1560
|
+
@register_jitable
|
|
1561
|
+
def _Py_ISALNUM(ch):
|
|
1562
|
+
"""
|
|
1563
|
+
Equivalent to the CPython macro `Py_ISALNUM()`
|
|
1564
|
+
"""
|
|
1565
|
+
return _Py_ctype_table[_Py_CHARMASK(ch)] & _PY_CTF.ALNUM
|
|
1566
|
+
|
|
1567
|
+
|
|
1568
|
+
# Translation of:
|
|
1569
|
+
# https://github.com/python/cpython/blob/1d4b6ba19466aba0eb91c4ba01ba509acf18c723/Include/pyctype.h#L24 # noqa: E501
|
|
1570
|
+
@register_jitable
|
|
1571
|
+
def _Py_ISSPACE(ch):
|
|
1572
|
+
"""
|
|
1573
|
+
Equivalent to the CPython macro `Py_ISSPACE()`
|
|
1574
|
+
"""
|
|
1575
|
+
return _Py_ctype_table[_Py_CHARMASK(ch)] & _PY_CTF.SPACE
|
|
1576
|
+
|
|
1577
|
+
|
|
1578
|
+
@register_jitable
|
|
1579
|
+
def _Py_ISLINEBREAK(ch):
|
|
1580
|
+
"""Check if character is ASCII line break"""
|
|
1581
|
+
return _Py_ctype_islinebreak[_Py_CHARMASK(ch)] & _PY_CTF_LB.LINE_BREAK
|
|
1582
|
+
|
|
1583
|
+
|
|
1584
|
+
@register_jitable
|
|
1585
|
+
def _Py_ISLINEFEED(ch):
|
|
1586
|
+
"""Check if character is line feed `\n`"""
|
|
1587
|
+
return _Py_ctype_islinebreak[_Py_CHARMASK(ch)] & _PY_CTF_LB.LINE_FEED
|
|
1588
|
+
|
|
1589
|
+
|
|
1590
|
+
@register_jitable
|
|
1591
|
+
def _Py_ISCARRIAGERETURN(ch):
|
|
1592
|
+
"""Check if character is carriage return `\r`"""
|
|
1593
|
+
return _Py_ctype_islinebreak[_Py_CHARMASK(ch)] & _PY_CTF_LB.CARRIAGE_RETURN
|
|
1594
|
+
|
|
1595
|
+
|
|
1596
|
+
# End code related to/from CPython's pyctype
|
|
1597
|
+
# ------------------------------------------------------------------------------
|