bool-hybrid-array 9.10.20__tar.gz → 9.10.21__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bool-hybrid-array
3
- Version: 9.10.20
3
+ Version: 9.10.21
4
4
  Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
5
5
  Home-page: https://github.com/BKsell/bool-hybrid-array
6
6
  Author: 蔡靖杰
@@ -570,6 +570,7 @@ 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日志
573
574
 
574
575
 
575
576
  ## **彩蛋:**
@@ -530,6 +530,7 @@ except OverflowError as e:
530
530
  * **9.10.18.post4**:尝试修复“满屏错误”的问题×3
531
531
  * **9.10.19**:和9.10.18.post4相同,正式版本发布
532
532
  * **9.10.20**:优化性能,增加BHA_jit_log日志
533
+ * **9.10.21**:优化Ask_BHA,移除BHA_jit_log日志
533
534
 
534
535
 
535
536
  ## **彩蛋:**
@@ -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.21"
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
+
@@ -333,7 +333,7 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
333
333
  return False
334
334
  return all(a == b for a, b in zip(self, other))
335
335
  def __ne__(self, other) -> bool:
336
- return not self.__eq__(other)
336
+ return not self == other
337
337
  def __and__(self, other) -> BoolHybridArray:
338
338
  if type(other) == int:
339
339
  other = abs(other)
@@ -785,7 +785,19 @@ def Ask_BHA(path):
785
785
  with mm:
786
786
  temp = mm.read().decode('utf-8').strip()
787
787
  temp = temp.split()
788
- temp2 = lambda x:BoolHybridArr(map(int,'0'*(len(x) - len(x.lstrip('0')))+bin(int(x,base = 16))[2:]),hash_ = F)
788
+ temp2 = lambda x: BoolHybridArr(
789
+ reduce(
790
+ lambda acc, k: acc.append(0 if k < lead_zero else
791
+ (n >> ((total_len - 1) - k)) & 1
792
+ ) or acc,
793
+ range(total_len),
794
+ array.array('B',[])),
795
+ hash_=F
796
+ )if(
797
+ n := int(x, base=16),
798
+ lead_zero := len(x) - len(x.lstrip('0')),
799
+ total_len := lead_zero + (n.bit_length() if n != 0 else 1)
800
+ )else None
789
801
  temp = BHA_List(map(temp2,temp))
790
802
  if len(temp) == 1:
791
803
  return temp[0]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bool-hybrid-array
3
- Version: 9.10.20
3
+ Version: 9.10.21
4
4
  Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
5
5
  Home-page: https://github.com/BKsell/bool-hybrid-array
6
6
  Author: 蔡靖杰
@@ -570,6 +570,7 @@ 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日志
573
574
 
574
575
 
575
576
  ## **彩蛋:**
@@ -8,7 +8,7 @@ def get_long_description():
8
8
  return "一个高效的布尔数组(密集+稀疏混合存储,节省内存)"
9
9
  setup(
10
10
  name="bool-hybrid-array",
11
- version="9.10.20",
11
+ version="9.10.21",
12
12
  author="蔡靖杰",
13
13
  extras_require={"int_array":[]},
14
14
  author_email="1289270215@qq.com",
@@ -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
-