bool-hybrid-array 9.11.0__tar.gz → 9.11.1__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.11.0
3
+ Version: 9.11.1
4
4
  Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
5
5
  Home-page: https://github.com/BKsell/bool-hybrid-array
6
6
  Author: 蔡靖杰
@@ -17,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Classifier: Programming Language :: Python :: 3.13
19
19
  Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python :: 3 :: Only
20
21
  Classifier: Programming Language :: Python :: Implementation :: CPython
21
22
  Classifier: Programming Language :: Python :: Implementation :: PyPy
22
23
  Classifier: License :: OSI Approved :: MIT License
@@ -26,6 +27,8 @@ Description-Content-Type: text/markdown
26
27
  License-File: LICENSE
27
28
  Requires-Dist: numpy>=1.19.0
28
29
  Provides-Extra: int-array
30
+ Provides-Extra: numba-opt
31
+ Requires-Dist: numba>=0.55.0; extra == "numba-opt"
29
32
  Dynamic: author
30
33
  Dynamic: author-email
31
34
  Dynamic: classifier
@@ -42,10 +45,17 @@ Dynamic: summary
42
45
 
43
46
  # BoolHybridArray:高效的布尔混合数组库
44
47
 
48
+ <!-- 月下载量(核心推荐)+ 周下载量 + 总下载量 -->
49
+ [![月下载量](https://static.pepy.tech/badge/bool-hybrid-array/month)](https://pepy.tech/project/bool-hybrid-array)
50
+ [![周下载量](https://static.pepy.tech/badge/bool-hybrid-array/week)](https://pepy.tech/project/bool-hybrid-array)
51
+ [![总下载量](https://static.pepy.tech/badge/bool-hybrid-array)](https://pepy.tech/project/bool-hybrid-array)
52
+
45
53
  一个专为布尔值优化的数组类,能够根据数据特征自动在密集存储和稀疏存储模式间切换,兼顾性能和内存效率。
46
54
 
47
55
  ## ***注:大版本号更新并非不兼容更新,而是重大更新***
48
56
 
57
+ 注:当API完全稳定时就会发布版本规则较严谨的new-1.0.0版本,预期为10.x版本结束后
58
+
49
59
  ***注意:目前社区中若存在名称类似(如包含 “bool-hybrid-array”+ 后缀、boolean\_array、validate.io-boolean-array)的库,均与本项目(bool-hybrid-array)无关联,本项目的所有功能设计、代码实现均为独立开发;***
50
60
  ***其他平台里的类似名库绝不是我的库***
51
61
 
@@ -143,7 +153,7 @@ big_arr = BoolHybridArr([i % 100 == 0 for i in range(10000)])
143
153
 
144
154
  # 查看存储模式(此时应为稀疏模式)
145
155
 
146
- print(repr(big_arr)) # 输出: BoolHybridArray(split_index=100,size=10000,is_sparse=True,small_len=100,large_len=)不好意思large_len我不知道
156
+ print(repr(big_arr)) # 输出: BoolHybridArray(split_index=100, size=10000, is_sparse=True, small_len=101, large_len=98)
147
157
 
148
158
  # 自动优化存储
149
159
 
@@ -574,7 +584,8 @@ except OverflowError as e:
574
584
  * **9.10.20**:优化性能,增加BHA_jit_log日志
575
585
  * **9.10.21**:优化Ask_BHA,移除BHA_jit_log日志
576
586
  * **9.10.22**:进一步优化Ask_BHA的性能
577
- * **9.11.0**:新增对7.3.10以上的版本的PyPy解释器的支持
587
+ * **9.11.0**:新增对7.3.10以上版本的PyPy解释器的支持
588
+ * **9.11.1**:修复PyPy解释器下的保护机制过度保护bug
578
589
 
579
590
 
580
591
 
@@ -1,9 +1,16 @@
1
1
  # BoolHybridArray:高效的布尔混合数组库
2
2
 
3
+ <!-- 月下载量(核心推荐)+ 周下载量 + 总下载量 -->
4
+ [![月下载量](https://static.pepy.tech/badge/bool-hybrid-array/month)](https://pepy.tech/project/bool-hybrid-array)
5
+ [![周下载量](https://static.pepy.tech/badge/bool-hybrid-array/week)](https://pepy.tech/project/bool-hybrid-array)
6
+ [![总下载量](https://static.pepy.tech/badge/bool-hybrid-array)](https://pepy.tech/project/bool-hybrid-array)
7
+
3
8
  一个专为布尔值优化的数组类,能够根据数据特征自动在密集存储和稀疏存储模式间切换,兼顾性能和内存效率。
4
9
 
5
10
  ## ***注:大版本号更新并非不兼容更新,而是重大更新***
6
11
 
12
+ 注:当API完全稳定时就会发布版本规则较严谨的new-1.0.0版本,预期为10.x版本结束后
13
+
7
14
  ***注意:目前社区中若存在名称类似(如包含 “bool-hybrid-array”+ 后缀、boolean\_array、validate.io-boolean-array)的库,均与本项目(bool-hybrid-array)无关联,本项目的所有功能设计、代码实现均为独立开发;***
8
15
  ***其他平台里的类似名库绝不是我的库***
9
16
 
@@ -101,7 +108,7 @@ big_arr = BoolHybridArr([i % 100 == 0 for i in range(10000)])
101
108
 
102
109
  # 查看存储模式(此时应为稀疏模式)
103
110
 
104
- print(repr(big_arr)) # 输出: BoolHybridArray(split_index=100,size=10000,is_sparse=True,small_len=100,large_len=)不好意思large_len我不知道
111
+ print(repr(big_arr)) # 输出: BoolHybridArray(split_index=100, size=10000, is_sparse=True, small_len=101, large_len=98)
105
112
 
106
113
  # 自动优化存储
107
114
 
@@ -532,7 +539,8 @@ except OverflowError as e:
532
539
  * **9.10.20**:优化性能,增加BHA_jit_log日志
533
540
  * **9.10.21**:优化Ask_BHA,移除BHA_jit_log日志
534
541
  * **9.10.22**:进一步优化Ask_BHA的性能
535
- * **9.11.0**:新增对7.3.10以上的版本的PyPy解释器的支持
542
+ * **9.11.0**:新增对7.3.10以上版本的PyPy解释器的支持
543
+ * **9.11.1**:修复PyPy解释器下的保护机制过度保护bug
536
544
 
537
545
 
538
546
 
@@ -5,7 +5,7 @@ from . import core
5
5
  from .core import __builtins__,builtins
6
6
  try:from . import int_array
7
7
  except:pass
8
- __version__ = "9.11.0"
8
+ __version__ = "9.11.1"
9
9
  public_objects = []
10
10
  for name in dir(core):
11
11
  if not name.startswith("_"):
@@ -702,6 +702,9 @@ class BHA_List(list,metaclass=ResurrectMeta):
702
702
  "对比numpy节省": f"{(1 - total / (temp + 96)) * 100:.6f}%"}
703
703
  def __iter__(self):
704
704
  return BHA_Iterator(super().__iter__())
705
+ def to_ascii_art(self, width=20):
706
+ art = '\n'.join([''.join(['■' if j else ' ' for j in i]) for i in self])
707
+ return '\n'.join(art)
705
708
  class BHA_Iterator(Iterator,metaclass=ResurrectMeta):
706
709
  __module__ = 'bool_hybrid_array'
707
710
  def __init__(self,data):
@@ -738,7 +741,9 @@ class ProtectedBuiltinsDict(dict,metaclass=ResurrectMeta):
738
741
  self.name = name
739
742
  super().__setattr__("protected_names",protected_names)
740
743
  def __setitem__(self, name, value):
741
- if not hasattr(self,"protected_names"):super().__setitem__(name, value)
744
+ if not hasattr(self,"protected_names"):
745
+ super().__setitem__(name, value)
746
+ return
742
747
  try:
743
748
  if name in ["T", "F"]:
744
749
  current_T = self.get("T")
@@ -751,7 +756,9 @@ class ProtectedBuiltinsDict(dict,metaclass=ResurrectMeta):
751
756
  if name in self.protected_names and name not in ["T", "F"]:
752
757
  print(f"警告:禁止修改内置常量 __{self.name}__['{name}']!")
753
758
  raise AttributeError(f"禁止修改内置常量 __{self.name}__['{name}']")
754
- except:pass
759
+ except:
760
+ if sys.implementation.name == 'cpython':
761
+ raise
755
762
  finally:super().__setitem__(name, value)
756
763
  def __delitem__(self, name):
757
764
  if name in self.protected_names:
@@ -188,13 +188,7 @@ class IntHybridArray(BoolHybridArray):
188
188
  if x != f"{value} 不在 IntHybridArray 中":
189
189
  return x
190
190
  raise ValueError(x)
191
- def extend(self, iterable:Iterable) -> None:
192
- if isinstance(iterable, (Iterator, Generator, map)):
193
- iterable,copy = itertools.tee(iterable, 2)
194
- len_ = sum(1 for _ in copy)
195
- else:
196
- len_ = len(iterable)
197
- self.total_bits += len_*self.bit_length
198
- for i,j in zip(range(len_),iterable):
199
- self[-i-1] = j
191
+ def append(self,v):
192
+ self.self.total_bits += self.bit_length
193
+ self[-1] = v
200
194
  __all__ = list(globals())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bool-hybrid-array
3
- Version: 9.11.0
3
+ Version: 9.11.1
4
4
  Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
5
5
  Home-page: https://github.com/BKsell/bool-hybrid-array
6
6
  Author: 蔡靖杰
@@ -17,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Classifier: Programming Language :: Python :: 3.13
19
19
  Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python :: 3 :: Only
20
21
  Classifier: Programming Language :: Python :: Implementation :: CPython
21
22
  Classifier: Programming Language :: Python :: Implementation :: PyPy
22
23
  Classifier: License :: OSI Approved :: MIT License
@@ -26,6 +27,8 @@ Description-Content-Type: text/markdown
26
27
  License-File: LICENSE
27
28
  Requires-Dist: numpy>=1.19.0
28
29
  Provides-Extra: int-array
30
+ Provides-Extra: numba-opt
31
+ Requires-Dist: numba>=0.55.0; extra == "numba-opt"
29
32
  Dynamic: author
30
33
  Dynamic: author-email
31
34
  Dynamic: classifier
@@ -42,10 +45,17 @@ Dynamic: summary
42
45
 
43
46
  # BoolHybridArray:高效的布尔混合数组库
44
47
 
48
+ <!-- 月下载量(核心推荐)+ 周下载量 + 总下载量 -->
49
+ [![月下载量](https://static.pepy.tech/badge/bool-hybrid-array/month)](https://pepy.tech/project/bool-hybrid-array)
50
+ [![周下载量](https://static.pepy.tech/badge/bool-hybrid-array/week)](https://pepy.tech/project/bool-hybrid-array)
51
+ [![总下载量](https://static.pepy.tech/badge/bool-hybrid-array)](https://pepy.tech/project/bool-hybrid-array)
52
+
45
53
  一个专为布尔值优化的数组类,能够根据数据特征自动在密集存储和稀疏存储模式间切换,兼顾性能和内存效率。
46
54
 
47
55
  ## ***注:大版本号更新并非不兼容更新,而是重大更新***
48
56
 
57
+ 注:当API完全稳定时就会发布版本规则较严谨的new-1.0.0版本,预期为10.x版本结束后
58
+
49
59
  ***注意:目前社区中若存在名称类似(如包含 “bool-hybrid-array”+ 后缀、boolean\_array、validate.io-boolean-array)的库,均与本项目(bool-hybrid-array)无关联,本项目的所有功能设计、代码实现均为独立开发;***
50
60
  ***其他平台里的类似名库绝不是我的库***
51
61
 
@@ -143,7 +153,7 @@ big_arr = BoolHybridArr([i % 100 == 0 for i in range(10000)])
143
153
 
144
154
  # 查看存储模式(此时应为稀疏模式)
145
155
 
146
- print(repr(big_arr)) # 输出: BoolHybridArray(split_index=100,size=10000,is_sparse=True,small_len=100,large_len=)不好意思large_len我不知道
156
+ print(repr(big_arr)) # 输出: BoolHybridArray(split_index=100, size=10000, is_sparse=True, small_len=101, large_len=98)
147
157
 
148
158
  # 自动优化存储
149
159
 
@@ -574,7 +584,8 @@ except OverflowError as e:
574
584
  * **9.10.20**:优化性能,增加BHA_jit_log日志
575
585
  * **9.10.21**:优化Ask_BHA,移除BHA_jit_log日志
576
586
  * **9.10.22**:进一步优化Ask_BHA的性能
577
- * **9.11.0**:新增对7.3.10以上的版本的PyPy解释器的支持
587
+ * **9.11.0**:新增对7.3.10以上版本的PyPy解释器的支持
588
+ * **9.11.1**:修复PyPy解释器下的保护机制过度保护bug
578
589
 
579
590
 
580
591
 
@@ -1,3 +1,6 @@
1
1
  numpy>=1.19.0
2
2
 
3
3
  [int_array]
4
+
5
+ [numba_opt]
6
+ numba>=0.55.0
@@ -1,16 +1,20 @@
1
1
  from setuptools import setup, find_packages
2
- import os
2
+ import os,sys
3
3
  def get_long_description():
4
4
  readme_path = os.path.join(os.path.dirname(__file__), 'README.md')
5
5
  if os.path.exists(readme_path):
6
6
  with open(readme_path, encoding='utf-8') as f:
7
7
  return f.read()
8
8
  return "一个高效的布尔数组(密集+稀疏混合存储,节省内存)"
9
+ if sys.implementation.name == "pypy":
10
+ if not hasattr(sys, "pypy_version_info") or sys.pypy_version_info[:3] < (7, 3, 10):
11
+ pypy_ver = ".".join(map(str, sys.pypy_version_info)) if hasattr(sys, "pypy_version_info") else "未知"
12
+ sys.exit(f"❌ 错误:bool-hybrid-array 要求 PyPy≥7.3.10,当前版本 {pypy_ver}")
9
13
  setup(
10
14
  name="bool-hybrid-array",
11
- version="9.11.0",
15
+ version="9.11.1",
12
16
  author="蔡靖杰",
13
- extras_require={"int_array":[]},
17
+ extras_require={"int_array":[],"numba_opt": ["numba>=0.55.0"],},
14
18
  author_email="1289270215@qq.com",
15
19
  description="一个高效的布尔数组(密集+稀疏混合存储,节省内存)",
16
20
  long_description=get_long_description(),
@@ -27,6 +31,7 @@ setup(
27
31
  'Programming Language :: Python :: 3.12',
28
32
  'Programming Language :: Python :: 3.13',
29
33
  'Programming Language :: Python :: 3.14',
34
+ "Programming Language :: Python :: 3 :: Only",
30
35
  'Programming Language :: Python :: Implementation :: CPython',
31
36
  'Programming Language :: Python :: Implementation :: PyPy',
32
37
  "License :: OSI Approved :: MIT License",