bitarray 3.10.0__tar.gz → 3.11.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.
- {bitarray-3.10.0 → bitarray-3.11.0}/PKG-INFO +57 -20
- {bitarray-3.10.0 → bitarray-3.11.0}/README.rst +56 -19
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/__init__.py +1 -2
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/__init__.pyi +0 -1
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/_bitarray.c +141 -60
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/_util.c +503 -141
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/bitarray.h +9 -7
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/test_bitarray.py +146 -124
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/test_free_threading.py +6 -3
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/test_util.py +531 -250
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/util.py +133 -86
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/util.pyi +4 -1
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray.egg-info/PKG-INFO +57 -20
- {bitarray-3.10.0 → bitarray-3.11.0}/LICENSE +0 -0
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/py.typed +0 -0
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/pythoncapi_compat.h +0 -0
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray/test_281.pickle +0 -0
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray.egg-info/SOURCES.txt +0 -0
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray.egg-info/dependency_links.txt +0 -0
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray.egg-info/not-zip-safe +0 -0
- {bitarray-3.10.0 → bitarray-3.11.0}/bitarray.egg-info/top_level.txt +0 -0
- {bitarray-3.10.0 → bitarray-3.11.0}/pyproject.toml +0 -0
- {bitarray-3.10.0 → bitarray-3.11.0}/setup.cfg +0 -0
- {bitarray-3.10.0 → bitarray-3.11.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bitarray
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.11.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,16 +54,17 @@ 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
|
|
58
|
-
* Fast methods for encoding and decoding variable
|
|
57
|
+
* Free-threading support (for GIL-disabled CPython 3.14 and later)
|
|
58
|
+
* Fast methods for encoding and decoding variable-length prefix codes.
|
|
59
59
|
* Bitarray objects support the buffer protocol (both importing and
|
|
60
60
|
exporting buffers).
|
|
61
|
-
*
|
|
61
|
+
* Efficient packing and unpacking for interoperability with byte-oriented
|
|
62
|
+
objects such as NumPy arrays.
|
|
62
63
|
* Pickling and unpickling of bitarray objects.
|
|
63
64
|
* Immutable ``frozenbitarray`` objects which are hashable
|
|
64
|
-
*
|
|
65
|
+
* Fast searching for bits and bit patterns
|
|
65
66
|
* Type hinting
|
|
66
|
-
* Extensive test suite with
|
|
67
|
+
* Extensive test suite with over 600 unit tests
|
|
67
68
|
* Utility module ``bitarray.util``:
|
|
68
69
|
|
|
69
70
|
* conversion to and from hexadecimal strings
|
|
@@ -72,7 +73,8 @@ Key features
|
|
|
72
73
|
* conversion to and from integers
|
|
73
74
|
* creating Huffman codes
|
|
74
75
|
* compression of sparse bitarrays
|
|
75
|
-
*
|
|
76
|
+
* run-length encoding
|
|
77
|
+
* serialization and deserialization
|
|
76
78
|
* various count functions
|
|
77
79
|
* other helpful functions
|
|
78
80
|
|
|
@@ -94,7 +96,7 @@ Once you have installed the package, you may want to test it:
|
|
|
94
96
|
$ python -c 'import bitarray; bitarray.test()'
|
|
95
97
|
bitarray is installed in: /Users/ilan/bitarray/bitarray
|
|
96
98
|
sys.prefix: /Users/ilan/miniforge
|
|
97
|
-
bitarray version: 3.
|
|
99
|
+
bitarray version: 3.11.0
|
|
98
100
|
sys.version: 3.14.5 (main, May 20 2026) [Clang 20.1.8]
|
|
99
101
|
sys.abiflags: ''
|
|
100
102
|
sys._is_gil_enabled(): True
|
|
@@ -111,7 +113,7 @@ Once you have installed the package, you may want to test it:
|
|
|
111
113
|
..........s.....................................s........................
|
|
112
114
|
......s.........................................................
|
|
113
115
|
----------------------------------------------------------------------
|
|
114
|
-
Ran
|
|
116
|
+
Ran 654 tests in 0.192s
|
|
115
117
|
|
|
116
118
|
OK (skipped=4)
|
|
117
119
|
|
|
@@ -283,8 +285,8 @@ this topic, please read `buffer protocol <https://github.com/ilanschnell/bitarra
|
|
|
283
285
|
to memory-map a file to a bitarray: `mmapped-file.py <https://github.com/ilanschnell/bitarray/blob/master/examples/mmapped-file.py>`__
|
|
284
286
|
|
|
285
287
|
|
|
286
|
-
Variable
|
|
287
|
-
|
|
288
|
+
Variable-length prefix codes
|
|
289
|
+
----------------------------
|
|
288
290
|
|
|
289
291
|
The ``.encode()`` method takes a dictionary mapping symbols to bitarrays
|
|
290
292
|
and an iterable, and extends the bitarray object with the encoded symbols
|
|
@@ -358,7 +360,7 @@ and can therefore be used as a dictionary key:
|
|
|
358
360
|
Reference
|
|
359
361
|
=========
|
|
360
362
|
|
|
361
|
-
bitarray version: 3.
|
|
363
|
+
bitarray version: 3.11.0 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
|
|
362
364
|
|
|
363
365
|
In the following, ``item`` and ``value`` are usually a single bit -
|
|
364
366
|
an integer 0 or 1.
|
|
@@ -937,7 +939,7 @@ This sub-module was added in version 1.2.
|
|
|
937
939
|
|
|
938
940
|
|
|
939
941
|
``pprint(bitarray, /, stream=None, group=8, indent=4, width=80)``
|
|
940
|
-
Pretty-print bitarray object to ``stream``, defaults
|
|
942
|
+
Pretty-print bitarray object to ``stream``, defaults to ``sys.stdout``.
|
|
941
943
|
By default, bits are grouped in bytes (8 bits), and 64 bits per line.
|
|
942
944
|
Non-bitarray objects are printed using ``pprint.pprint()``.
|
|
943
945
|
|
|
@@ -948,8 +950,8 @@ This sub-module was added in version 1.2.
|
|
|
948
950
|
Return (pseudo-) random bitarray of length ``n`` with ``k`` elements
|
|
949
951
|
set to one. Mathematically equivalent to setting (in a bitarray of
|
|
950
952
|
length ``n``) all bits at indices ``random.sample(range(n), k)`` to one.
|
|
951
|
-
The random bitarrays are reproducible when
|
|
952
|
-
a specific seed value.
|
|
953
|
+
The random bitarrays are reproducible when calling Python's ``random.seed()``
|
|
954
|
+
with a specific seed value.
|
|
953
955
|
|
|
954
956
|
New in version 3.6
|
|
955
957
|
|
|
@@ -958,7 +960,7 @@ This sub-module was added in version 1.2.
|
|
|
958
960
|
Return (pseudo-) random bitarray of length ``n``, where each bit has
|
|
959
961
|
probability ``p`` of being one (independent of any other bits). Mathematically
|
|
960
962
|
equivalent to ``bitarray((random() < p for _ in range(n)), endian)``, but much
|
|
961
|
-
faster for large ``n``. The random bitarrays are reproducible when
|
|
963
|
+
faster for large ``n``. The random bitarrays are reproducible when calling
|
|
962
964
|
Python's ``random.seed()`` with a specific seed value.
|
|
963
965
|
|
|
964
966
|
This function requires Python 3.12 or higher, as it depends on the standard
|
|
@@ -970,13 +972,34 @@ This sub-module was added in version 1.2.
|
|
|
970
972
|
New in version 3.5
|
|
971
973
|
|
|
972
974
|
|
|
975
|
+
``rl_decode(stream, /, endian=None)`` -> bitarray
|
|
976
|
+
Decode a run-length encoded bitarray from a binary stream (an integer
|
|
977
|
+
iterator, or bytes-like object), and return the decoded bitarray.
|
|
978
|
+
This function consumes only one bitarray and leaves the remaining stream
|
|
979
|
+
untouched. Use ``rl_encode()`` for encoding.
|
|
980
|
+
|
|
981
|
+
See also: `Comparison of bitarray codecs <https://github.com/ilanschnell/bitarray/blob/master/doc/codecs.rst>`__
|
|
982
|
+
|
|
983
|
+
New in version 3.11
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
``rl_encode(bitarray, /)`` -> bytes
|
|
987
|
+
Return the run-length encoded binary representation of a bitarray.
|
|
988
|
+
This representation may be useful for bitarrays with long runs of
|
|
989
|
+
identical bits. Use ``rl_decode()`` for decoding.
|
|
990
|
+
|
|
991
|
+
See also: `Comparison of bitarray codecs <https://github.com/ilanschnell/bitarray/blob/master/doc/codecs.rst>`__
|
|
992
|
+
|
|
993
|
+
New in version 3.11
|
|
994
|
+
|
|
995
|
+
|
|
973
996
|
``sc_decode(stream, /)`` -> bitarray
|
|
974
997
|
Decompress binary stream (an integer iterator, or bytes-like object) of a
|
|
975
998
|
sparse compressed (``sc``) bitarray, and return the decoded bitarray.
|
|
976
999
|
This function consumes only one bitarray and leaves the remaining stream
|
|
977
1000
|
untouched. Use ``sc_encode()`` for compressing (encoding).
|
|
978
1001
|
|
|
979
|
-
See also: `Compression of sparse bitarrays <https://github.com/ilanschnell/bitarray/blob/master/doc/sparse_compression.rst>`__
|
|
1002
|
+
See also: `Compression of sparse bitarrays <https://github.com/ilanschnell/bitarray/blob/master/doc/sparse_compression.rst>`__, `Comparison of bitarray codecs <https://github.com/ilanschnell/bitarray/blob/master/doc/codecs.rst>`__
|
|
980
1003
|
|
|
981
1004
|
New in version 2.7
|
|
982
1005
|
|
|
@@ -986,11 +1009,25 @@ This sub-module was added in version 1.2.
|
|
|
986
1009
|
representation. This representation is useful for efficiently storing
|
|
987
1010
|
sparse bitarrays. Use ``sc_decode()`` for decompressing (decoding).
|
|
988
1011
|
|
|
989
|
-
See also: `Compression of sparse bitarrays <https://github.com/ilanschnell/bitarray/blob/master/doc/sparse_compression.rst>`__
|
|
1012
|
+
See also: `Compression of sparse bitarrays <https://github.com/ilanschnell/bitarray/blob/master/doc/sparse_compression.rst>`__, `Comparison of bitarray codecs <https://github.com/ilanschnell/bitarray/blob/master/doc/codecs.rst>`__
|
|
990
1013
|
|
|
991
1014
|
New in version 2.7
|
|
992
1015
|
|
|
993
1016
|
|
|
1017
|
+
``sc_stat(stream)`` -> dict
|
|
1018
|
+
Scan a stream produced by ``sc_encode()`` and return a dictionary containing
|
|
1019
|
+
its bit-endianness (``endian``), length (``nbits``), and the number of blocks
|
|
1020
|
+
of each type (``blocks``). ``blocks`` is a list such that ``blocks[i]`` is the
|
|
1021
|
+
number of blocks of type ``i``.
|
|
1022
|
+
|
|
1023
|
+
Like ``sc_decode()``, it consumes one encoded bitarray and leaves remaining
|
|
1024
|
+
input untouched.
|
|
1025
|
+
|
|
1026
|
+
See also: `Compression of sparse bitarrays <https://github.com/ilanschnell/bitarray/blob/master/doc/sparse_compression.rst>`__
|
|
1027
|
+
|
|
1028
|
+
New in version 3.11
|
|
1029
|
+
|
|
1030
|
+
|
|
994
1031
|
``serialize(bitarray, /)`` -> bytes
|
|
995
1032
|
Return a serialized representation of the bitarray, which may be passed to
|
|
996
1033
|
``deserialize()``. It efficiently represents the bitarray object (including
|
|
@@ -1034,7 +1071,7 @@ This sub-module was added in version 1.2.
|
|
|
1034
1071
|
return the decoded bitarray. This function consumes only one bitarray and
|
|
1035
1072
|
leaves the remaining stream untouched. Use ``vl_encode()`` for encoding.
|
|
1036
1073
|
|
|
1037
|
-
See also: `Variable length bitarray format <https://github.com/ilanschnell/bitarray/blob/master/doc/variable_length.rst>`__
|
|
1074
|
+
See also: `Variable length bitarray format <https://github.com/ilanschnell/bitarray/blob/master/doc/variable_length.rst>`__, `Comparison of bitarray codecs <https://github.com/ilanschnell/bitarray/blob/master/doc/codecs.rst>`__
|
|
1038
1075
|
|
|
1039
1076
|
New in version 2.2
|
|
1040
1077
|
|
|
@@ -1044,7 +1081,7 @@ This sub-module was added in version 1.2.
|
|
|
1044
1081
|
This representation is useful for efficiently storing small bitarray
|
|
1045
1082
|
in a binary stream. Use ``vl_decode()`` for decoding.
|
|
1046
1083
|
|
|
1047
|
-
See also: `Variable length bitarray format <https://github.com/ilanschnell/bitarray/blob/master/doc/variable_length.rst>`__
|
|
1084
|
+
See also: `Variable length bitarray format <https://github.com/ilanschnell/bitarray/blob/master/doc/variable_length.rst>`__, `Comparison of bitarray codecs <https://github.com/ilanschnell/bitarray/blob/master/doc/codecs.rst>`__
|
|
1048
1085
|
|
|
1049
1086
|
New in version 2.2
|
|
1050
1087
|
|
|
@@ -19,16 +19,17 @@ 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
|
|
23
|
-
* Fast methods for encoding and decoding variable
|
|
22
|
+
* Free-threading support (for GIL-disabled CPython 3.14 and later)
|
|
23
|
+
* Fast methods for encoding and decoding variable-length prefix codes.
|
|
24
24
|
* Bitarray objects support the buffer protocol (both importing and
|
|
25
25
|
exporting buffers).
|
|
26
|
-
*
|
|
26
|
+
* Efficient packing and unpacking for interoperability with byte-oriented
|
|
27
|
+
objects such as NumPy arrays.
|
|
27
28
|
* Pickling and unpickling of bitarray objects.
|
|
28
29
|
* Immutable ``frozenbitarray`` objects which are hashable
|
|
29
|
-
*
|
|
30
|
+
* Fast searching for bits and bit patterns
|
|
30
31
|
* Type hinting
|
|
31
|
-
* Extensive test suite with
|
|
32
|
+
* Extensive test suite with over 600 unit tests
|
|
32
33
|
* Utility module ``bitarray.util``:
|
|
33
34
|
|
|
34
35
|
* conversion to and from hexadecimal strings
|
|
@@ -37,7 +38,8 @@ Key features
|
|
|
37
38
|
* conversion to and from integers
|
|
38
39
|
* creating Huffman codes
|
|
39
40
|
* compression of sparse bitarrays
|
|
40
|
-
*
|
|
41
|
+
* run-length encoding
|
|
42
|
+
* serialization and deserialization
|
|
41
43
|
* various count functions
|
|
42
44
|
* other helpful functions
|
|
43
45
|
|
|
@@ -59,7 +61,7 @@ Once you have installed the package, you may want to test it:
|
|
|
59
61
|
$ python -c 'import bitarray; bitarray.test()'
|
|
60
62
|
bitarray is installed in: /Users/ilan/bitarray/bitarray
|
|
61
63
|
sys.prefix: /Users/ilan/miniforge
|
|
62
|
-
bitarray version: 3.
|
|
64
|
+
bitarray version: 3.11.0
|
|
63
65
|
sys.version: 3.14.5 (main, May 20 2026) [Clang 20.1.8]
|
|
64
66
|
sys.abiflags: ''
|
|
65
67
|
sys._is_gil_enabled(): True
|
|
@@ -76,7 +78,7 @@ Once you have installed the package, you may want to test it:
|
|
|
76
78
|
..........s.....................................s........................
|
|
77
79
|
......s.........................................................
|
|
78
80
|
----------------------------------------------------------------------
|
|
79
|
-
Ran
|
|
81
|
+
Ran 654 tests in 0.192s
|
|
80
82
|
|
|
81
83
|
OK (skipped=4)
|
|
82
84
|
|
|
@@ -248,8 +250,8 @@ this topic, please read `buffer protocol <https://github.com/ilanschnell/bitarra
|
|
|
248
250
|
to memory-map a file to a bitarray: `mmapped-file.py <https://github.com/ilanschnell/bitarray/blob/master/examples/mmapped-file.py>`__
|
|
249
251
|
|
|
250
252
|
|
|
251
|
-
Variable
|
|
252
|
-
|
|
253
|
+
Variable-length prefix codes
|
|
254
|
+
----------------------------
|
|
253
255
|
|
|
254
256
|
The ``.encode()`` method takes a dictionary mapping symbols to bitarrays
|
|
255
257
|
and an iterable, and extends the bitarray object with the encoded symbols
|
|
@@ -323,7 +325,7 @@ and can therefore be used as a dictionary key:
|
|
|
323
325
|
Reference
|
|
324
326
|
=========
|
|
325
327
|
|
|
326
|
-
bitarray version: 3.
|
|
328
|
+
bitarray version: 3.11.0 -- `change log <https://github.com/ilanschnell/bitarray/blob/master/doc/changelog.rst>`__
|
|
327
329
|
|
|
328
330
|
In the following, ``item`` and ``value`` are usually a single bit -
|
|
329
331
|
an integer 0 or 1.
|
|
@@ -902,7 +904,7 @@ This sub-module was added in version 1.2.
|
|
|
902
904
|
|
|
903
905
|
|
|
904
906
|
``pprint(bitarray, /, stream=None, group=8, indent=4, width=80)``
|
|
905
|
-
Pretty-print bitarray object to ``stream``, defaults
|
|
907
|
+
Pretty-print bitarray object to ``stream``, defaults to ``sys.stdout``.
|
|
906
908
|
By default, bits are grouped in bytes (8 bits), and 64 bits per line.
|
|
907
909
|
Non-bitarray objects are printed using ``pprint.pprint()``.
|
|
908
910
|
|
|
@@ -913,8 +915,8 @@ This sub-module was added in version 1.2.
|
|
|
913
915
|
Return (pseudo-) random bitarray of length ``n`` with ``k`` elements
|
|
914
916
|
set to one. Mathematically equivalent to setting (in a bitarray of
|
|
915
917
|
length ``n``) all bits at indices ``random.sample(range(n), k)`` to one.
|
|
916
|
-
The random bitarrays are reproducible when
|
|
917
|
-
a specific seed value.
|
|
918
|
+
The random bitarrays are reproducible when calling Python's ``random.seed()``
|
|
919
|
+
with a specific seed value.
|
|
918
920
|
|
|
919
921
|
New in version 3.6
|
|
920
922
|
|
|
@@ -923,7 +925,7 @@ This sub-module was added in version 1.2.
|
|
|
923
925
|
Return (pseudo-) random bitarray of length ``n``, where each bit has
|
|
924
926
|
probability ``p`` of being one (independent of any other bits). Mathematically
|
|
925
927
|
equivalent to ``bitarray((random() < p for _ in range(n)), endian)``, but much
|
|
926
|
-
faster for large ``n``. The random bitarrays are reproducible when
|
|
928
|
+
faster for large ``n``. The random bitarrays are reproducible when calling
|
|
927
929
|
Python's ``random.seed()`` with a specific seed value.
|
|
928
930
|
|
|
929
931
|
This function requires Python 3.12 or higher, as it depends on the standard
|
|
@@ -935,13 +937,34 @@ This sub-module was added in version 1.2.
|
|
|
935
937
|
New in version 3.5
|
|
936
938
|
|
|
937
939
|
|
|
940
|
+
``rl_decode(stream, /, endian=None)`` -> bitarray
|
|
941
|
+
Decode a run-length encoded bitarray from a binary stream (an integer
|
|
942
|
+
iterator, or bytes-like object), and return the decoded bitarray.
|
|
943
|
+
This function consumes only one bitarray and leaves the remaining stream
|
|
944
|
+
untouched. Use ``rl_encode()`` for encoding.
|
|
945
|
+
|
|
946
|
+
See also: `Comparison of bitarray codecs <https://github.com/ilanschnell/bitarray/blob/master/doc/codecs.rst>`__
|
|
947
|
+
|
|
948
|
+
New in version 3.11
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
``rl_encode(bitarray, /)`` -> bytes
|
|
952
|
+
Return the run-length encoded binary representation of a bitarray.
|
|
953
|
+
This representation may be useful for bitarrays with long runs of
|
|
954
|
+
identical bits. Use ``rl_decode()`` for decoding.
|
|
955
|
+
|
|
956
|
+
See also: `Comparison of bitarray codecs <https://github.com/ilanschnell/bitarray/blob/master/doc/codecs.rst>`__
|
|
957
|
+
|
|
958
|
+
New in version 3.11
|
|
959
|
+
|
|
960
|
+
|
|
938
961
|
``sc_decode(stream, /)`` -> bitarray
|
|
939
962
|
Decompress binary stream (an integer iterator, or bytes-like object) of a
|
|
940
963
|
sparse compressed (``sc``) bitarray, and return the decoded bitarray.
|
|
941
964
|
This function consumes only one bitarray and leaves the remaining stream
|
|
942
965
|
untouched. Use ``sc_encode()`` for compressing (encoding).
|
|
943
966
|
|
|
944
|
-
See also: `Compression of sparse bitarrays <https://github.com/ilanschnell/bitarray/blob/master/doc/sparse_compression.rst>`__
|
|
967
|
+
See also: `Compression of sparse bitarrays <https://github.com/ilanschnell/bitarray/blob/master/doc/sparse_compression.rst>`__, `Comparison of bitarray codecs <https://github.com/ilanschnell/bitarray/blob/master/doc/codecs.rst>`__
|
|
945
968
|
|
|
946
969
|
New in version 2.7
|
|
947
970
|
|
|
@@ -951,11 +974,25 @@ This sub-module was added in version 1.2.
|
|
|
951
974
|
representation. This representation is useful for efficiently storing
|
|
952
975
|
sparse bitarrays. Use ``sc_decode()`` for decompressing (decoding).
|
|
953
976
|
|
|
954
|
-
See also: `Compression of sparse bitarrays <https://github.com/ilanschnell/bitarray/blob/master/doc/sparse_compression.rst>`__
|
|
977
|
+
See also: `Compression of sparse bitarrays <https://github.com/ilanschnell/bitarray/blob/master/doc/sparse_compression.rst>`__, `Comparison of bitarray codecs <https://github.com/ilanschnell/bitarray/blob/master/doc/codecs.rst>`__
|
|
955
978
|
|
|
956
979
|
New in version 2.7
|
|
957
980
|
|
|
958
981
|
|
|
982
|
+
``sc_stat(stream)`` -> dict
|
|
983
|
+
Scan a stream produced by ``sc_encode()`` and return a dictionary containing
|
|
984
|
+
its bit-endianness (``endian``), length (``nbits``), and the number of blocks
|
|
985
|
+
of each type (``blocks``). ``blocks`` is a list such that ``blocks[i]`` is the
|
|
986
|
+
number of blocks of type ``i``.
|
|
987
|
+
|
|
988
|
+
Like ``sc_decode()``, it consumes one encoded bitarray and leaves remaining
|
|
989
|
+
input untouched.
|
|
990
|
+
|
|
991
|
+
See also: `Compression of sparse bitarrays <https://github.com/ilanschnell/bitarray/blob/master/doc/sparse_compression.rst>`__
|
|
992
|
+
|
|
993
|
+
New in version 3.11
|
|
994
|
+
|
|
995
|
+
|
|
959
996
|
``serialize(bitarray, /)`` -> bytes
|
|
960
997
|
Return a serialized representation of the bitarray, which may be passed to
|
|
961
998
|
``deserialize()``. It efficiently represents the bitarray object (including
|
|
@@ -999,7 +1036,7 @@ This sub-module was added in version 1.2.
|
|
|
999
1036
|
return the decoded bitarray. This function consumes only one bitarray and
|
|
1000
1037
|
leaves the remaining stream untouched. Use ``vl_encode()`` for encoding.
|
|
1001
1038
|
|
|
1002
|
-
See also: `Variable length bitarray format <https://github.com/ilanschnell/bitarray/blob/master/doc/variable_length.rst>`__
|
|
1039
|
+
See also: `Variable length bitarray format <https://github.com/ilanschnell/bitarray/blob/master/doc/variable_length.rst>`__, `Comparison of bitarray codecs <https://github.com/ilanschnell/bitarray/blob/master/doc/codecs.rst>`__
|
|
1003
1040
|
|
|
1004
1041
|
New in version 2.2
|
|
1005
1042
|
|
|
@@ -1009,7 +1046,7 @@ This sub-module was added in version 1.2.
|
|
|
1009
1046
|
This representation is useful for efficiently storing small bitarray
|
|
1010
1047
|
in a binary stream. Use ``vl_decode()`` for decoding.
|
|
1011
1048
|
|
|
1012
|
-
See also: `Variable length bitarray format <https://github.com/ilanschnell/bitarray/blob/master/doc/variable_length.rst>`__
|
|
1049
|
+
See also: `Variable length bitarray format <https://github.com/ilanschnell/bitarray/blob/master/doc/variable_length.rst>`__, `Comparison of bitarray codecs <https://github.com/ilanschnell/bitarray/blob/master/doc/codecs.rst>`__
|
|
1013
1050
|
|
|
1014
1051
|
New in version 2.2
|
|
1015
1052
|
|
|
@@ -13,8 +13,7 @@ from collections import namedtuple
|
|
|
13
13
|
|
|
14
14
|
from bitarray._bitarray import (
|
|
15
15
|
bitarray, decodetree, decodeiterator, _bitarray_reconstructor,
|
|
16
|
-
get_default_endian, bits2bytes,
|
|
17
|
-
BITARRAY_VERSION as __version__
|
|
16
|
+
get_default_endian, bits2bytes, BITARRAY_VERSION as __version__
|
|
18
17
|
)
|
|
19
18
|
|
|
20
19
|
__all__ = ['bitarray', 'frozenbitarray', 'decodetree', 'decodeiterator',
|
|
@@ -169,7 +169,6 @@ __version__: str
|
|
|
169
169
|
def bits2bytes(n: int) -> int: ...
|
|
170
170
|
def get_default_endian() -> str: ...
|
|
171
171
|
def test(verbosity: int = ...) -> TextTestResult: ...
|
|
172
|
-
def _sysinfo(key: str) -> int: ...
|
|
173
172
|
def _bitarray_reconstructor(cls: type,
|
|
174
173
|
buffer: bytes,
|
|
175
174
|
endian: str,
|