PyCyBase 0.1.8.post4__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cbase/__infra__.pxd +6 -0
- cbase/__init__.pxd +6 -0
- cbase/__init__.py +28 -0
- cbase/allocator_protocol/__infra__.pxd +58 -0
- cbase/allocator_protocol/__init__.pxd +58 -0
- cbase/allocator_protocol/__init__.py +45 -0
- cbase/allocator_protocol/c_allocator_protocol.c +31818 -0
- cbase/allocator_protocol/c_allocator_protocol.cp313-win_amd64.pyd +0 -0
- cbase/allocator_protocol/c_allocator_protocol.h +352 -0
- cbase/allocator_protocol/c_allocator_protocol.pxd +64 -0
- cbase/allocator_protocol/c_allocator_protocol.pyi +144 -0
- cbase/allocator_protocol/c_allocator_protocol.pyx +209 -0
- cbase/allocator_protocol/c_heap_allocator.c +38144 -0
- cbase/allocator_protocol/c_heap_allocator.cp313-win_amd64.pyd +0 -0
- cbase/allocator_protocol/c_heap_allocator.h +444 -0
- cbase/allocator_protocol/c_heap_allocator.pxd +97 -0
- cbase/allocator_protocol/c_heap_allocator.pyi +161 -0
- cbase/allocator_protocol/c_heap_allocator.pyx +300 -0
- cbase/allocator_protocol/c_nt_shm_allocator.c +33399 -0
- cbase/allocator_protocol/c_nt_shm_allocator.cp313-win_amd64.pyd +0 -0
- cbase/allocator_protocol/c_nt_shm_allocator.h +996 -0
- cbase/allocator_protocol/c_nt_shm_allocator.pxd +102 -0
- cbase/allocator_protocol/c_nt_shm_allocator.pyx +223 -0
- cbase/allocator_protocol/c_shm_allocator.h +1168 -0
- cbase/allocator_protocol/c_shm_allocator.pxd +142 -0
- cbase/allocator_protocol/c_shm_allocator.pyi +299 -0
- cbase/allocator_protocol/c_shm_allocator.pyx +442 -0
- cbase/allocator_protocol/c_shm_comp.c +4643 -0
- cbase/allocator_protocol/c_shm_comp.cp313-win_amd64.pyd +0 -0
- cbase/allocator_protocol/c_shm_comp.h +49 -0
- cbase/allocator_protocol/c_shm_comp.pxd +38 -0
- cbase/allocator_protocol/c_shm_comp.pyx +1 -0
- cbase/backports/__infra__.pxd +17 -0
- cbase/backports/__init__.pxd +17 -0
- cbase/backports/__init__.py +9 -0
- cbase/backports/pydict.h +55 -0
- cbase/backports/pydict.pxd +5 -0
- cbase/backports/pylong.c +9946 -0
- cbase/backports/pylong.cp313-win_amd64.pyd +0 -0
- cbase/backports/pylong.h +79 -0
- cbase/backports/pylong.pxd +23 -0
- cbase/backports/pylong.pyx +61 -0
- cbase/bytemap/__infra__.pxd +42 -0
- cbase/bytemap/__init__.pxd +42 -0
- cbase/bytemap/__init__.py +21 -0
- cbase/bytemap/c_bytemap.c +52076 -0
- cbase/bytemap/c_bytemap.cp313-win_amd64.pyd +0 -0
- cbase/bytemap/c_bytemap.h +867 -0
- cbase/bytemap/c_bytemap.pxd +370 -0
- cbase/bytemap/c_bytemap.pyx +1758 -0
- cbase/bytemap/xxh3.h +55 -0
- cbase/bytemap/xxhash.c +42 -0
- cbase/bytemap/xxhash.h +7487 -0
- cbase/env.c +11109 -0
- cbase/env.cp313-win_amd64.pyd +0 -0
- cbase/env.pxd +8 -0
- cbase/env.pyi +48 -0
- cbase/env.pyx +46 -0
- cbase/includes/cbase/allocator_protocol/c_allocator_protocol.c +31818 -0
- cbase/includes/cbase/allocator_protocol/c_allocator_protocol.h +352 -0
- cbase/includes/cbase/allocator_protocol/c_heap_allocator.c +38144 -0
- cbase/includes/cbase/allocator_protocol/c_heap_allocator.h +444 -0
- cbase/includes/cbase/allocator_protocol/c_nt_shm_allocator.c +33399 -0
- cbase/includes/cbase/allocator_protocol/c_nt_shm_allocator.h +996 -0
- cbase/includes/cbase/allocator_protocol/c_shm_allocator.h +1168 -0
- cbase/includes/cbase/allocator_protocol/c_shm_comp.c +4643 -0
- cbase/includes/cbase/allocator_protocol/c_shm_comp.h +49 -0
- cbase/includes/cbase/backports/pydict.h +55 -0
- cbase/includes/cbase/backports/pylong.c +9946 -0
- cbase/includes/cbase/backports/pylong.h +79 -0
- cbase/includes/cbase/bytemap/c_bytemap.c +52076 -0
- cbase/includes/cbase/bytemap/c_bytemap.h +867 -0
- cbase/includes/cbase/bytemap/xxh3.h +55 -0
- cbase/includes/cbase/bytemap/xxhash.c +42 -0
- cbase/includes/cbase/bytemap/xxhash.h +7487 -0
- cbase/includes/cbase/env.c +11109 -0
- cbase/includes/cbase/int128.h +81 -0
- cbase/includes/cbase/intern_string/c_intern_string.c +28081 -0
- cbase/includes/cbase/intern_string/c_intern_string.h +614 -0
- cbase/includes/cbase/nt/pthread_nt_compat.h +102 -0
- cbase/includes/cbase/nt/regex_nt_compat.h +133 -0
- cbase/includes/cbase/nt/time_sched_nt_compat.h +32 -0
- cbase/int128.h +81 -0
- cbase/int128.pxd +15 -0
- cbase/intern_string/BENCHMARK.md +157 -0
- cbase/intern_string/__infra__.pxd +11 -0
- cbase/intern_string/__init__.pxd +11 -0
- cbase/intern_string/__init__.py +19 -0
- cbase/intern_string/c_intern_string.c +28081 -0
- cbase/intern_string/c_intern_string.cp313-win_amd64.pyd +0 -0
- cbase/intern_string/c_intern_string.h +614 -0
- cbase/intern_string/c_intern_string.pxd +118 -0
- cbase/intern_string/c_intern_string.pyi +376 -0
- cbase/intern_string/c_intern_string.pyx +765 -0
- cbase/nt/pthread_nt_compat.h +102 -0
- cbase/nt/regex_nt_compat.h +133 -0
- cbase/nt/time_sched_nt_compat.h +32 -0
- pycybase-0.1.8.post4.dist-info/METADATA +180 -0
- pycybase-0.1.8.post4.dist-info/RECORD +101 -0
- pycybase-0.1.8.post4.dist-info/WHEEL +5 -0
- pycybase-0.1.8.post4.dist-info/top_level.txt +1 -0
|
Binary file
|
cbase/backports/pylong.h
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#ifndef PY_BACKPORTS_LONG_H
|
|
2
|
+
#define PY_BACKPORTS_LONG_H
|
|
3
|
+
|
|
4
|
+
#include <Python.h>
|
|
5
|
+
#include <cbase/int128.h>
|
|
6
|
+
|
|
7
|
+
static inline PyObject* PyLong_FromUInt128(uint128_t value) {
|
|
8
|
+
#if PY_VERSION_HEX >= 0x030D0000
|
|
9
|
+
return PyLong_FromNativeBytes(&value, sizeof(value), Py_ASNATIVEBYTES_LITTLE_ENDIAN | Py_ASNATIVEBYTES_UNSIGNED_BUFFER);
|
|
10
|
+
#else
|
|
11
|
+
return _PyLong_FromByteArray(
|
|
12
|
+
(const unsigned char*) &value,
|
|
13
|
+
sizeof(value),
|
|
14
|
+
1, /* little_endian */
|
|
15
|
+
0
|
|
16
|
+
); /* unsigned */
|
|
17
|
+
#endif
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static inline PyObject* PyLong_FromInt128(int128_t value) {
|
|
21
|
+
#if PY_VERSION_HEX >= 0x030D0000
|
|
22
|
+
return PyLong_FromNativeBytes(&value, sizeof(value), Py_ASNATIVEBYTES_LITTLE_ENDIAN);
|
|
23
|
+
#else
|
|
24
|
+
return _PyLong_FromByteArray(
|
|
25
|
+
(const unsigned char*) &value,
|
|
26
|
+
sizeof(value),
|
|
27
|
+
1, /* little_endian */
|
|
28
|
+
1
|
|
29
|
+
); /* signed */
|
|
30
|
+
#endif
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static inline Py_ssize_t PyLong_AsUInt128(PyObject* obj, uint128_t* value) {
|
|
34
|
+
#if PY_VERSION_HEX >= 0x030D0000
|
|
35
|
+
return PyLong_AsNativeBytes(obj, value, sizeof(*value), Py_ASNATIVEBYTES_LITTLE_ENDIAN | Py_ASNATIVEBYTES_UNSIGNED_BUFFER);
|
|
36
|
+
#else
|
|
37
|
+
if (!PyLong_Check(obj)) {
|
|
38
|
+
PyErr_Format(PyExc_TypeError, "expected int, got %.200s", Py_TYPE(obj)->tp_name);
|
|
39
|
+
return -1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (_PyLong_AsByteArray(
|
|
43
|
+
(PyLongObject*) obj,
|
|
44
|
+
(unsigned char*) value,
|
|
45
|
+
sizeof(*value),
|
|
46
|
+
1, /* little_endian */
|
|
47
|
+
0
|
|
48
|
+
) < 0) {
|
|
49
|
+
return -1;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return sizeof(*value);
|
|
53
|
+
#endif
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static inline Py_ssize_t PyLong_AsInt128(PyObject* obj, int128_t* value) {
|
|
57
|
+
#if PY_VERSION_HEX >= 0x030D0000
|
|
58
|
+
return PyLong_AsNativeBytes(obj, value, sizeof(*value), Py_ASNATIVEBYTES_LITTLE_ENDIAN);
|
|
59
|
+
#else
|
|
60
|
+
if (!PyLong_Check(obj)) {
|
|
61
|
+
PyErr_Format(PyExc_TypeError, "expected int, got %.200s", Py_TYPE(obj)->tp_name);
|
|
62
|
+
return -1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (_PyLong_AsByteArray(
|
|
66
|
+
(PyLongObject*) obj,
|
|
67
|
+
(unsigned char*) value,
|
|
68
|
+
sizeof(*value),
|
|
69
|
+
1, /* little_endian */
|
|
70
|
+
1
|
|
71
|
+
) < 0) {
|
|
72
|
+
return -1;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return sizeof(*value);
|
|
76
|
+
#endif
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
#endif // PY_BACKPORTS_LONG_H
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from cpython.object cimport PyObject
|
|
2
|
+
|
|
3
|
+
from cbase.int128 cimport uint128_t, int128_t
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
cdef extern from "cbase/backports/pylong.h":
|
|
7
|
+
PyObject* PyLong_FromUInt128(uint128_t value)
|
|
8
|
+
PyObject* PyLong_FromInt128(int128_t value)
|
|
9
|
+
Py_ssize_t PyLong_AsUInt128(PyObject* obj, uint128_t* value)
|
|
10
|
+
Py_ssize_t PyLong_AsInt128(PyObject* obj, int128_t* value)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
cdef object _UINT128_MAX
|
|
14
|
+
cdef object _INT128_MAX
|
|
15
|
+
cdef object _INT128_MIN
|
|
16
|
+
|
|
17
|
+
cpdef object pylong_from_uint128(bytes buf)
|
|
18
|
+
|
|
19
|
+
cpdef object pylong_from_int128(bytes buf)
|
|
20
|
+
|
|
21
|
+
cpdef bytes pylong_as_uint128(object val)
|
|
22
|
+
|
|
23
|
+
cpdef bytes pylong_as_int128(object val)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from cpython.bytes cimport PyBytes_FromStringAndSize
|
|
2
|
+
|
|
3
|
+
from cbase.int128 cimport c_read_uint128, c_write_uint128, c_read_int128, c_write_int128
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
globals()['_UINT128_MAX'] = _UINT128_MAX = (1 << 128) - 1
|
|
7
|
+
globals()['_INT128_MAX'] = _INT128_MAX = (1 << 127) - 1
|
|
8
|
+
globals()['_INT128_MIN'] = _INT128_MIN = -(1 << 127)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
cpdef object pylong_from_uint128(bytes buf):
|
|
12
|
+
if len(buf) != 16:
|
|
13
|
+
raise ValueError(f"expected 16 bytes, got {len(buf)}")
|
|
14
|
+
cdef uint128_t val = c_read_uint128(<const char*> buf)
|
|
15
|
+
return <object> PyLong_FromUInt128(val)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
cpdef object pylong_from_int128(bytes buf):
|
|
19
|
+
if len(buf) != 16:
|
|
20
|
+
raise ValueError(f"expected 16 bytes, got {len(buf)}")
|
|
21
|
+
cdef int128_t val = c_read_int128(<const char*> buf)
|
|
22
|
+
return <object> PyLong_FromInt128(val)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
cpdef bytes pylong_as_uint128(object val):
|
|
26
|
+
if not isinstance(val, int):
|
|
27
|
+
raise TypeError(f"expected int, got {type(val).__name__}")
|
|
28
|
+
|
|
29
|
+
if val < 0:
|
|
30
|
+
raise OverflowError("can't convert negative int to uint128_t")
|
|
31
|
+
if val > _UINT128_MAX:
|
|
32
|
+
raise OverflowError("int too large for uint128_t")
|
|
33
|
+
|
|
34
|
+
cdef uint128_t v
|
|
35
|
+
cdef Py_ssize_t nbytes = PyLong_AsUInt128(<PyObject*> val, &v)
|
|
36
|
+
|
|
37
|
+
if nbytes < 0:
|
|
38
|
+
raise OverflowError("int out of range for uint128_t")
|
|
39
|
+
if nbytes > <Py_ssize_t> sizeof(uint128_t):
|
|
40
|
+
raise OverflowError("int too large for uint128_t")
|
|
41
|
+
cdef bytes out = PyBytes_FromStringAndSize(NULL, 16)
|
|
42
|
+
c_write_uint128(<char*> out, v)
|
|
43
|
+
return out
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
cpdef bytes pylong_as_int128(object val):
|
|
47
|
+
if not isinstance(val, int):
|
|
48
|
+
raise TypeError(f"expected int, got {type(val).__name__}")
|
|
49
|
+
|
|
50
|
+
if val < _INT128_MIN or val > _INT128_MAX:
|
|
51
|
+
raise OverflowError("int out of range for int128_t")
|
|
52
|
+
|
|
53
|
+
cdef int128_t v
|
|
54
|
+
cdef Py_ssize_t nbytes = PyLong_AsInt128(<PyObject*> val, &v)
|
|
55
|
+
if nbytes < 0:
|
|
56
|
+
raise OverflowError("int out of range for int128_t")
|
|
57
|
+
if nbytes > <Py_ssize_t> sizeof(int128_t):
|
|
58
|
+
raise OverflowError("int too large for int128_t")
|
|
59
|
+
cdef bytes out = PyBytes_FromStringAndSize(NULL, 16)
|
|
60
|
+
c_write_int128(<char*> out, v)
|
|
61
|
+
return out
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from .c_bytemap cimport (
|
|
2
|
+
MIN_BYTEMAP_CAPACITY, DEFAULT_BYTEMAP_CAPACITY, BYTEMAP_GROWTH_FACTOR,
|
|
3
|
+
MAX_BYTEMAP_CAPACITY, BYTEMAP_SALT_MAGIC,
|
|
4
|
+
|
|
5
|
+
bytemap_entry, bytemap_entry_ex,
|
|
6
|
+
bytemap_callback_event, bytemap_callback_func, bytemap_ex_callback_func,
|
|
7
|
+
bytemap_callback_ctx, bytemap_ex_callback_ctx,
|
|
8
|
+
bytemap, bytemap_ex,
|
|
9
|
+
bytemap_ret_code,
|
|
10
|
+
|
|
11
|
+
c_bytemap_hash, c_bytemap_clone_key, c_bytemap_free_key,
|
|
12
|
+
c_bytemap_gen_seq_id,
|
|
13
|
+
c_bytemap_entry_at, c_bytemap_entry_next, c_bytemap_entry_first,
|
|
14
|
+
c_bytemap_invoke_callbacks,
|
|
15
|
+
|
|
16
|
+
c_bytemap_ex_init, c_bytemap_ex_dealloc,
|
|
17
|
+
c_bytemap_ex_new, c_bytemap_ex_clear, c_bytemap_ex_free,
|
|
18
|
+
c_bytemap_ex_register_callback, c_bytemap_ex_unregister_callback,
|
|
19
|
+
c_bytemap_ex_get, c_bytemap_ex_get_ptr, c_bytemap_ex_contains,
|
|
20
|
+
c_bytemap_ex_rehash, c_bytemap_ex_set, c_bytemap_ex_pop, c_bytemap_ex_pop_ptr,
|
|
21
|
+
c_bytemap_ex_len, c_bytemap_ex_clone,
|
|
22
|
+
|
|
23
|
+
c_bytemap_ex_set_double, c_bytemap_ex_get_double, c_bytemap_ex_pop_double,
|
|
24
|
+
|
|
25
|
+
c_bytemap_new, c_bytemap_clear, c_bytemap_free,
|
|
26
|
+
c_bytemap_register_callback, c_bytemap_unregister_callback,
|
|
27
|
+
c_bytemap_get, c_bytemap_contains, c_bytemap_rehash,
|
|
28
|
+
c_bytemap_set, c_bytemap_pop, c_bytemap_len, c_bytemap_clone,
|
|
29
|
+
|
|
30
|
+
c_bytemap_first, c_bytemap_last, c_bytemap_next, c_bytemap_prev,
|
|
31
|
+
c_bytemap_entry_value,
|
|
32
|
+
c_bytemap_entry_value_as_ptr, c_bytemap_entry_value_as_uintptr,
|
|
33
|
+
c_bytemap_entry_value_as_double,
|
|
34
|
+
c_bytemap_entry_value_from_ptr, c_bytemap_entry_value_from_uintptr,
|
|
35
|
+
c_bytemap_entry_value_from_double,
|
|
36
|
+
|
|
37
|
+
_ByteMapBase,
|
|
38
|
+
ByteMapEx, ByteMapExDouble, ByteMap,
|
|
39
|
+
_BoundByteMapBase,
|
|
40
|
+
BoundByteMapEx, BoundByteMapExDouble, BoundByteMap, BoundByteSet,
|
|
41
|
+
ByteMapPerformanceTestToolkit,
|
|
42
|
+
)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from .c_bytemap cimport (
|
|
2
|
+
MIN_BYTEMAP_CAPACITY, DEFAULT_BYTEMAP_CAPACITY, BYTEMAP_GROWTH_FACTOR,
|
|
3
|
+
MAX_BYTEMAP_CAPACITY, BYTEMAP_SALT_MAGIC,
|
|
4
|
+
|
|
5
|
+
bytemap_entry, bytemap_entry_ex,
|
|
6
|
+
bytemap_callback_event, bytemap_callback_func, bytemap_ex_callback_func,
|
|
7
|
+
bytemap_callback_ctx, bytemap_ex_callback_ctx,
|
|
8
|
+
bytemap, bytemap_ex,
|
|
9
|
+
bytemap_ret_code,
|
|
10
|
+
|
|
11
|
+
c_bytemap_hash, c_bytemap_clone_key, c_bytemap_free_key,
|
|
12
|
+
c_bytemap_gen_seq_id,
|
|
13
|
+
c_bytemap_entry_at, c_bytemap_entry_next, c_bytemap_entry_first,
|
|
14
|
+
c_bytemap_invoke_callbacks,
|
|
15
|
+
|
|
16
|
+
c_bytemap_ex_init, c_bytemap_ex_dealloc,
|
|
17
|
+
c_bytemap_ex_new, c_bytemap_ex_clear, c_bytemap_ex_free,
|
|
18
|
+
c_bytemap_ex_register_callback, c_bytemap_ex_unregister_callback,
|
|
19
|
+
c_bytemap_ex_get, c_bytemap_ex_get_ptr, c_bytemap_ex_contains,
|
|
20
|
+
c_bytemap_ex_rehash, c_bytemap_ex_set, c_bytemap_ex_pop, c_bytemap_ex_pop_ptr,
|
|
21
|
+
c_bytemap_ex_len, c_bytemap_ex_clone,
|
|
22
|
+
|
|
23
|
+
c_bytemap_ex_set_double, c_bytemap_ex_get_double, c_bytemap_ex_pop_double,
|
|
24
|
+
|
|
25
|
+
c_bytemap_new, c_bytemap_clear, c_bytemap_free,
|
|
26
|
+
c_bytemap_register_callback, c_bytemap_unregister_callback,
|
|
27
|
+
c_bytemap_get, c_bytemap_contains, c_bytemap_rehash,
|
|
28
|
+
c_bytemap_set, c_bytemap_pop, c_bytemap_len, c_bytemap_clone,
|
|
29
|
+
|
|
30
|
+
c_bytemap_first, c_bytemap_last, c_bytemap_next, c_bytemap_prev,
|
|
31
|
+
c_bytemap_entry_value,
|
|
32
|
+
c_bytemap_entry_value_as_ptr, c_bytemap_entry_value_as_uintptr,
|
|
33
|
+
c_bytemap_entry_value_as_double,
|
|
34
|
+
c_bytemap_entry_value_from_ptr, c_bytemap_entry_value_from_uintptr,
|
|
35
|
+
c_bytemap_entry_value_from_double,
|
|
36
|
+
|
|
37
|
+
_ByteMapBase,
|
|
38
|
+
ByteMapEx, ByteMapExDouble, ByteMap,
|
|
39
|
+
_BoundByteMapBase,
|
|
40
|
+
BoundByteMapEx, BoundByteMapExDouble, BoundByteMap, BoundByteSet,
|
|
41
|
+
ByteMapPerformanceTestToolkit,
|
|
42
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from .c_bytemap import (
|
|
2
|
+
ByteMapEx,
|
|
3
|
+
ByteMapExDouble,
|
|
4
|
+
ByteMap,
|
|
5
|
+
BoundByteMapEx,
|
|
6
|
+
BoundByteMapExDouble,
|
|
7
|
+
BoundByteMap,
|
|
8
|
+
BoundByteSet,
|
|
9
|
+
ByteMapPerformanceTestToolkit,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
'ByteMapEx',
|
|
14
|
+
'ByteMapExDouble',
|
|
15
|
+
'ByteMap',
|
|
16
|
+
'BoundByteMapEx',
|
|
17
|
+
'BoundByteMapExDouble',
|
|
18
|
+
'BoundByteMap',
|
|
19
|
+
'BoundByteSet',
|
|
20
|
+
'ByteMapPerformanceTestToolkit',
|
|
21
|
+
]
|