bool-hybrid-array 9.11.15__py3-none-any.whl → 9.11.16__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/__main__.py +1 -1
- bool_hybrid_array/core.c +68722 -1
- bool_hybrid_array/core.py +5 -6
- bool_hybrid_array/float_array/core.py +2 -2
- bool_hybrid_array/int_array/core.py +2 -1
- {bool_hybrid_array-9.11.15.dist-info → bool_hybrid_array-9.11.16.dist-info}/METADATA +3 -2
- bool_hybrid_array-9.11.16.dist-info/RECORD +15 -0
- bool_hybrid_array-9.11.15.dist-info/RECORD +0 -15
- {bool_hybrid_array-9.11.15.dist-info → bool_hybrid_array-9.11.16.dist-info}/WHEEL +0 -0
- {bool_hybrid_array-9.11.15.dist-info → bool_hybrid_array-9.11.16.dist-info}/licenses/LICENSE +0 -0
- {bool_hybrid_array-9.11.15.dist-info → bool_hybrid_array-9.11.16.dist-info}/top_level.txt +0 -0
bool_hybrid_array/core.py
CHANGED
|
@@ -15,7 +15,6 @@ 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)
|
|
19
18
|
try:
|
|
20
19
|
msvcrt = ctypes.CDLL('msvcrt.dll')
|
|
21
20
|
memcpy = msvcrt.memcpy
|
|
@@ -359,7 +358,7 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):# type:
|
|
|
359
358
|
return int(self.size)
|
|
360
359
|
def __iter__(self):
|
|
361
360
|
if not self:return BHA_Iterator([])
|
|
362
|
-
return BHA_Iterator(map(self.__getitem__,
|
|
361
|
+
return BHA_Iterator(map(self.__getitem__,itertools.takewhile(lambda x: x < self.size, itertools.count(0))))
|
|
363
362
|
def __next__(self):
|
|
364
363
|
return next(self.generator)
|
|
365
364
|
def __contains__(self, value:Any) -> bool:
|
|
@@ -449,13 +448,13 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):# type:
|
|
|
449
448
|
raise ValueError(f"异或运算要求数组长度相同({len(self)} vs {len(other)})")
|
|
450
449
|
return BoolHybridArr(map(operator.xor, self, other),hash_ = self.hash_)
|
|
451
450
|
def __gt__(self,other):
|
|
452
|
-
if self.size!=len(other)
|
|
451
|
+
if self.size!=len(other):
|
|
453
452
|
return self.size>len(other)
|
|
454
|
-
return any(map(operator.gt,self,other)
|
|
453
|
+
return any(map(operator.gt,self,other))
|
|
455
454
|
def __lt__(self,other):
|
|
456
|
-
if self.size!=len(other)
|
|
455
|
+
if self.size!=len(other):
|
|
457
456
|
return self.size<len(other)
|
|
458
|
-
return any(map(operator.lt,self,other)
|
|
457
|
+
return any(map(operator.lt,self,other))
|
|
459
458
|
def __rxor__(self, other) -> BoolHybridArray:
|
|
460
459
|
return self^other
|
|
461
460
|
def __invert__(self) -> BoolHybridArray:
|
|
@@ -3,7 +3,7 @@ from collections.abc import Sequence
|
|
|
3
3
|
from ..int_array import IntHybridArray
|
|
4
4
|
from ..core import BHA_Iterator
|
|
5
5
|
import operator,math,itertools
|
|
6
|
-
class BHA_Float
|
|
6
|
+
class BHA_Float:
|
|
7
7
|
def __init__(self, data: int | str | float | BHA_Float | tuple):
|
|
8
8
|
if isinstance(data, tuple):
|
|
9
9
|
self.a,self.b,self.length = data
|
|
@@ -155,4 +155,4 @@ class FloatHybridArray(Sequence):
|
|
|
155
155
|
def __len__(self):
|
|
156
156
|
return len(self.a)
|
|
157
157
|
def __iter__(self):
|
|
158
|
-
return BHA_Iterator(
|
|
158
|
+
return BHA_Iterator(value for value in itertools.takewhile(lambda x: x < len(self), itertools.count(0)))
|
|
@@ -129,7 +129,8 @@ class IntHybridArray(BoolHybridArray,metaclass=ResurrectMeta):
|
|
|
129
129
|
tmp1 = IntHybridArray([value],bit_length = self.bit_length)
|
|
130
130
|
tmp = tmp1.view()
|
|
131
131
|
if tmp1[0] == value:
|
|
132
|
-
|
|
132
|
+
for i,v in zip(range(key*self.bit_length,(key+1)*self.bit_length),tmp):
|
|
133
|
+
super().__setitem__(i,v)
|
|
133
134
|
else:
|
|
134
135
|
lst = list(self)
|
|
135
136
|
lst[key] = value
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bool-hybrid-array
|
|
3
|
-
Version: 9.11.
|
|
3
|
+
Version: 9.11.16
|
|
4
4
|
Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
|
|
5
5
|
Home-page: https://github.com/BKsell/bool-hybrid-array
|
|
6
6
|
Author: 蔡靖杰
|
|
@@ -486,7 +486,7 @@ class MathTools(BaseMathTools,metaclass = namespace):
|
|
|
486
486
|
e = 2.718281828
|
|
487
487
|
protected_names = (*BaseMathTools.protected_names,"e","sub","mul")
|
|
488
488
|
|
|
489
|
-
print(MathTools.
|
|
489
|
+
print(MathTools.mul(10,23))#输出:230
|
|
490
490
|
```
|
|
491
491
|
|
|
492
492
|
## 性能优势
|
|
@@ -664,6 +664,7 @@ print(MathTools.sub(10,23))#输出:230
|
|
|
664
664
|
* **9.11.13**:修复IndexError的错误
|
|
665
665
|
* **9.11.14**:新增BoolHybridArray数组的大小比较
|
|
666
666
|
* **9.11.15**:新增float_array子包和namespace元类
|
|
667
|
+
* **9.11.16**:修复SyntaxError错误
|
|
667
668
|
|
|
668
669
|
|
|
669
670
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
bool_hybrid_array/__init__.py,sha256=Zluk7xAYl3eL8dcMj2lFmMQVAkvWTNoWFELjDBrkq6Y,1112
|
|
2
|
+
bool_hybrid_array/__main__.py,sha256=vJd9O_raREHIRCU0hkYzXM-lzRhgybhJqsKze6YcSDg,10058
|
|
3
|
+
bool_hybrid_array/_cppiostream.py,sha256=1i973ag_8XgivQkeIbqzHivflcQkVFtX77R_UwChSAg,9205
|
|
4
|
+
bool_hybrid_array/core.c,sha256=32k6ov1QiLS4OhMZoshe3Xie8ttBu3RANsOkP-UfL9w,3306682
|
|
5
|
+
bool_hybrid_array/core.py,sha256=LaOW0HXEms6FbNQYfkmY3m40m9lX4wxbVGWjU4xXDcI,42864
|
|
6
|
+
bool_hybrid_array/秘密.md,sha256=Ii2NvXmv-Ktu04zJsGLcQZvlzT4gOatByE4B2wTK1Ks,48
|
|
7
|
+
bool_hybrid_array/float_array/__init__.py,sha256=tnOiqeZ4AIvNgPV16tt0ydz0NWzSa6e4arInS6F8Y-0,86
|
|
8
|
+
bool_hybrid_array/float_array/core.py,sha256=LVC0YOINBoHVB5sGZcuzlsVYs_cUgfxC4idCgIzTZ78,6639
|
|
9
|
+
bool_hybrid_array/int_array/__init__.py,sha256=CCKDUL5GBAXOprc9FhtLNL_rP4IDhvGVWJ-Dporp6YI,112
|
|
10
|
+
bool_hybrid_array/int_array/core.py,sha256=ZH_UzPduamvqoYDB2tobg3zQTfZzIjrQ1qc8xi4QvP0,7974
|
|
11
|
+
bool_hybrid_array-9.11.16.dist-info/licenses/LICENSE,sha256=Sg4rnGXkBDYkwJCWyxdWp5H60rhVAxpNvFh_l3JWZdY,1070
|
|
12
|
+
bool_hybrid_array-9.11.16.dist-info/METADATA,sha256=BdR82YpDjCkqOHgY2TLF-pweTC1IzsbtNeEMh3u3OIs,27789
|
|
13
|
+
bool_hybrid_array-9.11.16.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
14
|
+
bool_hybrid_array-9.11.16.dist-info/top_level.txt,sha256=vk-TD77wuVQsN1rJ6uVWZX4sC_wya_WplRDwQKJoBZM,18
|
|
15
|
+
bool_hybrid_array-9.11.16.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
bool_hybrid_array/__init__.py,sha256=3lakvdUwLIemZs9s96GNgOJVDXH5dSQoUUQJbc656gQ,1112
|
|
2
|
-
bool_hybrid_array/__main__.py,sha256=Upm136zlFUq1ORDakehl93tyI16Oohqabc4A8IjaGC4,10058
|
|
3
|
-
bool_hybrid_array/_cppiostream.py,sha256=1i973ag_8XgivQkeIbqzHivflcQkVFtX77R_UwChSAg,9205
|
|
4
|
-
bool_hybrid_array/core.c,sha256=iG3px_6ZJzYhlSnZUpZxJP4CRYfMGk39dlQveU26ZFc,79
|
|
5
|
-
bool_hybrid_array/core.py,sha256=lbKvqSnihcT7yWZYEeT4IKA9rZyrUQrRcFT3Cpi2K6E,42890
|
|
6
|
-
bool_hybrid_array/秘密.md,sha256=Ii2NvXmv-Ktu04zJsGLcQZvlzT4gOatByE4B2wTK1Ks,48
|
|
7
|
-
bool_hybrid_array/float_array/__init__.py,sha256=tnOiqeZ4AIvNgPV16tt0ydz0NWzSa6e4arInS6F8Y-0,86
|
|
8
|
-
bool_hybrid_array/float_array/core.py,sha256=1s8DwtZKzx9PK2ZB-93JdieXQ0tG_-uERwmEvWO6k-4,6615
|
|
9
|
-
bool_hybrid_array/int_array/__init__.py,sha256=CCKDUL5GBAXOprc9FhtLNL_rP4IDhvGVWJ-Dporp6YI,112
|
|
10
|
-
bool_hybrid_array/int_array/core.py,sha256=DZ6mC-qLQahV25b_1RHGPK959XYtILYP_Pbwwg7nFLA,7936
|
|
11
|
-
bool_hybrid_array-9.11.15.dist-info/licenses/LICENSE,sha256=Sg4rnGXkBDYkwJCWyxdWp5H60rhVAxpNvFh_l3JWZdY,1070
|
|
12
|
-
bool_hybrid_array-9.11.15.dist-info/METADATA,sha256=RqFSYvXYpxEpOFHmZl3qk_Sq1dj8zb85oXDXs_rSwhM,27748
|
|
13
|
-
bool_hybrid_array-9.11.15.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
14
|
-
bool_hybrid_array-9.11.15.dist-info/top_level.txt,sha256=vk-TD77wuVQsN1rJ6uVWZX4sC_wya_WplRDwQKJoBZM,18
|
|
15
|
-
bool_hybrid_array-9.11.15.dist-info/RECORD,,
|
|
File without changes
|
{bool_hybrid_array-9.11.15.dist-info → bool_hybrid_array-9.11.16.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|