bool-hybrid-array 9.11.12__py3-none-any.whl → 9.11.14__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.
bool_hybrid_array/core.py CHANGED
@@ -15,6 +15,7 @@ from functools import lru_cache
15
15
  from typing import _GenericAlias
16
16
  from typing import Callable, Union, Sequence, MutableSequence, Any, overload, Sized
17
17
  hybrid_array_cache:list[tuple[Any]] = []
18
+ index_range=lambda BHA:(BHA[i] for i in itertools.count(0) if i < BHA.size)
18
19
  try:
19
20
  msvcrt = ctypes.CDLL('msvcrt.dll')
20
21
  memcpy = msvcrt.memcpy
@@ -277,12 +278,16 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):# type:
277
278
  value_list = list(value)
278
279
  new_len = len(value_list)
279
280
  if step != 1:
280
- slice_indices = list(range(start, stop, step))
281
+ slice_indices = range(start, stop, step)
281
282
  if new_len != len(slice_indices):
282
283
  raise ValueError(f"值长度与切片长度不匹配:{new_len} vs {len(slice_indices)}")
283
284
  for i, val in zip(slice_indices, value_list):
284
285
  self[i] = val
285
286
  return
287
+ if new_len == max(0, stop - start):
288
+ for v,i in zip(value_list,range(start,stop)):
289
+ self[i] = v
290
+ return
286
291
  for i in range(stop - 1, start - 1, -1):
287
292
  if i <= self.split_index:
288
293
  if i >= len(self.small):
@@ -354,7 +359,7 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):# type:
354
359
  return int(self.size)
355
360
  def __iter__(self):
356
361
  if not self:return BHA_Iterator([])
357
- return BHA_Iterator(map(self.__getitem__,range(self.size)))
362
+ return BHA_Iterator(map(self.__getitem__,index_range(size)))
358
363
  def __next__(self):
359
364
  return next(self.generator)
360
365
  def __contains__(self, value:Any) -> bool:
@@ -423,7 +428,6 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):# type:
423
428
  return self
424
429
  if not self.is_sparse:
425
430
  self += FalsesArray(int(other))
426
- self.optimize()
427
431
  else:
428
432
  self.size += int(other)
429
433
  return self
@@ -444,6 +448,14 @@ class BoolHybridArray(MutableSequence,Exception,metaclass=ResurrectMeta):# type:
444
448
  if len(self) != len(other):
445
449
  raise ValueError(f"异或运算要求数组长度相同({len(self)} vs {len(other)})")
446
450
  return BoolHybridArr(map(operator.xor, self, other),hash_ = self.hash_)
451
+ def __gt__(self,other):
452
+ if self.size!=len(other)
453
+ return self.size>len(other)
454
+ return any(map(operator.gt,self,other)
455
+ def __lt__(self,other):
456
+ if self.size!=len(other)
457
+ return self.size<len(other)
458
+ return any(map(operator.lt,self,other)
447
459
  def __rxor__(self, other) -> BoolHybridArray:
448
460
  return self^other
449
461
  def __invert__(self) -> BoolHybridArray:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bool-hybrid-array
3
- Version: 9.11.12
3
+ Version: 9.11.14
4
4
  Summary: 一个高效的布尔数组(密集+稀疏混合存储,节省内存)
5
5
  Home-page: https://github.com/BKsell/bool-hybrid-array
6
6
  Author: 蔡靖杰
@@ -33,6 +33,8 @@ Provides-Extra: numba-opt
33
33
  Requires-Dist: numba>=0.55.0; extra == "numba-opt"
34
34
  Provides-Extra: cython-opt
35
35
  Requires-Dist: cython>=3.2.4; extra == "cython-opt"
36
+ Provides-Extra: cycy-opt
37
+ Requires-Dist: cycy-runtime>=0.2.4; extra == "cycy-opt"
36
38
  Dynamic: author
37
39
  Dynamic: author-email
38
40
  Dynamic: classifier
@@ -622,6 +624,9 @@ print(f"出队2个元素后: {q}") # 输出:BHA_Queue([T,T,F,T,F])
622
624
  * **9.11.10**:修复cin的AttributeError的错误
623
625
  * **9.11.11**:新增cin对EOF的处理
624
626
  * **9.11.12**:优化了IntHybridArray的__setitem__,新增了IntHybridArray的sort
627
+ * **9.11.13**:修复IndexError的错误
628
+ * **9.11.14**:新增BoolHybridArray数组的大小比较
629
+
625
630
 
626
631
 
627
632
 
@@ -0,0 +1,14 @@
1
+ bool_hybrid_array/__init__.py,sha256=UYkGgU0Ux77DN1qfEW37ba2mjDAhqCIrqCgxGpY3h_g,1086
2
+ bool_hybrid_array/__main__.py,sha256=uFyebfsZl1tW54AVcc6IDhk36BglTGb_Vw3Djx8pq00,8987
3
+ bool_hybrid_array/_cppiostream.py,sha256=1i973ag_8XgivQkeIbqzHivflcQkVFtX77R_UwChSAg,9205
4
+ bool_hybrid_array/compile_core.cp314-win_amd64.pyd,sha256=3vFAZ6vSMqoP_fWRkXd_KVPVUw4oo2Nv7xi0sBQu2fQ,516096
5
+ bool_hybrid_array/core.c,sha256=iG3px_6ZJzYhlSnZUpZxJP4CRYfMGk39dlQveU26ZFc,79
6
+ bool_hybrid_array/core.py,sha256=6BLUmXX-5fBnjamspmfaZAuVetBvDH-eAn6_F5QPaxM,42607
7
+ bool_hybrid_array/秘密.md,sha256=Ii2NvXmv-Ktu04zJsGLcQZvlzT4gOatByE4B2wTK1Ks,48
8
+ bool_hybrid_array/int_array/__init__.py,sha256=CCKDUL5GBAXOprc9FhtLNL_rP4IDhvGVWJ-Dporp6YI,112
9
+ bool_hybrid_array/int_array/core.py,sha256=DZ6mC-qLQahV25b_1RHGPK959XYtILYP_Pbwwg7nFLA,7936
10
+ bool_hybrid_array-9.11.14.dist-info/licenses/LICENSE,sha256=Sg4rnGXkBDYkwJCWyxdWp5H60rhVAxpNvFh_l3JWZdY,1070
11
+ bool_hybrid_array-9.11.14.dist-info/METADATA,sha256=mZs2z7RnExO3ywqfEdGXdfb1SRgWXsOx3oTewbn_moI,26618
12
+ bool_hybrid_array-9.11.14.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
13
+ bool_hybrid_array-9.11.14.dist-info/top_level.txt,sha256=vk-TD77wuVQsN1rJ6uVWZX4sC_wya_WplRDwQKJoBZM,18
14
+ bool_hybrid_array-9.11.14.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- bool_hybrid_array/__init__.py,sha256=zX4t08F5NAIBY9x5I_wFKVem2sCzB90o1c4Nogz4IzY,1086
2
- bool_hybrid_array/__main__.py,sha256=uFyebfsZl1tW54AVcc6IDhk36BglTGb_Vw3Djx8pq00,8987
3
- bool_hybrid_array/_cppiostream.py,sha256=1i973ag_8XgivQkeIbqzHivflcQkVFtX77R_UwChSAg,9205
4
- bool_hybrid_array/compile_core.cp314-win_amd64.pyd,sha256=3DhgWD3Zrprov7irFmUEmCoe9WndQMt8NVwGncnxcCQ,514560
5
- bool_hybrid_array/core.c,sha256=om2tuMhsXPLtmFAcJpY-VnZcwVJ2sZrYEPWPsdtEs4M,3230975
6
- bool_hybrid_array/core.py,sha256=nrmu8djPZS3Y70wRa_QkeM-5v-LGLUkuSZiw__OFU-M,42091
7
- bool_hybrid_array/秘密.md,sha256=Ii2NvXmv-Ktu04zJsGLcQZvlzT4gOatByE4B2wTK1Ks,48
8
- bool_hybrid_array/int_array/__init__.py,sha256=CCKDUL5GBAXOprc9FhtLNL_rP4IDhvGVWJ-Dporp6YI,112
9
- bool_hybrid_array/int_array/core.py,sha256=DZ6mC-qLQahV25b_1RHGPK959XYtILYP_Pbwwg7nFLA,7936
10
- bool_hybrid_array-9.11.12.dist-info/licenses/LICENSE,sha256=Sg4rnGXkBDYkwJCWyxdWp5H60rhVAxpNvFh_l3JWZdY,1070
11
- bool_hybrid_array-9.11.12.dist-info/METADATA,sha256=4Nxj1A_jkOzHDUa2htNIUT6b8lbk2mZOwOFgZZl3nv8,26430
12
- bool_hybrid_array-9.11.12.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
13
- bool_hybrid_array-9.11.12.dist-info/top_level.txt,sha256=vk-TD77wuVQsN1rJ6uVWZX4sC_wya_WplRDwQKJoBZM,18
14
- bool_hybrid_array-9.11.12.dist-info/RECORD,,