bool-hybrid-array 9.11.13__py3-none-any.whl → 9.11.14__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 +1 -1
- bool_hybrid_array/core.c +1 -67391
- bool_hybrid_array/core.py +12 -4
- {bool_hybrid_array-9.11.13.dist-info → bool_hybrid_array-9.11.14.dist-info}/METADATA +5 -1
- {bool_hybrid_array-9.11.13.dist-info → bool_hybrid_array-9.11.14.dist-info}/RECORD +8 -8
- {bool_hybrid_array-9.11.13.dist-info → bool_hybrid_array-9.11.14.dist-info}/WHEEL +0 -0
- {bool_hybrid_array-9.11.13.dist-info → bool_hybrid_array-9.11.14.dist-info}/licenses/LICENSE +0 -0
- {bool_hybrid_array-9.11.13.dist-info → bool_hybrid_array-9.11.14.dist-info}/top_level.txt +0 -0
bool_hybrid_array/core.py
CHANGED
|
@@ -15,6 +15,7 @@ from functools import lru_cache
|
|
|
15
15
|
from typing import _GenericAlias
|
|
16
16
|
from typing import Callable, Union, Sequence, MutableSequence, Any, overload, Sized
|
|
17
17
|
hybrid_array_cache:list[tuple[Any]] = []
|
|
18
|
+
index_range=lambda BHA:(BHA[i] for i in itertools.count(0) if i < BHA.size)
|
|
18
19
|
try:
|
|
19
20
|
msvcrt = ctypes.CDLL('msvcrt.dll')
|
|
20
21
|
memcpy = msvcrt.memcpy
|
|
@@ -277,14 +278,14 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):# type:
|
|
|
277
278
|
value_list = list(value)
|
|
278
279
|
new_len = len(value_list)
|
|
279
280
|
if step != 1:
|
|
280
|
-
slice_indices =
|
|
281
|
+
slice_indices = range(start, stop, step)
|
|
281
282
|
if new_len != len(slice_indices):
|
|
282
283
|
raise ValueError(f"值长度与切片长度不匹配:{new_len} vs {len(slice_indices)}")
|
|
283
284
|
for i, val in zip(slice_indices, value_list):
|
|
284
285
|
self[i] = val
|
|
285
286
|
return
|
|
286
287
|
if new_len == max(0, stop - start):
|
|
287
|
-
for v,i in zip(
|
|
288
|
+
for v,i in zip(value_list,range(start,stop)):
|
|
288
289
|
self[i] = v
|
|
289
290
|
return
|
|
290
291
|
for i in range(stop - 1, start - 1, -1):
|
|
@@ -358,7 +359,7 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):# type:
|
|
|
358
359
|
return int(self.size)
|
|
359
360
|
def __iter__(self):
|
|
360
361
|
if not self:return BHA_Iterator([])
|
|
361
|
-
return BHA_Iterator(map(self.__getitem__,
|
|
362
|
+
return BHA_Iterator(map(self.__getitem__,index_range(size)))
|
|
362
363
|
def __next__(self):
|
|
363
364
|
return next(self.generator)
|
|
364
365
|
def __contains__(self, value:Any) -> bool:
|
|
@@ -427,7 +428,6 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):# type:
|
|
|
427
428
|
return self
|
|
428
429
|
if not self.is_sparse:
|
|
429
430
|
self += FalsesArray(int(other))
|
|
430
|
-
self.optimize()
|
|
431
431
|
else:
|
|
432
432
|
self.size += int(other)
|
|
433
433
|
return self
|
|
@@ -448,6 +448,14 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):# type:
|
|
|
448
448
|
if len(self) != len(other):
|
|
449
449
|
raise ValueError(f"异或运算要求数组长度相同({len(self)} vs {len(other)})")
|
|
450
450
|
return BoolHybridArr(map(operator.xor, self, other),hash_ = self.hash_)
|
|
451
|
+
def __gt__(self,other):
|
|
452
|
+
if self.size!=len(other)
|
|
453
|
+
return self.size>len(other)
|
|
454
|
+
return any(map(operator.gt,self,other)
|
|
455
|
+
def __lt__(self,other):
|
|
456
|
+
if self.size!=len(other)
|
|
457
|
+
return self.size<len(other)
|
|
458
|
+
return any(map(operator.lt,self,other)
|
|
451
459
|
def __rxor__(self, other) -> BoolHybridArray:
|
|
452
460
|
return self^other
|
|
453
461
|
def __invert__(self) -> BoolHybridArray:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bool-hybrid-array
|
|
3
|
-
Version: 9.11.
|
|
3
|
+
Version: 9.11.14
|
|
4
4
|
Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
|
|
5
5
|
Home-page: https://github.com/BKsell/bool-hybrid-array
|
|
6
6
|
Author: 蔡靖杰
|
|
@@ -33,6 +33,8 @@ Provides-Extra: numba-opt
|
|
|
33
33
|
Requires-Dist: numba>=0.55.0; extra == "numba-opt"
|
|
34
34
|
Provides-Extra: cython-opt
|
|
35
35
|
Requires-Dist: cython>=3.2.4; extra == "cython-opt"
|
|
36
|
+
Provides-Extra: cycy-opt
|
|
37
|
+
Requires-Dist: cycy-runtime>=0.2.4; extra == "cycy-opt"
|
|
36
38
|
Dynamic: author
|
|
37
39
|
Dynamic: author-email
|
|
38
40
|
Dynamic: classifier
|
|
@@ -623,6 +625,8 @@ print(f"出队2个元素后: {q}") # 输出:BHA_Queue([T,T,F,T,F])
|
|
|
623
625
|
* **9.11.11**:新增cin对EOF的处理
|
|
624
626
|
* **9.11.12**:优化了IntHybridArray的__setitem__,新增了IntHybridArray的sort
|
|
625
627
|
* **9.11.13**:修复IndexError的错误
|
|
628
|
+
* **9.11.14**:新增BoolHybridArray数组的大小比较
|
|
629
|
+
|
|
626
630
|
|
|
627
631
|
|
|
628
632
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
bool_hybrid_array/__init__.py,sha256=
|
|
1
|
+
bool_hybrid_array/__init__.py,sha256=UYkGgU0Ux77DN1qfEW37ba2mjDAhqCIrqCgxGpY3h_g,1086
|
|
2
2
|
bool_hybrid_array/__main__.py,sha256=uFyebfsZl1tW54AVcc6IDhk36BglTGb_Vw3Djx8pq00,8987
|
|
3
3
|
bool_hybrid_array/_cppiostream.py,sha256=1i973ag_8XgivQkeIbqzHivflcQkVFtX77R_UwChSAg,9205
|
|
4
4
|
bool_hybrid_array/compile_core.cp314-win_amd64.pyd,sha256=3vFAZ6vSMqoP_fWRkXd_KVPVUw4oo2Nv7xi0sBQu2fQ,516096
|
|
5
|
-
bool_hybrid_array/core.c,sha256=
|
|
6
|
-
bool_hybrid_array/core.py,sha256=
|
|
5
|
+
bool_hybrid_array/core.c,sha256=iG3px_6ZJzYhlSnZUpZxJP4CRYfMGk39dlQveU26ZFc,79
|
|
6
|
+
bool_hybrid_array/core.py,sha256=6BLUmXX-5fBnjamspmfaZAuVetBvDH-eAn6_F5QPaxM,42607
|
|
7
7
|
bool_hybrid_array/秘密.md,sha256=Ii2NvXmv-Ktu04zJsGLcQZvlzT4gOatByE4B2wTK1Ks,48
|
|
8
8
|
bool_hybrid_array/int_array/__init__.py,sha256=CCKDUL5GBAXOprc9FhtLNL_rP4IDhvGVWJ-Dporp6YI,112
|
|
9
9
|
bool_hybrid_array/int_array/core.py,sha256=DZ6mC-qLQahV25b_1RHGPK959XYtILYP_Pbwwg7nFLA,7936
|
|
10
|
-
bool_hybrid_array-9.11.
|
|
11
|
-
bool_hybrid_array-9.11.
|
|
12
|
-
bool_hybrid_array-9.11.
|
|
13
|
-
bool_hybrid_array-9.11.
|
|
14
|
-
bool_hybrid_array-9.11.
|
|
10
|
+
bool_hybrid_array-9.11.14.dist-info/licenses/LICENSE,sha256=Sg4rnGXkBDYkwJCWyxdWp5H60rhVAxpNvFh_l3JWZdY,1070
|
|
11
|
+
bool_hybrid_array-9.11.14.dist-info/METADATA,sha256=mZs2z7RnExO3ywqfEdGXdfb1SRgWXsOx3oTewbn_moI,26618
|
|
12
|
+
bool_hybrid_array-9.11.14.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
13
|
+
bool_hybrid_array-9.11.14.dist-info/top_level.txt,sha256=vk-TD77wuVQsN1rJ6uVWZX4sC_wya_WplRDwQKJoBZM,18
|
|
14
|
+
bool_hybrid_array-9.11.14.dist-info/RECORD,,
|
|
File without changes
|
{bool_hybrid_array-9.11.13.dist-info → bool_hybrid_array-9.11.14.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|