bitstring 4.2.1__tar.gz → 4.2.2__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.
- {bitstring-4.2.1 → bitstring-4.2.2}/LICENSE +21 -21
- {bitstring-4.2.1 → bitstring-4.2.2}/MANIFEST.in +8 -8
- {bitstring-4.2.1/bitstring.egg-info → bitstring-4.2.2}/PKG-INFO +2 -2
- {bitstring-4.2.1 → bitstring-4.2.2}/README.md +123 -123
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/__init__.py +318 -318
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/__main__.py +49 -49
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/array_.py +775 -775
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/bitarray_.py +577 -577
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/bits.py +1788 -1789
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/bitstore.py +271 -253
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/bitstore_helpers.py +260 -260
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/bitstream.py +713 -713
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/bitstring_options.py +93 -93
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/dtypes.py +403 -399
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/exceptions.py +24 -24
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/fp8.py +97 -97
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/luts.py +248 -248
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/methods.py +95 -95
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/mxfp.py +200 -200
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/utils.py +233 -233
- {bitstring-4.2.1 → bitstring-4.2.2/bitstring.egg-info}/PKG-INFO +2 -2
- {bitstring-4.2.1 → bitstring-4.2.2}/pyproject.toml +37 -37
- {bitstring-4.2.1 → bitstring-4.2.2}/release_notes.txt +1930 -1919
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/test_array.py +928 -928
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/test_bitarray.py +991 -991
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/test_bits.py +981 -981
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/test_bitstore.py +94 -94
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/test_bitstream.py +4196 -4178
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/test_bitstring.py +200 -200
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/test_constbitstream.py +274 -265
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/test_dtypes.py +154 -134
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/test_fp8.py +335 -295
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/test_mxfp.py +440 -441
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/test_scaled_dtypes.py +13 -13
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring/py.typed +0 -0
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring.egg-info/SOURCES.txt +0 -0
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring.egg-info/dependency_links.txt +0 -0
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring.egg-info/requires.txt +0 -0
- {bitstring-4.2.1 → bitstring-4.2.2}/bitstring.egg-info/top_level.txt +0 -0
- {bitstring-4.2.1 → bitstring-4.2.2}/setup.cfg +0 -0
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/__init__.py +0 -0
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/smalltestfile +0 -0
- {bitstring-4.2.1 → bitstring-4.2.2}/tests/test.m1v +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2006 Scott Griffiths (dr.scottgriffiths@gmail.com)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2006 Scott Griffiths (dr.scottgriffiths@gmail.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
include tests/test.m1v
|
|
2
|
-
include tests/smalltestfile
|
|
3
|
-
include tests/__init__.py
|
|
4
|
-
include release_notes.txt
|
|
5
|
-
include README.md
|
|
6
|
-
include bitstring/py.typed
|
|
7
|
-
prune doc
|
|
8
|
-
include LICENSE
|
|
1
|
+
include tests/test.m1v
|
|
2
|
+
include tests/smalltestfile
|
|
3
|
+
include tests/__init__.py
|
|
4
|
+
include release_notes.txt
|
|
5
|
+
include README.md
|
|
6
|
+
include bitstring/py.typed
|
|
7
|
+
prune doc
|
|
8
|
+
include LICENSE
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: bitstring
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.2
|
|
4
4
|
Summary: Simple construction, analysis and modification of binary data.
|
|
5
5
|
Author-email: Scott Griffiths <dr.scottgriffiths@gmail.com>
|
|
6
6
|
Project-URL: homepage, https://github.com/scott-griffiths/bitstring
|
|
@@ -43,7 +43,7 @@ It has been actively maintained since 2006.
|
|
|
43
43
|
|
|
44
44
|
News
|
|
45
45
|
----
|
|
46
|
-
**
|
|
46
|
+
**May 2024**: bitstring 4.2.2 released.
|
|
47
47
|
|
|
48
48
|
New in version 4.2:
|
|
49
49
|
|
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
**bitstring** is a Python module to help make the creation and analysis of all types of bit-level binary data as simple and efficient as possible.
|
|
6
|
-
|
|
7
|
-
It has been actively maintained since 2006.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[](https://github.com/scott-griffiths/bitstring/actions/workflows/ci.yml)
|
|
12
|
-
[](https://bitstring.readthedocs.io/en/latest/)
|
|
13
|
-
[](https://app.codacy.com/gh/scott-griffiths/bitstring/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
14
|
-
[](https://libraries.io/pypi/bitstring)
|
|
15
|
-
|
|
16
|
-
[](https://www.pepy.tech/projects/bitstring)
|
|
17
|
-
[](https://pypistats.org/packages/bitstring)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
News
|
|
21
|
-
----
|
|
22
|
-
**
|
|
23
|
-
|
|
24
|
-
New in version 4.2:
|
|
25
|
-
|
|
26
|
-
* Dropped support for Python 3.7. Minimum version is now 3.8.
|
|
27
|
-
* A new `Dtype` class can be optionally used to specify types.
|
|
28
|
-
* The `bitstring.options` object is now the preferred method for changing module options.
|
|
29
|
-
* New `fromstring` method as another way to create bitstrings from formatted strings.
|
|
30
|
-
* More types can now be pretty printed.
|
|
31
|
-
* A range of 8-bit, 6-bit and even 4-bit floating point formats added (beta):
|
|
32
|
-
* Performance improvements.
|
|
33
|
-
|
|
34
|
-
See the [release notes](https://github.com/scott-griffiths/bitstring/blob/main/release_notes.txt) for details. Please let me know if you encounter any problems.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Overview
|
|
38
|
-
--------
|
|
39
|
-
|
|
40
|
-
* Efficiently store and manipulate binary data in idiomatic Python.
|
|
41
|
-
* Create bitstrings from hex, octal, binary, files, formatted strings, bytes, integers and floats of different endiannesses.
|
|
42
|
-
* Powerful binary packing and unpacking functions.
|
|
43
|
-
* Bit-level slicing, joining, searching, replacing and more.
|
|
44
|
-
* Create and manipulate arrays of fixed-length bitstrings.
|
|
45
|
-
* Read from and interpret bitstrings as streams of binary data.
|
|
46
|
-
* Rich API - chances are that whatever you want to do there's a simple and elegant way of doing it.
|
|
47
|
-
* Open source software, released under the MIT licence.
|
|
48
|
-
|
|
49
|
-
Documentation
|
|
50
|
-
-------------
|
|
51
|
-
Extensive documentation for the bitstring module is available.
|
|
52
|
-
Some starting points are given below:
|
|
53
|
-
|
|
54
|
-
* [Overview](https://bitstring.readthedocs.io/en/stable/index.html)
|
|
55
|
-
* [Quick Reference](https://bitstring.readthedocs.io/en/stable/quick_reference.html)
|
|
56
|
-
* [Full Reference](https://bitstring.readthedocs.io/en/stable/reference.html)
|
|
57
|
-
|
|
58
|
-
There is also an introductory walkthrough notebook on [binder](https://mybinder.org/v2/gh/scott-griffiths/bitstring/main?labpath=doc%2Fwalkthrough.ipynb).
|
|
59
|
-
|
|
60
|
-
Release Notes
|
|
61
|
-
-------------
|
|
62
|
-
|
|
63
|
-
To see what been added, improved or fixed, and also to see what's coming in the next version, see the [release notes](https://github.com/scott-griffiths/bitstring/blob/main/release_notes.txt).
|
|
64
|
-
|
|
65
|
-
Examples
|
|
66
|
-
--------
|
|
67
|
-
|
|
68
|
-
### Installation
|
|
69
|
-
|
|
70
|
-
$ pip install bitstring
|
|
71
|
-
|
|
72
|
-
### Creation
|
|
73
|
-
|
|
74
|
-
>>> from bitstring import Bits, BitArray, BitStream, pack
|
|
75
|
-
>>> a = BitArray(bin='00101')
|
|
76
|
-
>>> b = Bits(a_file_object)
|
|
77
|
-
>>> c = BitArray('0xff, 0b101, 0o65, uint6=22')
|
|
78
|
-
>>> d = pack('intle16, hex=a, 0b1', 100, a='0x34f')
|
|
79
|
-
>>> e = pack('<16h', *range(16))
|
|
80
|
-
|
|
81
|
-
### Different interpretations, slicing and concatenation
|
|
82
|
-
|
|
83
|
-
>>> a = BitArray('0x3348')
|
|
84
|
-
>>> a.hex, a.bin, a.uint, a.float, a.bytes
|
|
85
|
-
('3348', '0011001101001000', 13128, 0.2275390625, b'3H')
|
|
86
|
-
>>> a[10:3:-1].bin
|
|
87
|
-
'0101100'
|
|
88
|
-
>>> '0b100' + 3*a
|
|
89
|
-
BitArray('0x866906690669, 0b000')
|
|
90
|
-
|
|
91
|
-
### Reading data sequentially
|
|
92
|
-
|
|
93
|
-
>>> b = BitStream('0x160120f')
|
|
94
|
-
>>> b.read(12).hex
|
|
95
|
-
'160'
|
|
96
|
-
>>> b.pos = 0
|
|
97
|
-
>>> b.read('uint12')
|
|
98
|
-
352
|
|
99
|
-
>>> b.readlist('uint12, bin3')
|
|
100
|
-
[288, '111']
|
|
101
|
-
|
|
102
|
-
### Searching, inserting and deleting
|
|
103
|
-
|
|
104
|
-
>>> c = BitArray('0b00010010010010001111') # c.hex == '0x1248f'
|
|
105
|
-
>>> c.find('0x48')
|
|
106
|
-
(8,)
|
|
107
|
-
>>> c.replace('0b001', '0xabc')
|
|
108
|
-
>>> c.insert('0b0000', pos=3)
|
|
109
|
-
>>> del c[12:16]
|
|
110
|
-
|
|
111
|
-
### Arrays of fixed-length formats
|
|
112
|
-
|
|
113
|
-
>>> from bitstring import Array
|
|
114
|
-
>>> a = Array('uint7', [9, 100, 3, 1])
|
|
115
|
-
>>> a.data
|
|
116
|
-
BitArray('0x1390181')
|
|
117
|
-
>>> a[::2] *= 5
|
|
118
|
-
>>> a
|
|
119
|
-
Array('uint7', [45, 100, 15, 1])
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
<sub>Copyright (c) 2006 - 2024 Scott Griffiths</sub>
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
**bitstring** is a Python module to help make the creation and analysis of all types of bit-level binary data as simple and efficient as possible.
|
|
6
|
+
|
|
7
|
+
It has been actively maintained since 2006.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
[](https://github.com/scott-griffiths/bitstring/actions/workflows/ci.yml)
|
|
12
|
+
[](https://bitstring.readthedocs.io/en/latest/)
|
|
13
|
+
[](https://app.codacy.com/gh/scott-griffiths/bitstring/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
14
|
+
[](https://libraries.io/pypi/bitstring)
|
|
15
|
+
|
|
16
|
+
[](https://www.pepy.tech/projects/bitstring)
|
|
17
|
+
[](https://pypistats.org/packages/bitstring)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
News
|
|
21
|
+
----
|
|
22
|
+
**May 2024**: bitstring 4.2.2 released.
|
|
23
|
+
|
|
24
|
+
New in version 4.2:
|
|
25
|
+
|
|
26
|
+
* Dropped support for Python 3.7. Minimum version is now 3.8.
|
|
27
|
+
* A new `Dtype` class can be optionally used to specify types.
|
|
28
|
+
* The `bitstring.options` object is now the preferred method for changing module options.
|
|
29
|
+
* New `fromstring` method as another way to create bitstrings from formatted strings.
|
|
30
|
+
* More types can now be pretty printed.
|
|
31
|
+
* A range of 8-bit, 6-bit and even 4-bit floating point formats added (beta):
|
|
32
|
+
* Performance improvements.
|
|
33
|
+
|
|
34
|
+
See the [release notes](https://github.com/scott-griffiths/bitstring/blob/main/release_notes.txt) for details. Please let me know if you encounter any problems.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
Overview
|
|
38
|
+
--------
|
|
39
|
+
|
|
40
|
+
* Efficiently store and manipulate binary data in idiomatic Python.
|
|
41
|
+
* Create bitstrings from hex, octal, binary, files, formatted strings, bytes, integers and floats of different endiannesses.
|
|
42
|
+
* Powerful binary packing and unpacking functions.
|
|
43
|
+
* Bit-level slicing, joining, searching, replacing and more.
|
|
44
|
+
* Create and manipulate arrays of fixed-length bitstrings.
|
|
45
|
+
* Read from and interpret bitstrings as streams of binary data.
|
|
46
|
+
* Rich API - chances are that whatever you want to do there's a simple and elegant way of doing it.
|
|
47
|
+
* Open source software, released under the MIT licence.
|
|
48
|
+
|
|
49
|
+
Documentation
|
|
50
|
+
-------------
|
|
51
|
+
Extensive documentation for the bitstring module is available.
|
|
52
|
+
Some starting points are given below:
|
|
53
|
+
|
|
54
|
+
* [Overview](https://bitstring.readthedocs.io/en/stable/index.html)
|
|
55
|
+
* [Quick Reference](https://bitstring.readthedocs.io/en/stable/quick_reference.html)
|
|
56
|
+
* [Full Reference](https://bitstring.readthedocs.io/en/stable/reference.html)
|
|
57
|
+
|
|
58
|
+
There is also an introductory walkthrough notebook on [binder](https://mybinder.org/v2/gh/scott-griffiths/bitstring/main?labpath=doc%2Fwalkthrough.ipynb).
|
|
59
|
+
|
|
60
|
+
Release Notes
|
|
61
|
+
-------------
|
|
62
|
+
|
|
63
|
+
To see what been added, improved or fixed, and also to see what's coming in the next version, see the [release notes](https://github.com/scott-griffiths/bitstring/blob/main/release_notes.txt).
|
|
64
|
+
|
|
65
|
+
Examples
|
|
66
|
+
--------
|
|
67
|
+
|
|
68
|
+
### Installation
|
|
69
|
+
|
|
70
|
+
$ pip install bitstring
|
|
71
|
+
|
|
72
|
+
### Creation
|
|
73
|
+
|
|
74
|
+
>>> from bitstring import Bits, BitArray, BitStream, pack
|
|
75
|
+
>>> a = BitArray(bin='00101')
|
|
76
|
+
>>> b = Bits(a_file_object)
|
|
77
|
+
>>> c = BitArray('0xff, 0b101, 0o65, uint6=22')
|
|
78
|
+
>>> d = pack('intle16, hex=a, 0b1', 100, a='0x34f')
|
|
79
|
+
>>> e = pack('<16h', *range(16))
|
|
80
|
+
|
|
81
|
+
### Different interpretations, slicing and concatenation
|
|
82
|
+
|
|
83
|
+
>>> a = BitArray('0x3348')
|
|
84
|
+
>>> a.hex, a.bin, a.uint, a.float, a.bytes
|
|
85
|
+
('3348', '0011001101001000', 13128, 0.2275390625, b'3H')
|
|
86
|
+
>>> a[10:3:-1].bin
|
|
87
|
+
'0101100'
|
|
88
|
+
>>> '0b100' + 3*a
|
|
89
|
+
BitArray('0x866906690669, 0b000')
|
|
90
|
+
|
|
91
|
+
### Reading data sequentially
|
|
92
|
+
|
|
93
|
+
>>> b = BitStream('0x160120f')
|
|
94
|
+
>>> b.read(12).hex
|
|
95
|
+
'160'
|
|
96
|
+
>>> b.pos = 0
|
|
97
|
+
>>> b.read('uint12')
|
|
98
|
+
352
|
|
99
|
+
>>> b.readlist('uint12, bin3')
|
|
100
|
+
[288, '111']
|
|
101
|
+
|
|
102
|
+
### Searching, inserting and deleting
|
|
103
|
+
|
|
104
|
+
>>> c = BitArray('0b00010010010010001111') # c.hex == '0x1248f'
|
|
105
|
+
>>> c.find('0x48')
|
|
106
|
+
(8,)
|
|
107
|
+
>>> c.replace('0b001', '0xabc')
|
|
108
|
+
>>> c.insert('0b0000', pos=3)
|
|
109
|
+
>>> del c[12:16]
|
|
110
|
+
|
|
111
|
+
### Arrays of fixed-length formats
|
|
112
|
+
|
|
113
|
+
>>> from bitstring import Array
|
|
114
|
+
>>> a = Array('uint7', [9, 100, 3, 1])
|
|
115
|
+
>>> a.data
|
|
116
|
+
BitArray('0x1390181')
|
|
117
|
+
>>> a[::2] *= 5
|
|
118
|
+
>>> a
|
|
119
|
+
Array('uint7', [45, 100, 15, 1])
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
<sub>Copyright (c) 2006 - 2024 Scott Griffiths</sub>
|