bitstring 4.2.0b2__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.
Files changed (43) hide show
  1. {bitstring-4.2.0b2 → bitstring-4.2.2}/LICENSE +21 -21
  2. {bitstring-4.2.0b2 → bitstring-4.2.2}/MANIFEST.in +8 -8
  3. {bitstring-4.2.0b2/bitstring.egg-info → bitstring-4.2.2}/PKG-INFO +6 -16
  4. {bitstring-4.2.0b2 → bitstring-4.2.2}/README.md +123 -133
  5. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/__init__.py +318 -312
  6. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/__main__.py +49 -49
  7. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/array_.py +775 -773
  8. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/bitarray_.py +577 -576
  9. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/bits.py +1788 -1797
  10. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/bitstore.py +271 -253
  11. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/bitstore_helpers.py +260 -260
  12. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/bitstream.py +713 -703
  13. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/bitstring_options.py +93 -93
  14. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/dtypes.py +403 -396
  15. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/exceptions.py +24 -24
  16. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/fp8.py +97 -97
  17. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/luts.py +248 -248
  18. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/methods.py +95 -95
  19. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/mxfp.py +200 -200
  20. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/utils.py +233 -231
  21. {bitstring-4.2.0b2 → bitstring-4.2.2/bitstring.egg-info}/PKG-INFO +6 -16
  22. {bitstring-4.2.0b2 → bitstring-4.2.2}/pyproject.toml +37 -37
  23. {bitstring-4.2.0b2 → bitstring-4.2.2}/release_notes.txt +1930 -1897
  24. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/test_array.py +928 -928
  25. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/test_bitarray.py +992 -979
  26. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/test_bits.py +981 -981
  27. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/test_bitstore.py +94 -94
  28. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/test_bitstream.py +4196 -4172
  29. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/test_bitstring.py +200 -200
  30. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/test_constbitstream.py +274 -265
  31. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/test_dtypes.py +154 -134
  32. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/test_fp8.py +335 -295
  33. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/test_mxfp.py +440 -441
  34. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/test_scaled_dtypes.py +13 -13
  35. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring/py.typed +0 -0
  36. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring.egg-info/SOURCES.txt +0 -0
  37. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring.egg-info/dependency_links.txt +0 -0
  38. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring.egg-info/requires.txt +0 -0
  39. {bitstring-4.2.0b2 → bitstring-4.2.2}/bitstring.egg-info/top_level.txt +0 -0
  40. {bitstring-4.2.0b2 → bitstring-4.2.2}/setup.cfg +0 -0
  41. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/__init__.py +0 -0
  42. {bitstring-4.2.0b2 → bitstring-4.2.2}/tests/smalltestfile +0 -0
  43. {bitstring-4.2.0b2 → 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.0b2
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,18 +43,16 @@ It has been actively maintained since 2006.
43
43
 
44
44
  News
45
45
  ----
46
- **March 2024**: bitstring 4.2.0b2 released. This is the final beta release before 4.2.
47
-
48
- Install the beta with `pip install bitstring==4.2.0b2`, or use `pip install bitstring` for the latest stable version.
49
-
50
- New in 4.2:
46
+ **May 2024**: bitstring 4.2.2 released.
47
+
48
+ New in version 4.2:
51
49
 
52
50
  * Dropped support for Python 3.7. Minimum version is now 3.8.
53
51
  * A new `Dtype` class can be optionally used to specify types.
54
52
  * The `bitstring.options` object is now the preferred method for changing module options.
55
53
  * New `fromstring` method as another way to create bitstrings from formatted strings.
56
54
  * More types can now be pretty printed.
57
- * A range of 8-bit, 6-bit and even 4-bit float formats added (beta):
55
+ * A range of 8-bit, 6-bit and even 4-bit floating point formats added (beta):
58
56
  * Performance improvements.
59
57
 
60
58
  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.
@@ -81,7 +79,7 @@ Some starting points are given below:
81
79
  * [Quick Reference](https://bitstring.readthedocs.io/en/stable/quick_reference.html)
82
80
  * [Full Reference](https://bitstring.readthedocs.io/en/stable/reference.html)
83
81
 
84
- You can also try out the interactive walkthrough notebook on [binder](https://mybinder.org/v2/gh/scott-griffiths/bitstring/main?labpath=doc%2Fwalkthrough.ipynb).
82
+ There is also an introductory walkthrough notebook on [binder](https://mybinder.org/v2/gh/scott-griffiths/bitstring/main?labpath=doc%2Fwalkthrough.ipynb).
85
83
 
86
84
  Release Notes
87
85
  -------------
@@ -146,12 +144,4 @@ Examples
146
144
 
147
145
 
148
146
 
149
- Credits
150
- -------
151
-
152
- Created in 2006 to help with ad hoc parsing and creation of compressed video files.
153
- Maintained and expanded ever since as it became unexpectedly popular.
154
- Thanks to all those who have contributed ideas and code (and bug reports) over the years.
155
-
156
-
157
147
  <sub>Copyright (c) 2006 - 2024 Scott Griffiths</sub>
@@ -1,133 +1,123 @@
1
-
2
-
3
- ![bitstring](https://raw.githubusercontent.com/scott-griffiths/bitstring/main/doc/bitstring_logo_small.png "bitstring")
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
- [![CI badge](https://github.com/scott-griffiths/bitstring/actions/workflows/.github/workflows/ci.yml/badge.svg)](https://github.com/scott-griffiths/bitstring/actions/workflows/ci.yml)
12
- [![Docs](https://img.shields.io/readthedocs/bitstring?logo=readthedocs&logoColor=white)](https://bitstring.readthedocs.io/en/latest/)
13
- [![Codacy Badge](https://img.shields.io/codacy/grade/8869499b2eed44548fa1a5149dd451f4?logo=codacy)](https://app.codacy.com/gh/scott-griffiths/bitstring/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
14
- [![Dependents (via libraries.io)](https://img.shields.io/librariesio/dependents/pypi/bitstring?logo=libraries.io&logoColor=white)](https://libraries.io/pypi/bitstring)
15
- &nbsp; &nbsp;
16
- [![Pepy Total Downlods](https://img.shields.io/pepy/dt/bitstring?logo=python&logoColor=white&labelColor=blue&color=blue)](https://www.pepy.tech/projects/bitstring)
17
- [![PyPI - Downloads](https://img.shields.io/pypi/dm/bitstring?label=%40&labelColor=blue&color=blue)](https://pypistats.org/packages/bitstring)
18
-
19
-
20
- News
21
- ----
22
- **March 2024**: bitstring 4.2.0b2 released. This is the final beta release before 4.2.
23
-
24
- Install the beta with `pip install bitstring==4.2.0b2`, or use `pip install bitstring` for the latest stable version.
25
-
26
- New in 4.2:
27
-
28
- * Dropped support for Python 3.7. Minimum version is now 3.8.
29
- * A new `Dtype` class can be optionally used to specify types.
30
- * The `bitstring.options` object is now the preferred method for changing module options.
31
- * New `fromstring` method as another way to create bitstrings from formatted strings.
32
- * More types can now be pretty printed.
33
- * A range of 8-bit, 6-bit and even 4-bit float formats added (beta):
34
- * Performance improvements.
35
-
36
- 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.
37
-
38
-
39
- Overview
40
- --------
41
-
42
- * Efficiently store and manipulate binary data in idiomatic Python.
43
- * Create bitstrings from hex, octal, binary, files, formatted strings, bytes, integers and floats of different endiannesses.
44
- * Powerful binary packing and unpacking functions.
45
- * Bit-level slicing, joining, searching, replacing and more.
46
- * Create and manipulate arrays of fixed-length bitstrings.
47
- * Read from and interpret bitstrings as streams of binary data.
48
- * Rich API - chances are that whatever you want to do there's a simple and elegant way of doing it.
49
- * Open source software, released under the MIT licence.
50
-
51
- Documentation
52
- -------------
53
- Extensive documentation for the bitstring module is available.
54
- Some starting points are given below:
55
-
56
- * [Overview](https://bitstring.readthedocs.io/en/stable/index.html)
57
- * [Quick Reference](https://bitstring.readthedocs.io/en/stable/quick_reference.html)
58
- * [Full Reference](https://bitstring.readthedocs.io/en/stable/reference.html)
59
-
60
- You can also try out the interactive walkthrough notebook on [binder](https://mybinder.org/v2/gh/scott-griffiths/bitstring/main?labpath=doc%2Fwalkthrough.ipynb).
61
-
62
- Release Notes
63
- -------------
64
-
65
- 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).
66
-
67
- Examples
68
- --------
69
-
70
- ### Installation
71
-
72
- $ pip install bitstring
73
-
74
- ### Creation
75
-
76
- >>> from bitstring import Bits, BitArray, BitStream, pack
77
- >>> a = BitArray(bin='00101')
78
- >>> b = Bits(a_file_object)
79
- >>> c = BitArray('0xff, 0b101, 0o65, uint6=22')
80
- >>> d = pack('intle16, hex=a, 0b1', 100, a='0x34f')
81
- >>> e = pack('<16h', *range(16))
82
-
83
- ### Different interpretations, slicing and concatenation
84
-
85
- >>> a = BitArray('0x3348')
86
- >>> a.hex, a.bin, a.uint, a.float, a.bytes
87
- ('3348', '0011001101001000', 13128, 0.2275390625, b'3H')
88
- >>> a[10:3:-1].bin
89
- '0101100'
90
- >>> '0b100' + 3*a
91
- BitArray('0x866906690669, 0b000')
92
-
93
- ### Reading data sequentially
94
-
95
- >>> b = BitStream('0x160120f')
96
- >>> b.read(12).hex
97
- '160'
98
- >>> b.pos = 0
99
- >>> b.read('uint12')
100
- 352
101
- >>> b.readlist('uint12, bin3')
102
- [288, '111']
103
-
104
- ### Searching, inserting and deleting
105
-
106
- >>> c = BitArray('0b00010010010010001111') # c.hex == '0x1248f'
107
- >>> c.find('0x48')
108
- (8,)
109
- >>> c.replace('0b001', '0xabc')
110
- >>> c.insert('0b0000', pos=3)
111
- >>> del c[12:16]
112
-
113
- ### Arrays of fixed-length formats
114
-
115
- >>> from bitstring import Array
116
- >>> a = Array('uint7', [9, 100, 3, 1])
117
- >>> a.data
118
- BitArray('0x1390181')
119
- >>> a[::2] *= 5
120
- >>> a
121
- Array('uint7', [45, 100, 15, 1])
122
-
123
-
124
-
125
- Credits
126
- -------
127
-
128
- Created in 2006 to help with ad hoc parsing and creation of compressed video files.
129
- Maintained and expanded ever since as it became unexpectedly popular.
130
- Thanks to all those who have contributed ideas and code (and bug reports) over the years.
131
-
132
-
133
- <sub>Copyright (c) 2006 - 2024 Scott Griffiths</sub>
1
+
2
+
3
+ ![bitstring](https://raw.githubusercontent.com/scott-griffiths/bitstring/main/doc/bitstring_logo_small.png "bitstring")
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
+ [![CI badge](https://github.com/scott-griffiths/bitstring/actions/workflows/.github/workflows/ci.yml/badge.svg)](https://github.com/scott-griffiths/bitstring/actions/workflows/ci.yml)
12
+ [![Docs](https://img.shields.io/readthedocs/bitstring?logo=readthedocs&logoColor=white)](https://bitstring.readthedocs.io/en/latest/)
13
+ [![Codacy Badge](https://img.shields.io/codacy/grade/8869499b2eed44548fa1a5149dd451f4?logo=codacy)](https://app.codacy.com/gh/scott-griffiths/bitstring/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
14
+ [![Dependents (via libraries.io)](https://img.shields.io/librariesio/dependents/pypi/bitstring?logo=libraries.io&logoColor=white)](https://libraries.io/pypi/bitstring)
15
+ &nbsp; &nbsp;
16
+ [![Pepy Total Downlods](https://img.shields.io/pepy/dt/bitstring?logo=python&logoColor=white&labelColor=blue&color=blue)](https://www.pepy.tech/projects/bitstring)
17
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/bitstring?label=%40&labelColor=blue&color=blue)](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>