bool-hybrid-array 9.10.10__py3-none-any.whl → 9.11.1__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.
@@ -1,23 +1,28 @@
1
+ # -*- coding: utf-8 -*-
1
2
  import sys
2
- from types import ModuleType
3
+ from types import ModuleType,FunctionType
3
4
  from . import core
4
5
  from .core import __builtins__,builtins
5
- __version__ = "9.10.10"
6
+ try:from . import int_array
7
+ except:pass
8
+ __version__ = "9.11.1"
6
9
  public_objects = []
7
10
  for name in dir(core):
8
11
  if not name.startswith("_"):
9
12
  obj = getattr(core, name)
10
13
  if isinstance(obj, (type, ModuleType)) or callable(obj):
11
14
  public_objects.append(name)
12
- __all__ = public_objects + ["__version__","__builtins__","core","builtins","__dict__"]
15
+ __all__ = public_objects + ["__version__","__builtins__","core","builtins","__dict__","int_array"]
13
16
  globals().update({
14
17
  name: getattr(core, name)
15
18
  for name in public_objects
16
19
  })
17
20
  try:
21
+ sys.modules[__name__] = ProtectedBuiltinsDict(globals())
22
+ sys.modules[__name__].name = __name__
23
+ sys.modules[__name__+'.core'] = ProtectedBuiltinsDict(core.__dict__,name = f'{__name__}.core')
18
24
  __dict__ = ProtectedBuiltinsDict(globals())
19
- sys.modules[__name__] = ProtectedBuiltinsDict(globals().copy())
20
- sys.modules[__name__].name = 'bool_hybrid_array'
25
+ sys.modules[__name__+'.int_array'] = ProtectedBuiltinsDict(int_array.__dict__,name = __name__+'.int_array')
21
26
  core.__dict__ = ProtectedBuiltinsDict(core.__dict__)
22
27
  except:
23
28
  pass
@@ -1,4 +1,8 @@
1
+ # -*- coding: utf-8 -*-
1
2
  from .__init__ import *
3
+ import io
4
+
5
+ sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='ignore')
2
6
 
3
7
  # 创建实例
4
8
 
@@ -264,4 +268,21 @@ try:numba_opt()
264
268
  except:print("请先安装numba库!!!")
265
269
 
266
270
 
271
+ #int_array模块(9.10.10新增):
272
+
273
+ max_num = (1 << 256) - 1
274
+ min_num = -max_num
275
+
276
+ # 1. IntHybridArray:257位完美存储
277
+ arr_hybrid = int_array.IntHybridArray([max_num, min_num, 123456], bit_length=257)
278
+ print("✅ IntHybridArray存储结果:")
279
+ print(f"最大值:{arr_hybrid[0]}")
280
+ print(f"最小值:{arr_hybrid[1]}")
281
+
282
+ # 2. NumPy:用最大的int64尝试存储(必然失败)
283
+ try:
284
+ arr_np = np.array([max_num, min_num, 123456], dtype=np.int64)
285
+ print("\n❌ NumPy存储结果:", arr_np)
286
+ except OverflowError as e:
287
+ print(f"\n❌ NumPy存储失败:{e}")
267
288