bool-hybrid-array 9.10.15__tar.gz → 9.10.18__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.15
3
+ Version: 9.10.18
4
4
  Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
5
5
  Home-page: https://github.com/BKsell/bool-hybrid-array
6
6
  Author: 蔡靖杰
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
19
20
  Classifier: License :: OSI Approved :: MIT License
20
21
  Classifier: Operating System :: OS Independent
21
22
  Requires-Python: >=3.8
@@ -560,7 +561,9 @@ except OverflowError as e:
560
561
  * **9.10.13**:给IntHybridArray新增多种列表操作
561
562
  * **9.10.14**:修复IntHybridArray中因单个 0 导致所有数字位长被压缩到 1的问题
562
563
  * **9.10.15**:修复IntHybridArray变成布尔数组的错误
563
-
564
+ * **9.10.16**:新增Python 3.14时的jit优化加速
565
+ * **9.10.17**:给保护字典添加__import__方法,支持from导入
566
+ * **9.10.18**:新增BoolHybridArray的序列化和反序列化支持
564
567
 
565
568
 
566
569
 
@@ -521,7 +521,9 @@ except OverflowError as e:
521
521
  * **9.10.13**:给IntHybridArray新增多种列表操作
522
522
  * **9.10.14**:修复IntHybridArray中因单个 0 导致所有数字位长被压缩到 1的问题
523
523
  * **9.10.15**:修复IntHybridArray变成布尔数组的错误
524
-
524
+ * **9.10.16**:新增Python 3.14时的jit优化加速
525
+ * **9.10.17**:给保护字典添加__import__方法,支持from导入
526
+ * **9.10.18**:新增BoolHybridArray的序列化和反序列化支持
525
527
 
526
528
 
527
529
 
@@ -0,0 +1,47 @@
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.18"
7
+ public_objects = []
8
+ def jit_class_methods(cls):
9
+ for attr_name in dir(cls):
10
+ if not attr_name.startswith("_"):
11
+ attr = getattr(cls, attr_name)
12
+ if isinstance(attr, FunctionType):
13
+ try:
14
+ setattr(cls, attr_name, jit(attr))
15
+ except:
16
+ pass
17
+ elif isinstance(attr, classmethod):
18
+ original_func = attr.__func__
19
+ try:
20
+ setattr(cls, attr_name, classmethod(jit(original_func)))
21
+ except:
22
+ pass
23
+ return cls
24
+ for name in dir(core):
25
+ if not name.startswith("_"):
26
+ obj = getattr(core, name)
27
+ if isinstance(obj, (type, ModuleType)) or callable(obj):
28
+ public_objects.append(name)
29
+ if isinstance(obj,FunctionType):
30
+ try:setattr(core,name,jit(obj))
31
+ except:pass
32
+ elif isinstance(obj,type):
33
+ jit_class_methods(obj)
34
+ __all__ = public_objects + ["__version__","__builtins__","core","builtins","__dict__","int_array"]
35
+ globals().update({
36
+ name: getattr(core, name)
37
+ for name in public_objects
38
+ })
39
+ try:
40
+ __dict__ = ProtectedBuiltinsDict(globals())
41
+ sys.modules[__name__+'.int_array'] = ProtectedBuiltinsDict(int_array.__dict__)
42
+ sys.modules[__name__] = ProtectedBuiltinsDict(globals().copy())
43
+ sys.modules[__name__].name = 'bool_hybrid_array'
44
+ core.__dict__ = ProtectedBuiltinsDict(core.__dict__)
45
+ except:
46
+ pass
47
+
@@ -501,6 +501,8 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):
501
501
  arr = TruesArray(0)
502
502
  arr.__dict__ = self.__dict__
503
503
  return arr
504
+ def __reduce__(self):
505
+ return BoolHybridArr,(map(operator.itemgetter(0), self),self.is_sparse,self.Type,self.hash_,),
504
506
  class BoolHybridArr(BoolHybridArray,metaclass=ResurrectMeta):
505
507
  __module__ = 'bool_hybrid_array'
506
508
  def __new__(cls, lst: Iterable, is_sparse=None, Type = None, hash_ = True) -> BoolHybridArray:
@@ -756,6 +758,15 @@ class ProtectedBuiltinsDict(dict,metaclass=ResurrectMeta):
756
758
  raise AttributeError(f'禁止修改内置常量:{self.name}.{name}')
757
759
  else:
758
760
  super().__setattr__(name,value)
761
+ def __import__(self, name, globals=None, locals=None, fromlist=(), level=0):
762
+ if fromlist:
763
+ result = []
764
+ for key in fromlist:
765
+ if key not in self:
766
+ raise AttributeError(f"'ImportableDict' object has no attribute '{key}'")
767
+ result.append(self[key])
768
+ return result[0] if len(result) == 1 else tuple(result)
769
+ return self
759
770
  def Ask_arr(arr):
760
771
  if isinstance(arr,BHA_List):
761
772
  return '\n'.join(map(Ask_arr,arr))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bool-hybrid-array
3
- Version: 9.10.15
3
+ Version: 9.10.18
4
4
  Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
5
5
  Home-page: https://github.com/BKsell/bool-hybrid-array
6
6
  Author: 蔡靖杰
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
19
20
  Classifier: License :: OSI Approved :: MIT License
20
21
  Classifier: Operating System :: OS Independent
21
22
  Requires-Python: >=3.8
@@ -560,7 +561,9 @@ except OverflowError as e:
560
561
  * **9.10.13**:给IntHybridArray新增多种列表操作
561
562
  * **9.10.14**:修复IntHybridArray中因单个 0 导致所有数字位长被压缩到 1的问题
562
563
  * **9.10.15**:修复IntHybridArray变成布尔数组的错误
563
-
564
+ * **9.10.16**:新增Python 3.14时的jit优化加速
565
+ * **9.10.17**:给保护字典添加__import__方法,支持from导入
566
+ * **9.10.18**:新增BoolHybridArray的序列化和反序列化支持
564
567
 
565
568
 
566
569
 
@@ -8,7 +8,7 @@ def get_long_description():
8
8
  return "一个高效的布尔数组(密集+稀疏混合存储,节省内存)"
9
9
  setup(
10
10
  name="bool-hybrid-array",
11
- version="9.10.15",
11
+ version="9.10.18",
12
12
  author="蔡靖杰",
13
13
  extras_require={"int_array":[]},
14
14
  author_email="1289270215@qq.com",
@@ -26,6 +26,7 @@ setup(
26
26
  'Programming Language :: Python :: 3.11',
27
27
  'Programming Language :: Python :: 3.12',
28
28
  'Programming Language :: Python :: 3.13',
29
+ 'Programming Language :: Python :: 3.14',
29
30
  "License :: OSI Approved :: MIT License",
30
31
  "Operating System :: OS Independent",
31
32
  ],
@@ -1,26 +0,0 @@
1
- import sys
2
- from types import ModuleType
3
- from . import core
4
- from .core import __builtins__,builtins
5
- from . import int_array
6
- __version__ = "9.10.15"
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__] = ProtectedBuiltinsDict(globals().copy())
22
- sys.modules[__name__].name = 'bool_hybrid_array'
23
- core.__dict__ = ProtectedBuiltinsDict(core.__dict__)
24
- except:
25
- pass
26
-