bitarray 3.9.1__tar.gz → 3.10.0__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.
Files changed (24) hide show
  1. {bitarray-3.9.1 → bitarray-3.10.0}/PKG-INFO +43 -13
  2. {bitarray-3.9.1 → bitarray-3.10.0}/README.rst +42 -12
  3. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray/__init__.pyi +1 -2
  4. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray/_bitarray.c +1072 -652
  5. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray/_util.c +309 -210
  6. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray/bitarray.h +23 -13
  7. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray/test_bitarray.py +361 -142
  8. bitarray-3.10.0/bitarray/test_free_threading.py +837 -0
  9. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray/test_util.py +166 -208
  10. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray/util.py +16 -12
  11. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray/util.pyi +3 -4
  12. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray.egg-info/PKG-INFO +43 -13
  13. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray.egg-info/SOURCES.txt +1 -0
  14. {bitarray-3.9.1 → bitarray-3.10.0}/LICENSE +0 -0
  15. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray/__init__.py +0 -0
  16. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray/py.typed +0 -0
  17. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray/pythoncapi_compat.h +0 -0
  18. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray/test_281.pickle +0 -0
  19. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray.egg-info/dependency_links.txt +0 -0
  20. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray.egg-info/not-zip-safe +0 -0
  21. {bitarray-3.9.1 → bitarray-3.10.0}/bitarray.egg-info/top_level.txt +0 -0
  22. {bitarray-3.9.1 → bitarray-3.10.0}/pyproject.toml +0 -0
  23. {bitarray-3.9.1 → bitarray-3.10.0}/setup.cfg +0 -0
  24. {bitarray-3.9.1 → bitarray-3.10.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitarray
3
- Version: 3.9.1
3
+ Version: 3.10.0
4
4
  Summary: efficient arrays of booleans -- C extension
5
5
  Home-page: https://github.com/ilanschnell/bitarray
6
6
  Author: Ilan Schnell
@@ -54,6 +54,7 @@ Key features
54
54
  operations ``+``, ``*``, ``+=``, ``*=``, the ``in`` operator, ``len()``
55
55
  * Bitwise operations: ``~``, ``&``, ``|``, ``^``, ``<<``, ``>>`` (as well as
56
56
  their in-place versions ``&=``, ``|=``, ``^=``, ``<<=``, ``>>=``).
57
+ * Free-threading support (for GIL disabled CPython 3.14 and later)
57
58
  * Fast methods for encoding and decoding variable bit length prefix codes.
58
59
  * Bitarray objects support the buffer protocol (both importing and
59
60
  exporting buffers).
@@ -92,9 +93,9 @@ Once you have installed the package, you may want to test it:
92
93
 
93
94
  $ python -c 'import bitarray; bitarray.test()'
94
95
  bitarray is installed in: /Users/ilan/bitarray/bitarray
95
- bitarray version: 3.9.1
96
- sys.version: 3.14.5 (main, May 20 2026) [Clang 20.1.8]
97
96
  sys.prefix: /Users/ilan/miniforge
97
+ bitarray version: 3.10.0
98
+ sys.version: 3.14.5 (main, May 20 2026) [Clang 20.1.8]
98
99
  sys.abiflags: ''
99
100
  sys._is_gil_enabled(): True
100
101
  pointer size: 64 bit
@@ -106,13 +107,13 @@ Once you have installed the package, you may want to test it:
106
107
  Py_GIL_DISABLED: 0
107
108
  Py_DEBUG: 0
108
109
  DEBUG: 0
109
- .........................................................................
110
- ................................................s........................
110
+ .....................................s...................................
111
+ ..........s.....................................s........................
111
112
  ......s.........................................................
112
113
  ----------------------------------------------------------------------
113
- Ran 632 tests in 0.191s
114
+ Ran 641 tests in 0.196s
114
115
 
115
- OK (skipped=2)
116
+ OK (skipped=4)
116
117
 
117
118
  The ``test()`` function is part of the API. It will return
118
119
  a ``unittest.runner.TextTestResult`` object, such that one can verify that
@@ -357,7 +358,7 @@ and can therefore be used as a dictionary key:
357
358
  Reference
358
359
  =========
359
360
 
360
- bitarray version: 3.9.1 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
361
+ bitarray version: 3.10.0 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
361
362
 
362
363
  In the following, ``item`` and ``value`` are usually a single bit -
363
364
  an integer 0 or 1.
@@ -466,6 +467,7 @@ bitarray methods:
466
467
  Given a prefix code (a dict mapping symbols to bitarrays, or ``decodetree``
467
468
  object), decode content of bitarray and return an iterator over
468
469
  corresponding symbols.
470
+ The prefix code length cannot exceed 256 bits.
469
471
 
470
472
  See also: `Bitarray 3 transition <https://github.com/ilanschnell/bitarray/blob/master/doc/bitarray3.rst>`__
471
473
 
@@ -585,6 +587,9 @@ bitarray methods:
585
587
  unless ``right=True``, which will iterate in descending order (starting with
586
588
  rightmost match).
587
589
 
590
+ For example, ``a.search(1)`` is the easiest (and most efficient) way
591
+ to create an iterator over all active indices in ``a``.
592
+
588
593
  See also: `Bitarray 3 transition <https://github.com/ilanschnell/bitarray/blob/master/doc/bitarray3.rst>`__
589
594
 
590
595
  New in version 2.9: optional start and stop arguments - add optional keyword argument ``right``
@@ -675,6 +680,26 @@ decodeiterator data descriptors:
675
680
  New in version 3.9
676
681
 
677
682
 
683
+ decodetree methods:
684
+ -------------------
685
+
686
+ ``nodes()`` -> tuple
687
+ Return tuple with number of:
688
+
689
+ 0. incomplete nodes (pointing to a single child node)
690
+ 1. complete nodes (pointing to two child nodes)
691
+ 2. leaf nodes (pointing to a symbol)
692
+
693
+ New in version 3.10
694
+
695
+
696
+ ``todict()`` -> dict
697
+ Return a dict mapping the symbols to frozenbitarrays. This dict is a
698
+ reconstruction of the code dict which the object was created with.
699
+
700
+ New in version 3.10
701
+
702
+
678
703
  Other objects:
679
704
  --------------
680
705
 
@@ -689,6 +714,7 @@ Other objects:
689
714
  ``decodetree(code, /)`` -> decodetree
690
715
  Given a prefix code (a dict mapping symbols to bitarrays),
691
716
  create a binary tree object to be passed to ``.decode()``.
717
+ The prefix code length cannot exceed 256 bits.
692
718
 
693
719
  New in version 1.6
694
720
 
@@ -768,8 +794,8 @@ This sub-module was added in version 1.2.
768
794
 
769
795
  ``byteswap(a, n=<buffer size>, /)``
770
796
  Reverse every ``n`` consecutive bytes of ``a`` in-place.
771
- By default, all bytes are reversed. Note that ``n`` is not limited to 2, 4
772
- or 8, but can be any positive integer.
797
+ By default, all bytes are reversed. Note that ``n`` is **not** limited
798
+ to 2, 4 or 8, but can be any positive integer.
773
799
  Also, ``a`` may be any object that exposes a writable buffer.
774
800
  Nothing about this function is specific to bitarray objects.
775
801
 
@@ -795,7 +821,7 @@ This sub-module was added in version 1.2.
795
821
  Given a frequency map, a dictionary mapping symbols to their frequency,
796
822
  calculate the canonical Huffman code. Returns a tuple containing:
797
823
 
798
- 0. the canonical Huffman code as a dict mapping symbols to bitarrays
824
+ 0. the canonical Huffman code as a dict mapping symbols to frozenbitarrays
799
825
  1. a list containing the number of symbols of each code length
800
826
  2. a list of symbols in canonical order
801
827
 
@@ -805,6 +831,8 @@ This sub-module was added in version 1.2.
805
831
 
806
832
  New in version 2.5
807
833
 
834
+ New in version 3.10: return a codedict mapping to frozenbitarrays
835
+
808
836
 
809
837
  ``correspond_all(a, b, /)`` -> tuple
810
838
  Return tuple with counts of: ~a & ~b, ~a & b, a & ~b, a & b
@@ -871,8 +899,10 @@ This sub-module was added in version 1.2.
871
899
  ``huffman_code(dict, /, endian=None)`` -> dict
872
900
  Given a frequency map, a dictionary mapping symbols to their frequency,
873
901
  calculate the Huffman code, i.e. a dict mapping those symbols to
874
- bitarrays (with given bit-endianness). Note that the symbols are not limited
875
- to being strings. Symbols may be any hashable object.
902
+ frozenbitarrays (with given bit-endianness). Note that the symbols are not
903
+ limited to being strings. Symbols may be any hashable object.
904
+
905
+ New in version 3.10: return a codedict mapping to frozenbitarrays
876
906
 
877
907
 
878
908
  ``int2ba(int, /, length=None, endian=None, signed=False)`` -> bitarray
@@ -19,6 +19,7 @@ Key features
19
19
  operations ``+``, ``*``, ``+=``, ``*=``, the ``in`` operator, ``len()``
20
20
  * Bitwise operations: ``~``, ``&``, ``|``, ``^``, ``<<``, ``>>`` (as well as
21
21
  their in-place versions ``&=``, ``|=``, ``^=``, ``<<=``, ``>>=``).
22
+ * Free-threading support (for GIL disabled CPython 3.14 and later)
22
23
  * Fast methods for encoding and decoding variable bit length prefix codes.
23
24
  * Bitarray objects support the buffer protocol (both importing and
24
25
  exporting buffers).
@@ -57,9 +58,9 @@ Once you have installed the package, you may want to test it:
57
58
 
58
59
  $ python -c 'import bitarray; bitarray.test()'
59
60
  bitarray is installed in: /Users/ilan/bitarray/bitarray
60
- bitarray version: 3.9.1
61
- sys.version: 3.14.5 (main, May 20 2026) [Clang 20.1.8]
62
61
  sys.prefix: /Users/ilan/miniforge
62
+ bitarray version: 3.10.0
63
+ sys.version: 3.14.5 (main, May 20 2026) [Clang 20.1.8]
63
64
  sys.abiflags: ''
64
65
  sys._is_gil_enabled(): True
65
66
  pointer size: 64 bit
@@ -71,13 +72,13 @@ Once you have installed the package, you may want to test it:
71
72
  Py_GIL_DISABLED: 0
72
73
  Py_DEBUG: 0
73
74
  DEBUG: 0
74
- .........................................................................
75
- ................................................s........................
75
+ .....................................s...................................
76
+ ..........s.....................................s........................
76
77
  ......s.........................................................
77
78
  ----------------------------------------------------------------------
78
- Ran 632 tests in 0.191s
79
+ Ran 641 tests in 0.196s
79
80
 
80
- OK (skipped=2)
81
+ OK (skipped=4)
81
82
 
82
83
  The ``test()`` function is part of the API. It will return
83
84
  a ``unittest.runner.TextTestResult`` object, such that one can verify that
@@ -322,7 +323,7 @@ and can therefore be used as a dictionary key:
322
323
  Reference
323
324
  =========
324
325
 
325
- bitarray version: 3.9.1 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
326
+ bitarray version: 3.10.0 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
326
327
 
327
328
  In the following, ``item`` and ``value`` are usually a single bit -
328
329
  an integer 0 or 1.
@@ -431,6 +432,7 @@ bitarray methods:
431
432
  Given a prefix code (a dict mapping symbols to bitarrays, or ``decodetree``
432
433
  object), decode content of bitarray and return an iterator over
433
434
  corresponding symbols.
435
+ The prefix code length cannot exceed 256 bits.
434
436
 
435
437
  See also: `Bitarray 3 transition <https://github.com/ilanschnell/bitarray/blob/master/doc/bitarray3.rst>`__
436
438
 
@@ -550,6 +552,9 @@ bitarray methods:
550
552
  unless ``right=True``, which will iterate in descending order (starting with
551
553
  rightmost match).
552
554
 
555
+ For example, ``a.search(1)`` is the easiest (and most efficient) way
556
+ to create an iterator over all active indices in ``a``.
557
+
553
558
  See also: `Bitarray 3 transition <https://github.com/ilanschnell/bitarray/blob/master/doc/bitarray3.rst>`__
554
559
 
555
560
  New in version 2.9: optional start and stop arguments - add optional keyword argument ``right``
@@ -640,6 +645,26 @@ decodeiterator data descriptors:
640
645
  New in version 3.9
641
646
 
642
647
 
648
+ decodetree methods:
649
+ -------------------
650
+
651
+ ``nodes()`` -> tuple
652
+ Return tuple with number of:
653
+
654
+ 0. incomplete nodes (pointing to a single child node)
655
+ 1. complete nodes (pointing to two child nodes)
656
+ 2. leaf nodes (pointing to a symbol)
657
+
658
+ New in version 3.10
659
+
660
+
661
+ ``todict()`` -> dict
662
+ Return a dict mapping the symbols to frozenbitarrays. This dict is a
663
+ reconstruction of the code dict which the object was created with.
664
+
665
+ New in version 3.10
666
+
667
+
643
668
  Other objects:
644
669
  --------------
645
670
 
@@ -654,6 +679,7 @@ Other objects:
654
679
  ``decodetree(code, /)`` -> decodetree
655
680
  Given a prefix code (a dict mapping symbols to bitarrays),
656
681
  create a binary tree object to be passed to ``.decode()``.
682
+ The prefix code length cannot exceed 256 bits.
657
683
 
658
684
  New in version 1.6
659
685
 
@@ -733,8 +759,8 @@ This sub-module was added in version 1.2.
733
759
 
734
760
  ``byteswap(a, n=<buffer size>, /)``
735
761
  Reverse every ``n`` consecutive bytes of ``a`` in-place.
736
- By default, all bytes are reversed. Note that ``n`` is not limited to 2, 4
737
- or 8, but can be any positive integer.
762
+ By default, all bytes are reversed. Note that ``n`` is **not** limited
763
+ to 2, 4 or 8, but can be any positive integer.
738
764
  Also, ``a`` may be any object that exposes a writable buffer.
739
765
  Nothing about this function is specific to bitarray objects.
740
766
 
@@ -760,7 +786,7 @@ This sub-module was added in version 1.2.
760
786
  Given a frequency map, a dictionary mapping symbols to their frequency,
761
787
  calculate the canonical Huffman code. Returns a tuple containing:
762
788
 
763
- 0. the canonical Huffman code as a dict mapping symbols to bitarrays
789
+ 0. the canonical Huffman code as a dict mapping symbols to frozenbitarrays
764
790
  1. a list containing the number of symbols of each code length
765
791
  2. a list of symbols in canonical order
766
792
 
@@ -770,6 +796,8 @@ This sub-module was added in version 1.2.
770
796
 
771
797
  New in version 2.5
772
798
 
799
+ New in version 3.10: return a codedict mapping to frozenbitarrays
800
+
773
801
 
774
802
  ``correspond_all(a, b, /)`` -> tuple
775
803
  Return tuple with counts of: ~a & ~b, ~a & b, a & ~b, a & b
@@ -836,8 +864,10 @@ This sub-module was added in version 1.2.
836
864
  ``huffman_code(dict, /, endian=None)`` -> dict
837
865
  Given a frequency map, a dictionary mapping symbols to their frequency,
838
866
  calculate the Huffman code, i.e. a dict mapping those symbols to
839
- bitarrays (with given bit-endianness). Note that the symbols are not limited
840
- to being strings. Symbols may be any hashable object.
867
+ frozenbitarrays (with given bit-endianness). Note that the symbols are not
868
+ limited to being strings. Symbols may be any hashable object.
869
+
870
+ New in version 3.10: return a codedict mapping to frozenbitarrays
841
871
 
842
872
 
843
873
  ``int2ba(int, /, length=None, endian=None, signed=False)`` -> bitarray
@@ -27,8 +27,7 @@ class BufferInfo(NamedTuple):
27
27
 
28
28
  class decodetree:
29
29
  def __init__(self, code: CodeDict) -> None: ...
30
- def complete(self) -> bool: ...
31
- def nodes(self) -> int: ...
30
+ def nodes(self) -> tuple[int, int, int]: ...
32
31
  def todict(self) -> CodeDict: ...
33
32
 
34
33