bitarray 3.9.2__tar.gz → 3.10.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.
Files changed (24) hide show
  1. {bitarray-3.9.2 → bitarray-3.10.1}/PKG-INFO +42 -15
  2. {bitarray-3.9.2 → bitarray-3.10.1}/README.rst +41 -14
  3. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray/__init__.pyi +1 -2
  4. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray/_bitarray.c +376 -239
  5. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray/_util.c +24 -21
  6. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray/bitarray.h +17 -9
  7. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray/test_bitarray.py +394 -237
  8. bitarray-3.10.1/bitarray/test_free_threading.py +837 -0
  9. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray/test_util.py +189 -211
  10. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray/util.py +69 -78
  11. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray/util.pyi +3 -4
  12. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray.egg-info/PKG-INFO +42 -15
  13. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray.egg-info/SOURCES.txt +1 -0
  14. {bitarray-3.9.2 → bitarray-3.10.1}/LICENSE +0 -0
  15. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray/__init__.py +0 -0
  16. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray/py.typed +0 -0
  17. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray/pythoncapi_compat.h +0 -0
  18. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray/test_281.pickle +0 -0
  19. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray.egg-info/dependency_links.txt +0 -0
  20. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray.egg-info/not-zip-safe +0 -0
  21. {bitarray-3.9.2 → bitarray-3.10.1}/bitarray.egg-info/top_level.txt +0 -0
  22. {bitarray-3.9.2 → bitarray-3.10.1}/pyproject.toml +0 -0
  23. {bitarray-3.9.2 → bitarray-3.10.1}/setup.cfg +0 -0
  24. {bitarray-3.9.2 → bitarray-3.10.1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitarray
3
- Version: 3.9.2
3
+ Version: 3.10.1
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.2
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.1
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 633 tests in 0.191s
114
+ Ran 640 tests in 0.192s
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.2 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
361
+ bitarray version: 3.10.1 -- `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
 
@@ -678,6 +680,26 @@ decodeiterator data descriptors:
678
680
  New in version 3.9
679
681
 
680
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
+
681
703
  Other objects:
682
704
  --------------
683
705
 
@@ -692,6 +714,7 @@ Other objects:
692
714
  ``decodetree(code, /)`` -> decodetree
693
715
  Given a prefix code (a dict mapping symbols to bitarrays),
694
716
  create a binary tree object to be passed to ``.decode()``.
717
+ The prefix code length cannot exceed 256 bits.
695
718
 
696
719
  New in version 1.6
697
720
 
@@ -798,7 +821,7 @@ This sub-module was added in version 1.2.
798
821
  Given a frequency map, a dictionary mapping symbols to their frequency,
799
822
  calculate the canonical Huffman code. Returns a tuple containing:
800
823
 
801
- 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
802
825
  1. a list containing the number of symbols of each code length
803
826
  2. a list of symbols in canonical order
804
827
 
@@ -808,6 +831,8 @@ This sub-module was added in version 1.2.
808
831
 
809
832
  New in version 2.5
810
833
 
834
+ New in version 3.10: return a codedict mapping to frozenbitarrays
835
+
811
836
 
812
837
  ``correspond_all(a, b, /)`` -> tuple
813
838
  Return tuple with counts of: ~a & ~b, ~a & b, a & ~b, a & b
@@ -874,8 +899,10 @@ This sub-module was added in version 1.2.
874
899
  ``huffman_code(dict, /, endian=None)`` -> dict
875
900
  Given a frequency map, a dictionary mapping symbols to their frequency,
876
901
  calculate the Huffman code, i.e. a dict mapping those symbols to
877
- bitarrays (with given bit-endianness). Note that the symbols are not limited
878
- 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
879
906
 
880
907
 
881
908
  ``int2ba(int, /, length=None, endian=None, signed=False)`` -> bitarray
@@ -910,7 +937,7 @@ This sub-module was added in version 1.2.
910
937
 
911
938
 
912
939
  ``pprint(bitarray, /, stream=None, group=8, indent=4, width=80)``
913
- Pretty-print bitarray object to ``stream``, defaults is ``sys.stdout``.
940
+ Pretty-print bitarray object to ``stream``, defaults to ``sys.stdout``.
914
941
  By default, bits are grouped in bytes (8 bits), and 64 bits per line.
915
942
  Non-bitarray objects are printed using ``pprint.pprint()``.
916
943
 
@@ -921,8 +948,8 @@ This sub-module was added in version 1.2.
921
948
  Return (pseudo-) random bitarray of length ``n`` with ``k`` elements
922
949
  set to one. Mathematically equivalent to setting (in a bitarray of
923
950
  length ``n``) all bits at indices ``random.sample(range(n), k)`` to one.
924
- The random bitarrays are reproducible when giving Python's ``random.seed()``
925
- a specific seed value.
951
+ The random bitarrays are reproducible when calling Python's ``random.seed()``
952
+ with a specific seed value.
926
953
 
927
954
  New in version 3.6
928
955
 
@@ -931,7 +958,7 @@ This sub-module was added in version 1.2.
931
958
  Return (pseudo-) random bitarray of length ``n``, where each bit has
932
959
  probability ``p`` of being one (independent of any other bits). Mathematically
933
960
  equivalent to ``bitarray((random() < p for _ in range(n)), endian)``, but much
934
- faster for large ``n``. The random bitarrays are reproducible when giving
961
+ faster for large ``n``. The random bitarrays are reproducible when calling
935
962
  Python's ``random.seed()`` with a specific seed value.
936
963
 
937
964
  This function requires Python 3.12 or higher, as it depends on the standard
@@ -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.2
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.1
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 633 tests in 0.191s
79
+ Ran 640 tests in 0.192s
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.2 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
326
+ bitarray version: 3.10.1 -- `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
 
@@ -643,6 +645,26 @@ decodeiterator data descriptors:
643
645
  New in version 3.9
644
646
 
645
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
+
646
668
  Other objects:
647
669
  --------------
648
670
 
@@ -657,6 +679,7 @@ Other objects:
657
679
  ``decodetree(code, /)`` -> decodetree
658
680
  Given a prefix code (a dict mapping symbols to bitarrays),
659
681
  create a binary tree object to be passed to ``.decode()``.
682
+ The prefix code length cannot exceed 256 bits.
660
683
 
661
684
  New in version 1.6
662
685
 
@@ -763,7 +786,7 @@ This sub-module was added in version 1.2.
763
786
  Given a frequency map, a dictionary mapping symbols to their frequency,
764
787
  calculate the canonical Huffman code. Returns a tuple containing:
765
788
 
766
- 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
767
790
  1. a list containing the number of symbols of each code length
768
791
  2. a list of symbols in canonical order
769
792
 
@@ -773,6 +796,8 @@ This sub-module was added in version 1.2.
773
796
 
774
797
  New in version 2.5
775
798
 
799
+ New in version 3.10: return a codedict mapping to frozenbitarrays
800
+
776
801
 
777
802
  ``correspond_all(a, b, /)`` -> tuple
778
803
  Return tuple with counts of: ~a & ~b, ~a & b, a & ~b, a & b
@@ -839,8 +864,10 @@ This sub-module was added in version 1.2.
839
864
  ``huffman_code(dict, /, endian=None)`` -> dict
840
865
  Given a frequency map, a dictionary mapping symbols to their frequency,
841
866
  calculate the Huffman code, i.e. a dict mapping those symbols to
842
- bitarrays (with given bit-endianness). Note that the symbols are not limited
843
- 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
844
871
 
845
872
 
846
873
  ``int2ba(int, /, length=None, endian=None, signed=False)`` -> bitarray
@@ -875,7 +902,7 @@ This sub-module was added in version 1.2.
875
902
 
876
903
 
877
904
  ``pprint(bitarray, /, stream=None, group=8, indent=4, width=80)``
878
- Pretty-print bitarray object to ``stream``, defaults is ``sys.stdout``.
905
+ Pretty-print bitarray object to ``stream``, defaults to ``sys.stdout``.
879
906
  By default, bits are grouped in bytes (8 bits), and 64 bits per line.
880
907
  Non-bitarray objects are printed using ``pprint.pprint()``.
881
908
 
@@ -886,8 +913,8 @@ This sub-module was added in version 1.2.
886
913
  Return (pseudo-) random bitarray of length ``n`` with ``k`` elements
887
914
  set to one. Mathematically equivalent to setting (in a bitarray of
888
915
  length ``n``) all bits at indices ``random.sample(range(n), k)`` to one.
889
- The random bitarrays are reproducible when giving Python's ``random.seed()``
890
- a specific seed value.
916
+ The random bitarrays are reproducible when calling Python's ``random.seed()``
917
+ with a specific seed value.
891
918
 
892
919
  New in version 3.6
893
920
 
@@ -896,7 +923,7 @@ This sub-module was added in version 1.2.
896
923
  Return (pseudo-) random bitarray of length ``n``, where each bit has
897
924
  probability ``p`` of being one (independent of any other bits). Mathematically
898
925
  equivalent to ``bitarray((random() < p for _ in range(n)), endian)``, but much
899
- faster for large ``n``. The random bitarrays are reproducible when giving
926
+ faster for large ``n``. The random bitarrays are reproducible when calling
900
927
  Python's ``random.seed()`` with a specific seed value.
901
928
 
902
929
  This function requires Python 3.12 or higher, as it depends on the standard
@@ -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