bool-hybrid-array 9.11.6__py3-none-any.whl → 9.11.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bool_hybrid_array/__init__.py +3 -2
- bool_hybrid_array/compile_core.pyd +0 -0
- bool_hybrid_array/core.c +67099 -0
- bool_hybrid_array/core.py +85 -59
- {bool_hybrid_array-9.11.6.dist-info → bool_hybrid_array-9.11.8.dist-info}/METADATA +3 -2
- bool_hybrid_array-9.11.8.dist-info/RECORD +12 -0
- bool_hybrid_array-9.11.6.dist-info/RECORD +0 -10
- {bool_hybrid_array-9.11.6.dist-info → bool_hybrid_array-9.11.8.dist-info}/WHEEL +0 -0
- {bool_hybrid_array-9.11.6.dist-info → bool_hybrid_array-9.11.8.dist-info}/licenses/LICENSE +0 -0
- {bool_hybrid_array-9.11.6.dist-info → bool_hybrid_array-9.11.8.dist-info}/top_level.txt +0 -0
bool_hybrid_array/core.py
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
# cython: language_level=3, boundscheck=False, wraparound=False, initializedcheck=False
|
|
1
2
|
from __future__ import annotations
|
|
3
|
+
try:from mypy_extensions import mypyc_attr
|
|
4
|
+
except:
|
|
5
|
+
def mypyc_attr(*a,**k):
|
|
6
|
+
return lambda func:func
|
|
2
7
|
import builtins
|
|
3
8
|
from types import MappingProxyType
|
|
4
9
|
import array,bisect,numpy as np
|
|
@@ -7,24 +12,24 @@ import itertools,copy,sys,math,weakref,random,mmap,os
|
|
|
7
12
|
from functools import reduce
|
|
8
13
|
import operator,ctypes,gc,abc,types
|
|
9
14
|
from functools import lru_cache
|
|
10
|
-
from typing import
|
|
11
|
-
|
|
15
|
+
from typing import _GenericAlias
|
|
16
|
+
from typing import Callable, Union, Sequence, MutableSequence, Any, overload, Sized
|
|
17
|
+
hybrid_array_cache:list[tuple[Any]] = []
|
|
12
18
|
try:
|
|
13
19
|
msvcrt = ctypes.CDLL('msvcrt.dll')
|
|
14
20
|
memcpy = msvcrt.memcpy
|
|
15
21
|
except:
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
try:
|
|
23
|
+
libc = ctypes.CDLL('libc.so.6')
|
|
24
|
+
memcpy = libc.memcpy
|
|
25
|
+
except:
|
|
26
|
+
libc = ctypes.CDLL('libc.so')
|
|
27
|
+
memcpy = libc.memcpy
|
|
18
28
|
memcpy.argtypes = (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_size_t)
|
|
19
29
|
memcpy.restype = ctypes.c_void_p
|
|
20
|
-
if 'UnionType' in types.__dict__:
|
|
21
|
-
class Union:
|
|
22
|
-
def __getitem__(self,*args):
|
|
23
|
-
return reduce(operator.or_, args)
|
|
24
|
-
Union = Union()
|
|
25
30
|
if 'GenericAlias' in types.__dict__:
|
|
26
31
|
_GenericAlias = types.GenericAlias
|
|
27
|
-
class ResurrectMeta(abc.ABCMeta,metaclass=abc.ABCMeta):
|
|
32
|
+
class ResurrectMeta(abc.ABCMeta,metaclass=abc.ABCMeta):# type: ignore
|
|
28
33
|
__module__ = 'bool_hybrid_array'
|
|
29
34
|
name = 'ResurrectMeta'
|
|
30
35
|
def __new__(cls, name, bases, namespace):
|
|
@@ -37,7 +42,7 @@ class ResurrectMeta(abc.ABCMeta,metaclass=abc.ABCMeta):
|
|
|
37
42
|
super_cls.__setattr__('name', name)
|
|
38
43
|
super_cls.__setattr__('bases', bases)
|
|
39
44
|
super_cls.__setattr__('namespace', namespace)
|
|
40
|
-
super_cls.__setattr__('original_dict', dict(obj.__dict__))
|
|
45
|
+
super_cls.__setattr__('original_dict', dict(obj.__dict__))# type: ignore[assignment]
|
|
41
46
|
try:del obj.original_dict["__abstractmethods__"]
|
|
42
47
|
except:pass
|
|
43
48
|
try:del obj.original_dict["_abc_impl"]
|
|
@@ -50,7 +55,7 @@ class ResurrectMeta(abc.ABCMeta,metaclass=abc.ABCMeta):
|
|
|
50
55
|
except:pass
|
|
51
56
|
try:del obj.original_dict['_abc_negative_cache_version']
|
|
52
57
|
except:pass
|
|
53
|
-
super_cls.__setattr__('original_dict', MappingProxyType(obj.original_dict))
|
|
58
|
+
super_cls.__setattr__('original_dict', MappingProxyType(obj.original_dict))# type: ignore[assignment]
|
|
54
59
|
return obj
|
|
55
60
|
@lru_cache
|
|
56
61
|
def __str__(cls):
|
|
@@ -62,14 +67,16 @@ class ResurrectMeta(abc.ABCMeta,metaclass=abc.ABCMeta):
|
|
|
62
67
|
return f'ResurrectMeta(cls = {cls},{name = },{bases = },{namespace = })'
|
|
63
68
|
return str(cls)
|
|
64
69
|
def __del__(cls):
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
try:
|
|
71
|
+
setattr(builtins,cls.name,cls)
|
|
72
|
+
if not sys.is_finalizing():
|
|
73
|
+
print(f'警告:禁止删除常变量:{cls}!')
|
|
74
|
+
raise TypeError(f'禁止删除常变量:{cls}')
|
|
75
|
+
except NameError:pass
|
|
69
76
|
def __hash__(cls):
|
|
70
77
|
return hash(cls.name+cls.__module__)
|
|
71
78
|
def __setattr__(cls,name,value):
|
|
72
|
-
if not hasattr(cls, 'x'):
|
|
79
|
+
if not hasattr(cls, 'x') or name.startswith('_'):
|
|
73
80
|
super().__setattr__(name,value)
|
|
74
81
|
return
|
|
75
82
|
if hasattr(cls, 'name') and cls.name == 'BHA_Bool' and repr(value) in {'T','F'} and name in {'T','F'}:
|
|
@@ -101,7 +108,7 @@ class ResurrectMeta(abc.ABCMeta,metaclass=abc.ABCMeta):
|
|
|
101
108
|
pass
|
|
102
109
|
original_dict = MappingProxyType(original_dict)
|
|
103
110
|
ResurrectMeta.__class__ = ResurrectMeta
|
|
104
|
-
class BHA_Function(metaclass=ResurrectMeta):
|
|
111
|
+
class BHA_Function(metaclass=ResurrectMeta):# type: ignore
|
|
105
112
|
def __init__(self,v):
|
|
106
113
|
self.data,self.module = v,__name__
|
|
107
114
|
def __call__(self,*a,**b):
|
|
@@ -121,14 +128,16 @@ def {name}({params}):
|
|
|
121
128
|
exec(func_code, globals(), local_namespace)
|
|
122
129
|
dynamic_func = local_namespace[name]
|
|
123
130
|
return cls(dynamic_func)
|
|
124
|
-
|
|
131
|
+
@mypyc_attr(native_class=False)
|
|
132
|
+
class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):# type: ignore
|
|
125
133
|
__module__ = 'bool_hybrid_array'
|
|
134
|
+
@mypyc_attr(native_class=False)
|
|
126
135
|
class _CompactBoolArray(Sequence,Exception):
|
|
127
136
|
def __init__(self, size: int):
|
|
128
137
|
self.size = size
|
|
129
138
|
self.n_uint8 = (size + 7) >> 3
|
|
130
|
-
self.data = np.zeros(self.n_uint8, dtype=np.uint8)
|
|
131
|
-
def __setitem__(self, index: int | slice, value):
|
|
139
|
+
self.data = np.zeros(self.n_uint8, dtype=np.uint8)# type: ignore[assignment]
|
|
140
|
+
def __setitem__(self, index: int | slice, value: Any):
|
|
132
141
|
ctypes_arr = self.data.ctypes.data_as(ctypes.POINTER(ctypes.c_ubyte))
|
|
133
142
|
if isinstance(index, slice):
|
|
134
143
|
start, stop, step = index.indices(self.size)
|
|
@@ -155,6 +164,7 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
155
164
|
ctypes_arr[uint8_pos] &= ~(1 << bit_offset) & 0xFF
|
|
156
165
|
if value:
|
|
157
166
|
ctypes_arr[uint8_pos] |= (1 << bit_offset)
|
|
167
|
+
|
|
158
168
|
def __getitem__(self, index: int | slice) -> bool | list[bool]:
|
|
159
169
|
if isinstance(index, slice):
|
|
160
170
|
start, stop, step = index.indices(self.size)
|
|
@@ -180,7 +190,7 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
180
190
|
new_instance = self.__class__(size=self.size)
|
|
181
191
|
new_instance.data = self.data.copy()
|
|
182
192
|
return new_instance
|
|
183
|
-
def __init__(self, split_index: int, size=None, is_sparse=False ,Type:Callable = None,hash_ = True) -> None:
|
|
193
|
+
def __init__(self, split_index: int, size=None, is_sparse=False ,Type:Callable = None,hash_:Any = True) -> None:
|
|
184
194
|
self.Type = Type if Type is not None else builtins.BHA_Bool
|
|
185
195
|
self.split_index = int(split_index)
|
|
186
196
|
self.size = size or 0
|
|
@@ -217,7 +227,7 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
217
227
|
return func
|
|
218
228
|
def __hash__(self):
|
|
219
229
|
return self._cached_hash
|
|
220
|
-
def accessor(self, i: int, value:
|
|
230
|
+
def accessor(self, i: int, value: Any = None) -> Any:
|
|
221
231
|
def _get_sparse_info(index: int) -> tuple[int, bool]:
|
|
222
232
|
pos = bisect.bisect_left(self.large, index)
|
|
223
233
|
exists = pos < len(self.large) and self.large[pos] == index
|
|
@@ -241,7 +251,12 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
241
251
|
if pos < len(self.large):
|
|
242
252
|
del self.large[pos]
|
|
243
253
|
return None
|
|
244
|
-
|
|
254
|
+
@overload
|
|
255
|
+
def __getitem__(self, idx: int, /) -> Any: ...
|
|
256
|
+
@overload
|
|
257
|
+
def __getitem__(self, idx: slice, /) -> list: ...
|
|
258
|
+
|
|
259
|
+
def __getitem__(self, key:int|slice = -1,/) -> Any:
|
|
245
260
|
if isinstance(key, slice):
|
|
246
261
|
start, stop, step = key.indices(self.size)
|
|
247
262
|
return BoolHybridArr((self[i] for i in range(start, stop, step)),hash_ = self.hash_)
|
|
@@ -249,7 +264,7 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
249
264
|
if 0 <= key < self.size:
|
|
250
265
|
return self.Type(self.accessor(key))
|
|
251
266
|
raise IndexError("索引超出范围")
|
|
252
|
-
def __setitem__(self, key: int | slice, value) -> None:
|
|
267
|
+
def __setitem__(self, key: int | slice, value:Any) -> None:
|
|
253
268
|
if isinstance(key, int):
|
|
254
269
|
adjusted_key = key if key >= 0 else key + self.size
|
|
255
270
|
if not (0 <= adjusted_key < self.size):
|
|
@@ -284,15 +299,23 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
284
299
|
def __repr__(self) -> str:
|
|
285
300
|
return(f"BoolHybridArray(split_index={self.split_index}, size={self.size}, "
|
|
286
301
|
+f"is_sparse={self.is_sparse}, small_len={len(self.small)}, large_len={len(self.large)})")
|
|
287
|
-
|
|
302
|
+
@overload
|
|
303
|
+
def __delitem__(self, key: int, /) -> None: ...
|
|
304
|
+
@overload
|
|
305
|
+
def __delitem__(self, key: slice, /) -> None: ...
|
|
306
|
+
|
|
307
|
+
def __delitem__(self, key: int|slice = -1,/) -> None:
|
|
288
308
|
key = key if key >= 0 else key + self.size
|
|
309
|
+
if isinstance(key, slice):
|
|
310
|
+
start, stop, step = key.indices(self.size)
|
|
311
|
+
for i in range(start,stop,step):del self[i]
|
|
289
312
|
if not (0 <= key < self.size):
|
|
290
313
|
raise IndexError(f"索引 {key} 超出范围 [0, {self.size})")
|
|
291
314
|
if key <= self.split_index:
|
|
292
315
|
if key >= len(self.small):
|
|
293
316
|
raise IndexError(f"小索引 {key} 超出small数组范围(长度{len(self.small)})")
|
|
294
|
-
self.small = np.delete(self.small, key)
|
|
295
|
-
self.small = np.append(self.small, not self.is_sparse)
|
|
317
|
+
self.small = np.delete(self.small, key)# type: ignore[assignment]
|
|
318
|
+
self.small = np.append(self.small, not self.is_sparse)# type: ignore[assignment]
|
|
296
319
|
self.split_index -= min(self.split_index, len(self.small) - 1)
|
|
297
320
|
else:
|
|
298
321
|
pos = bisect.bisect_left(self.large, key)
|
|
@@ -304,7 +327,10 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
304
327
|
self.size -= 1
|
|
305
328
|
def __str__(self) -> str:
|
|
306
329
|
return f"BoolHybridArr([{','.join(map(str,self))}])"
|
|
307
|
-
def
|
|
330
|
+
def __reversed__(self):
|
|
331
|
+
if not self:return BHA_Iterator([])
|
|
332
|
+
return BHA_Iterator(map(self.__getitem__,range(-1,-1,-1)))
|
|
333
|
+
def insert(self, key: int, value: Any) -> None:
|
|
308
334
|
value = bool(value)
|
|
309
335
|
key = key if key >= 0 else key + self.size
|
|
310
336
|
key = max(0, min(key, self.size))
|
|
@@ -315,7 +341,7 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
315
341
|
(0, key - len(self.small) + 1),
|
|
316
342
|
constant_values=not self.is_sparse
|
|
317
343
|
)
|
|
318
|
-
self.small = np.insert(self.small, key, value)
|
|
344
|
+
self.small = np.insert(self.small, key, value)# type: ignore[assignment]
|
|
319
345
|
self.split_index = min(self.split_index + 1, len(self.small) - 1)
|
|
320
346
|
else:
|
|
321
347
|
pos = bisect.bisect_left(self.large, key)
|
|
@@ -325,12 +351,13 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
325
351
|
self.large.insert(pos, key)
|
|
326
352
|
self.size += 1
|
|
327
353
|
def __len__(self) -> int:
|
|
328
|
-
return self.size
|
|
354
|
+
return int(self.size)
|
|
329
355
|
def __iter__(self):
|
|
356
|
+
if not self:return BHA_Iterator([])
|
|
330
357
|
return BHA_Iterator(map(self.__getitem__,range(self.size)))
|
|
331
358
|
def __next__(self):
|
|
332
359
|
return next(self.generator)
|
|
333
|
-
def __contains__(self, value) -> bool:
|
|
360
|
+
def __contains__(self, value:Any) -> bool:
|
|
334
361
|
if not isinstance(value, (bool,np.bool_,self.Type,BHA_bool)):return False
|
|
335
362
|
if not self.size:return False
|
|
336
363
|
for i in range(10):
|
|
@@ -342,11 +369,11 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
342
369
|
else:
|
|
343
370
|
return len(self.large) == self.size-self.split_index-1 or b
|
|
344
371
|
def __bool__(self) -> bool:
|
|
345
|
-
return self.size
|
|
372
|
+
return bool(self.size)
|
|
346
373
|
def __any__(self):
|
|
347
|
-
return T in self
|
|
374
|
+
return builtins.T in self
|
|
348
375
|
def __all__(self):
|
|
349
|
-
return F not in self
|
|
376
|
+
return builtins.F not in self
|
|
350
377
|
def __eq__(self, other) -> bool:
|
|
351
378
|
if not isinstance(other, (BoolHybridArray, list, tuple, np.ndarray, array.array)):
|
|
352
379
|
return False
|
|
@@ -409,8 +436,6 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
409
436
|
arr += other
|
|
410
437
|
arr.optimize()
|
|
411
438
|
return arr
|
|
412
|
-
def __invert__(self) -> BoolHybridArray:
|
|
413
|
-
return BoolHybridArr(not val for val in self)
|
|
414
439
|
def __rand__(self, other) -> BoolHybridArray:
|
|
415
440
|
if type(other) == int:
|
|
416
441
|
other = bin(other)[2:]
|
|
@@ -531,7 +556,8 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
531
556
|
def __reduce__(self):
|
|
532
557
|
return BoolHybridArr,(np.asarray(self),self.is_sparse,self.Type,self.hash_,),
|
|
533
558
|
dequeue = lambda self:self.pop(0)
|
|
534
|
-
|
|
559
|
+
@mypyc_attr(native_class=False)
|
|
560
|
+
class BoolHybridArr(BoolHybridArray,metaclass=ResurrectMeta):# type: ignore
|
|
535
561
|
__module__ = 'bool_hybrid_array'
|
|
536
562
|
def __new__(cls, lst: Iterable = (), is_sparse=None, Type = None, hash_ = True, split_index = None) -> BoolHybridArray:
|
|
537
563
|
a = isinstance(lst, (Iterator, Generator, map))
|
|
@@ -606,7 +632,8 @@ def FalsesArray(size, Type = None,hash_ = True):
|
|
|
606
632
|
split_index = int(split_index) if split_index < 150e+7*2 else int(145e+7*2)
|
|
607
633
|
return BoolHybridArray(split_index,size,True,Type = Type,hash_ = hash_)
|
|
608
634
|
Bool_Array = np.arange(2,dtype = np.uint8)
|
|
609
|
-
|
|
635
|
+
@mypyc_attr(native_class=False)
|
|
636
|
+
class BHA_bool(int,metaclass=ResurrectMeta):# type: ignore
|
|
610
637
|
__module__ = 'bool_hybrid_array'
|
|
611
638
|
def __new__(cls, value):
|
|
612
639
|
core_value = bool(value)
|
|
@@ -640,16 +667,14 @@ class BHA_bool(int,metaclass=ResurrectMeta):
|
|
|
640
667
|
def __len__(self):
|
|
641
668
|
raise TypeError("'BHA_bool' object has no attribute '__len__'")
|
|
642
669
|
__rand__,__ror__,__rxor__ = __and__,__or__,__xor__
|
|
643
|
-
|
|
670
|
+
@mypyc_attr(native_class=False)
|
|
671
|
+
class BHA_Bool(BHA_bool,metaclass=ResurrectMeta):# type: ignore
|
|
644
672
|
__module__ = 'bool_hybrid_array'
|
|
645
673
|
@lru_cache
|
|
646
674
|
def __new__(cls,v):
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
builtins.T,builtins.F = BHA_Bool.T,BHA_Bool.F
|
|
651
|
-
return BHA_Bool.T if v else BHA_Bool.F
|
|
652
|
-
class BHA_List(list,metaclass=ResurrectMeta):
|
|
675
|
+
return builtins.T if v else builtins.F
|
|
676
|
+
@mypyc_attr(native_class=False)
|
|
677
|
+
class BHA_List(list,metaclass=ResurrectMeta):# type: ignore
|
|
653
678
|
__module__ = 'bool_hybrid_array'
|
|
654
679
|
def __init__(self,arr):
|
|
655
680
|
def Temp(v):
|
|
@@ -713,7 +738,8 @@ class BHA_List(list,metaclass=ResurrectMeta):
|
|
|
713
738
|
def to_ascii_art(self, width=20):
|
|
714
739
|
art = '\n'.join([' '.join(['■' if j else ' ' for j in i]) for i in self])
|
|
715
740
|
return art
|
|
716
|
-
|
|
741
|
+
@mypyc_attr(native_class=False)
|
|
742
|
+
class BHA_Iterator(Iterator,metaclass=ResurrectMeta):# type: ignore
|
|
717
743
|
__module__ = 'bool_hybrid_array'
|
|
718
744
|
def __init__(self,data):
|
|
719
745
|
self.data,self.copy_data = itertools.tee(iter(data),2)
|
|
@@ -734,7 +760,8 @@ class BHA_Iterator(Iterator,metaclass=ResurrectMeta):
|
|
|
734
760
|
arr = np.fromiter(self, dtype=dtype)
|
|
735
761
|
return arr.copy() if copy else arr.view()
|
|
736
762
|
__rand__,__ror__,__rxor__ = __and__,__or__,__xor__
|
|
737
|
-
|
|
763
|
+
@mypyc_attr(native_class=False)
|
|
764
|
+
class ProtectedBuiltinsDict(dict,metaclass=ResurrectMeta):# type: ignore
|
|
738
765
|
def __init__(self, *args, protected_names = ("T", "F", "BHA_Bool", "BHA_List", "BoolHybridArray", "BoolHybridArr",
|
|
739
766
|
"TruesArray", "FalsesArray", "ProtectedBuiltinsDict", "builtins",
|
|
740
767
|
"__builtins__", "__dict__","ResurrectMeta","math",
|
|
@@ -834,7 +861,7 @@ def Ask_BHA(path):
|
|
|
834
861
|
memcpy(arr.buffer_info()[0], bit_stream, total_len),arr)[-1]
|
|
835
862
|
if(n := int(x, base=16),
|
|
836
863
|
lead_zero := len(x) - len(x.lstrip('0')),
|
|
837
|
-
total_len := lead_zero +
|
|
864
|
+
total_len := lead_zero + n.bit_length())
|
|
838
865
|
else array.array('B'))
|
|
839
866
|
temp = BHA_List(map(temp2,temp))
|
|
840
867
|
if len(temp) == 1:
|
|
@@ -845,15 +872,18 @@ class BHA_Queue:
|
|
|
845
872
|
self.a = BoolHybridArr(data,*a,**k)
|
|
846
873
|
self.b = BoolHybridArr([],*a,**k)
|
|
847
874
|
def __str__(self):
|
|
848
|
-
return f"BHA_Queue([{','.join(itertools.chain(
|
|
875
|
+
return f"BHA_Queue([{','.join(itertools.chain(map(str,reversed(self.b)),map(str,self.a)))}])"
|
|
849
876
|
__repr__ = __str__
|
|
850
877
|
def enqueue(self,v):
|
|
851
878
|
self.a.push(v)
|
|
852
879
|
def dequeue(self):
|
|
853
|
-
if self.b:
|
|
880
|
+
if self.b:
|
|
881
|
+
print("正常执行")
|
|
882
|
+
return self.b.pop()
|
|
854
883
|
elif self.a:
|
|
855
|
-
tmp =
|
|
884
|
+
tmp = self.a[::-1]
|
|
856
885
|
self.b.split_index,self.b.large,self.b.small,self.b.is_sparse = tmp.split_index,tmp.large,tmp.small,tmp.is_sparse
|
|
886
|
+
print(f"self.b:{self.b}")
|
|
857
887
|
self.a.clear()
|
|
858
888
|
return self.dequeue()
|
|
859
889
|
else:
|
|
@@ -882,7 +912,7 @@ def Create_BHA(path,arr):
|
|
|
882
912
|
mm[:] = temp
|
|
883
913
|
mm.flush()
|
|
884
914
|
def numba_opt():
|
|
885
|
-
import numba
|
|
915
|
+
import numba # type: ignore
|
|
886
916
|
sig = numba.types.Union([
|
|
887
917
|
numba.types.intp(
|
|
888
918
|
numba.types.Array(numba.types.uint32, 1, 'C'),
|
|
@@ -922,7 +952,7 @@ builtins.BHA_Function = BHA_Function
|
|
|
922
952
|
builtins.Ask_BHA = Ask_BHA
|
|
923
953
|
builtins.Create_BHA = Create_BHA
|
|
924
954
|
builtins.numba_opt = numba_opt
|
|
925
|
-
Tid,Fid = id(T),id(F)
|
|
955
|
+
Tid,Fid = id(builtins.T),id(builtins.F)
|
|
926
956
|
original_id = builtins.id
|
|
927
957
|
def fake_id(obj):
|
|
928
958
|
if isinstance(obj, BHA_bool):return Tid if obj else Fid
|
|
@@ -932,8 +962,4 @@ original_builtins_dict = builtins.__dict__.copy()
|
|
|
932
962
|
__builtins__ = ProtectedBuiltinsDict(original_builtins_dict)
|
|
933
963
|
builtins = __builtins__
|
|
934
964
|
sys.modules['builtins'] = builtins
|
|
935
|
-
builtins.name = 'builtins'
|
|
936
|
-
try:
|
|
937
|
-
sys.flags.optimize = 2
|
|
938
|
-
except:
|
|
939
|
-
pass
|
|
965
|
+
builtins.name = 'builtins'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bool-hybrid-array
|
|
3
|
-
Version: 9.11.
|
|
3
|
+
Version: 9.11.8
|
|
4
4
|
Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
|
|
5
5
|
Home-page: https://github.com/BKsell/bool-hybrid-array
|
|
6
6
|
Author: 蔡靖杰
|
|
@@ -612,7 +612,8 @@ print(f"出队2个元素后: {q}") # 输出:BHA_Queue([T,T,F,T,F])
|
|
|
612
612
|
* **9.11.4**:修复TypeError: __dict__ must be set to a dictionary, not a 'IntHybridArray'的错误
|
|
613
613
|
* **9.11.5**:新增BHA_Queue双栈实现队列
|
|
614
614
|
* **9.11.6**:修复从9.11.3版本开始cpython用户无法安装bool-hybrid-array包的问题
|
|
615
|
-
|
|
615
|
+
* **9.11.7**:修复TypeError: 'map' object is not reversible的错误
|
|
616
|
+
* **9.11.8**:增加了Windows系统Python3.14的C扩展优化
|
|
616
617
|
|
|
617
618
|
|
|
618
619
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
bool_hybrid_array/__init__.py,sha256=VlUqwA0SmYh5vdHKXT-180u9A3t7Le6Fg9ppgMj8ztc,1077
|
|
2
|
+
bool_hybrid_array/__main__.py,sha256=pjoWN4Noa_K44fqQPqp8H-diKSDf0Da8hdWFgvWUigQ,9083
|
|
3
|
+
bool_hybrid_array/compile_core.pyd,sha256=lriymUZtvs_ryeGM_K8gM33iCIfxRH5Zr5GPKhuNCtw,555520
|
|
4
|
+
bool_hybrid_array/core.c,sha256=b5KMuQ6Ma64wUx-oXYqkx_AR9sTcIO0VUZ6qz_2vDM0,3227011
|
|
5
|
+
bool_hybrid_array/core.py,sha256=uJsVr6GDzCMfDLfvO9LiE0MSjmHodu4yOYwouFpxxFQ,41921
|
|
6
|
+
bool_hybrid_array/秘密.md,sha256=Ii2NvXmv-Ktu04zJsGLcQZvlzT4gOatByE4B2wTK1Ks,48
|
|
7
|
+
bool_hybrid_array/int_array/__init__.py,sha256=HPBdZu5qlXaRI4n_oK6WhnG4ml8H-FP1G44igVxPJIA,6225
|
|
8
|
+
bool_hybrid_array-9.11.8.dist-info/licenses/LICENSE,sha256=Sg4rnGXkBDYkwJCWyxdWp5H60rhVAxpNvFh_l3JWZdY,1070
|
|
9
|
+
bool_hybrid_array-9.11.8.dist-info/METADATA,sha256=deIVm_eXDmWKFWZp65t3-0UB6PZfzprqDiBUmOaSI3U,25923
|
|
10
|
+
bool_hybrid_array-9.11.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
11
|
+
bool_hybrid_array-9.11.8.dist-info/top_level.txt,sha256=vk-TD77wuVQsN1rJ6uVWZX4sC_wya_WplRDwQKJoBZM,18
|
|
12
|
+
bool_hybrid_array-9.11.8.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
bool_hybrid_array/__init__.py,sha256=YIYlFVq3n1DKvqVwK5dzqUze8mJolyMk4AE0uPKueTM,1039
|
|
2
|
-
bool_hybrid_array/__main__.py,sha256=pjoWN4Noa_K44fqQPqp8H-diKSDf0Da8hdWFgvWUigQ,9083
|
|
3
|
-
bool_hybrid_array/core.py,sha256=AUFAN-Nlg8hSVafXI7CmFdDJ4i0xVuYiCnjhZqMas1E,40647
|
|
4
|
-
bool_hybrid_array/秘密.md,sha256=Ii2NvXmv-Ktu04zJsGLcQZvlzT4gOatByE4B2wTK1Ks,48
|
|
5
|
-
bool_hybrid_array/int_array/__init__.py,sha256=HPBdZu5qlXaRI4n_oK6WhnG4ml8H-FP1G44igVxPJIA,6225
|
|
6
|
-
bool_hybrid_array-9.11.6.dist-info/licenses/LICENSE,sha256=Sg4rnGXkBDYkwJCWyxdWp5H60rhVAxpNvFh_l3JWZdY,1070
|
|
7
|
-
bool_hybrid_array-9.11.6.dist-info/METADATA,sha256=khBRIgfaAZmSl7UUI6EwZs1qyHRu5AYz-15YurNQfUs,25787
|
|
8
|
-
bool_hybrid_array-9.11.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
-
bool_hybrid_array-9.11.6.dist-info/top_level.txt,sha256=vk-TD77wuVQsN1rJ6uVWZX4sC_wya_WplRDwQKJoBZM,18
|
|
10
|
-
bool_hybrid_array-9.11.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|