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/env.pxd
ADDED
cbase/env.pyi
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class EnvConfigContext:
|
|
6
|
+
"""Context manager for temporary environment configuration changes."""
|
|
7
|
+
|
|
8
|
+
def __init__(self, **kwargs) -> None:
|
|
9
|
+
"""
|
|
10
|
+
Initialize the context with configuration changes.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
**kwargs: Configuration key-value pairs to set temporarily
|
|
14
|
+
"""
|
|
15
|
+
...
|
|
16
|
+
|
|
17
|
+
def __enter__(self) -> EnvConfigContext:
|
|
18
|
+
"""Enter the context, applying configuration changes."""
|
|
19
|
+
...
|
|
20
|
+
|
|
21
|
+
def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: Any) -> None:
|
|
22
|
+
"""Exit the context, reverting configuration changes."""
|
|
23
|
+
...
|
|
24
|
+
|
|
25
|
+
def __call__(self, func: Callable[..., Any]) -> Callable[..., Any]:
|
|
26
|
+
"""Decorator to apply the context to a function."""
|
|
27
|
+
...
|
|
28
|
+
|
|
29
|
+
def __or__(self, other: EnvConfigContext) -> EnvConfigContext:
|
|
30
|
+
"""
|
|
31
|
+
Combine two EnvConfigContext instances.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
other: Another EnvConfigContext instance
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
A new EnvConfigContext with combined configurations
|
|
38
|
+
"""
|
|
39
|
+
...
|
|
40
|
+
|
|
41
|
+
def __invert__(self) -> EnvConfigContext:
|
|
42
|
+
"""
|
|
43
|
+
Invert the EnvConfigContext.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
A new EnvConfigContext that reverts the configurations set in the original.
|
|
47
|
+
"""
|
|
48
|
+
...
|
cbase/env.pyx
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
|
|
2
|
+
cdef class EnvConfigContext:
|
|
3
|
+
def __cinit__(self):
|
|
4
|
+
self.overrides = {}
|
|
5
|
+
self.originals = {}
|
|
6
|
+
|
|
7
|
+
def __init__(self, dict overrides=None, **kwargs):
|
|
8
|
+
if overrides:
|
|
9
|
+
self.overrides.update(overrides)
|
|
10
|
+
|
|
11
|
+
if kwargs:
|
|
12
|
+
self.overrides.update(kwargs)
|
|
13
|
+
|
|
14
|
+
cdef void c_activate(self):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
cdef void c_deactivate(self):
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
def __repr__(self):
|
|
21
|
+
return f'{self.__class__.__name__}({self.overrides!r})'
|
|
22
|
+
|
|
23
|
+
def __enter__(self):
|
|
24
|
+
self.c_activate()
|
|
25
|
+
return self
|
|
26
|
+
|
|
27
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
28
|
+
self.c_deactivate()
|
|
29
|
+
|
|
30
|
+
def __or__(self, EnvConfigContext other):
|
|
31
|
+
if not isinstance(other, EnvConfigContext):
|
|
32
|
+
return NotImplemented
|
|
33
|
+
cdef dict merged_overrides = self.overrides | other.overrides
|
|
34
|
+
return self.__class__(**merged_overrides)
|
|
35
|
+
|
|
36
|
+
def __invert__(self):
|
|
37
|
+
cdef dict inverted_overrides = {k: not v if isinstance(v, bool) else v for k, v in self.overrides.items()}
|
|
38
|
+
return self.__class__(**inverted_overrides)
|
|
39
|
+
|
|
40
|
+
def __call__(self, func):
|
|
41
|
+
def wrapper(*args, **kwargs):
|
|
42
|
+
self.c_activate()
|
|
43
|
+
ret = func(*args, **kwargs)
|
|
44
|
+
self.c_deactivate()
|
|
45
|
+
return ret
|
|
46
|
+
return wrapper
|