bool-hybrid-array 9.10.20__tar.gz → 9.10.22__tar.gz
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-9.10.20 → bool_hybrid_array-9.10.22}/PKG-INFO +3 -1
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/README.md +2 -0
- bool_hybrid_array-9.10.22/bool_hybrid_array/__init__.py +27 -0
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array/core.py +18 -2
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array.egg-info/PKG-INFO +3 -1
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/setup.py +1 -1
- bool_hybrid_array-9.10.20/bool_hybrid_array/__init__.py +0 -54
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/LICENSE +0 -0
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array/__main__.py +0 -0
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array/int_array/__init__.py +0 -0
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array//347/247/230/345/257/206.md" +0 -0
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array.egg-info/SOURCES.txt +0 -0
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array.egg-info/dependency_links.txt +0 -0
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array.egg-info/requires.txt +0 -0
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array.egg-info/top_level.txt +0 -0
- {bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bool-hybrid-array
|
|
3
|
-
Version: 9.10.
|
|
3
|
+
Version: 9.10.22
|
|
4
4
|
Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
|
|
5
5
|
Home-page: https://github.com/BKsell/bool-hybrid-array
|
|
6
6
|
Author: 蔡靖杰
|
|
@@ -570,6 +570,8 @@ except OverflowError as e:
|
|
|
570
570
|
* **9.10.18.post4**:尝试修复“满屏错误”的问题×3
|
|
571
571
|
* **9.10.19**:和9.10.18.post4相同,正式版本发布
|
|
572
572
|
* **9.10.20**:优化性能,增加BHA_jit_log日志
|
|
573
|
+
* **9.10.21**:优化Ask_BHA,移除BHA_jit_log日志
|
|
574
|
+
* **9.10.22**:进一步优化Ask_BHA的性能
|
|
573
575
|
|
|
574
576
|
|
|
575
577
|
## **彩蛋:**
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from types import ModuleType,FunctionType
|
|
3
|
+
from . import core
|
|
4
|
+
from .core import __builtins__,builtins
|
|
5
|
+
from . import int_array
|
|
6
|
+
__version__ = "9.10.22"
|
|
7
|
+
public_objects = []
|
|
8
|
+
for name in dir(core):
|
|
9
|
+
if not name.startswith("_"):
|
|
10
|
+
obj = getattr(core, name)
|
|
11
|
+
if isinstance(obj, (type, ModuleType)) or callable(obj):
|
|
12
|
+
public_objects.append(name)
|
|
13
|
+
__all__ = public_objects + ["__version__","__builtins__","core","builtins","__dict__","int_array"]
|
|
14
|
+
globals().update({
|
|
15
|
+
name: getattr(core, name)
|
|
16
|
+
for name in public_objects
|
|
17
|
+
})
|
|
18
|
+
try:
|
|
19
|
+
__dict__ = ProtectedBuiltinsDict(globals())
|
|
20
|
+
sys.modules[__name__+'.int_array'] = ProtectedBuiltinsDict(int_array.__dict__)
|
|
21
|
+
sys.modules[__name__+'.core'] = ProtectedBuiltinsDict(core.__dict__)
|
|
22
|
+
sys.modules[__name__] = ProtectedBuiltinsDict(globals())
|
|
23
|
+
sys.modules[__name__].name = 'bool_hybrid_array'
|
|
24
|
+
core.__dict__ = ProtectedBuiltinsDict(core.__dict__)
|
|
25
|
+
except:
|
|
26
|
+
pass
|
|
27
|
+
|
|
@@ -8,6 +8,14 @@ import operator,ctypes,gc,abc,types
|
|
|
8
8
|
from functools import lru_cache
|
|
9
9
|
from typing import Union,_GenericAlias
|
|
10
10
|
hybrid_array_cache = []
|
|
11
|
+
try:
|
|
12
|
+
msvcrt = ctypes.CDLL('msvcrt.dll')
|
|
13
|
+
memcpy = msvcrt.memcpy
|
|
14
|
+
except:
|
|
15
|
+
libc = ctypes.CDLL('libc.so.6')
|
|
16
|
+
memcpy = libc.memcpy
|
|
17
|
+
memcpy.argtypes = (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_size_t)
|
|
18
|
+
memcpy.restype = ctypes.c_void_p
|
|
11
19
|
if 'UnionType' in types.__dict__:
|
|
12
20
|
class Union:
|
|
13
21
|
def __getitem__(self,*args):
|
|
@@ -333,7 +341,7 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
|
|
|
333
341
|
return False
|
|
334
342
|
return all(a == b for a, b in zip(self, other))
|
|
335
343
|
def __ne__(self, other) -> bool:
|
|
336
|
-
return not self
|
|
344
|
+
return not self == other
|
|
337
345
|
def __and__(self, other) -> BoolHybridArray:
|
|
338
346
|
if type(other) == int:
|
|
339
347
|
other = abs(other)
|
|
@@ -785,7 +793,15 @@ def Ask_BHA(path):
|
|
|
785
793
|
with mm:
|
|
786
794
|
temp = mm.read().decode('utf-8').strip()
|
|
787
795
|
temp = temp.split()
|
|
788
|
-
temp2 = lambda x:BoolHybridArr(
|
|
796
|
+
temp2 = lambda x: BoolHybridArr(
|
|
797
|
+
(
|
|
798
|
+
bit_stream := bytes(0 if k < lead_zero else (n >> ((total_len - 1) - k)) & 1 for k in range(total_len)),
|
|
799
|
+
arr := array.array('B', FalsesArray(total_len)),
|
|
800
|
+
memcpy(arr.buffer_info()[0], bit_stream, total_len),arr)[-1]
|
|
801
|
+
if(n := int(x, base=16),
|
|
802
|
+
lead_zero := len(x) - len(x.lstrip('0')),
|
|
803
|
+
total_len := lead_zero + (n.bit_length() if n else 1))
|
|
804
|
+
else array.array('B'))
|
|
789
805
|
temp = BHA_List(map(temp2,temp))
|
|
790
806
|
if len(temp) == 1:
|
|
791
807
|
return temp[0]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bool-hybrid-array
|
|
3
|
-
Version: 9.10.
|
|
3
|
+
Version: 9.10.22
|
|
4
4
|
Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
|
|
5
5
|
Home-page: https://github.com/BKsell/bool-hybrid-array
|
|
6
6
|
Author: 蔡靖杰
|
|
@@ -570,6 +570,8 @@ except OverflowError as e:
|
|
|
570
570
|
* **9.10.18.post4**:尝试修复“满屏错误”的问题×3
|
|
571
571
|
* **9.10.19**:和9.10.18.post4相同,正式版本发布
|
|
572
572
|
* **9.10.20**:优化性能,增加BHA_jit_log日志
|
|
573
|
+
* **9.10.21**:优化Ask_BHA,移除BHA_jit_log日志
|
|
574
|
+
* **9.10.22**:进一步优化Ask_BHA的性能
|
|
573
575
|
|
|
574
576
|
|
|
575
577
|
## **彩蛋:**
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from types import ModuleType,FunctionType
|
|
3
|
-
from . import core
|
|
4
|
-
from .core import __builtins__,builtins
|
|
5
|
-
from . import int_array
|
|
6
|
-
__version__ = "9.10.20"
|
|
7
|
-
public_objects = []
|
|
8
|
-
BHA_jit_log = {}
|
|
9
|
-
def jit_class_methods(cls):
|
|
10
|
-
for attr_name in dir(cls):
|
|
11
|
-
if not attr_name.startswith("_"):
|
|
12
|
-
attr = getattr(cls, attr_name)
|
|
13
|
-
if isinstance(attr, FunctionType):
|
|
14
|
-
try:
|
|
15
|
-
setattr(cls, attr_name, jit(attr))
|
|
16
|
-
except Exception as e:
|
|
17
|
-
BHA_jit_log[attr_name] = e
|
|
18
|
-
elif isinstance(attr, classmethod):
|
|
19
|
-
original_func = attr.__func__
|
|
20
|
-
try:
|
|
21
|
-
setattr(cls, attr_name, classmethod(jit(original_func)))
|
|
22
|
-
except Exception as e:
|
|
23
|
-
BHA_jit_log[attr_name] = e
|
|
24
|
-
return cls
|
|
25
|
-
for name in dir(core):
|
|
26
|
-
if not name.startswith("_"):
|
|
27
|
-
obj = getattr(core, name)
|
|
28
|
-
if isinstance(obj, (type, ModuleType)) or callable(obj):
|
|
29
|
-
public_objects.append(name)
|
|
30
|
-
if isinstance(obj,FunctionType):
|
|
31
|
-
try:setattr(core,name,jit(obj))
|
|
32
|
-
except Exception as e:
|
|
33
|
-
BHA_jit_log[name] = e
|
|
34
|
-
elif isinstance(obj,type):
|
|
35
|
-
jit_class_methods(obj)
|
|
36
|
-
try:
|
|
37
|
-
bisect.bisect_left = jit(bisect.bisect_left)
|
|
38
|
-
bisect.bisect_right = jit(bisect.bisect_right)
|
|
39
|
-
except Exception as e:
|
|
40
|
-
BHA_jit_log["bisect"] = e
|
|
41
|
-
__all__ = public_objects + ["__version__","__builtins__","core","builtins","__dict__","int_array"]
|
|
42
|
-
globals().update({
|
|
43
|
-
name: getattr(core, name)
|
|
44
|
-
for name in public_objects
|
|
45
|
-
})
|
|
46
|
-
try:
|
|
47
|
-
__dict__ = ProtectedBuiltinsDict(globals())
|
|
48
|
-
sys.modules[__name__+'.int_array'] = ProtectedBuiltinsDict(int_array.__dict__)
|
|
49
|
-
sys.modules[__name__] = ProtectedBuiltinsDict(globals().copy())
|
|
50
|
-
sys.modules[__name__].name = 'bool_hybrid_array'
|
|
51
|
-
core.__dict__ = ProtectedBuiltinsDict(core.__dict__)
|
|
52
|
-
except:
|
|
53
|
-
pass
|
|
54
|
-
|
|
File without changes
|
|
File without changes
|
{bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array/int_array/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array.egg-info/requires.txt
RENAMED
|
File without changes
|
{bool_hybrid_array-9.10.20 → bool_hybrid_array-9.10.22}/bool_hybrid_array.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|