bitstring 4.1.4__tar.gz → 4.2.0b1__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.1.4 → bitstring-4.2.0b1}/LICENSE +21 -21
- {bitstring-4.1.4 → bitstring-4.2.0b1}/MANIFEST.in +8 -8
- {bitstring-4.1.4/bitstring.egg-info → bitstring-4.2.0b1}/PKG-INFO +18 -16
- {bitstring-4.1.4 → bitstring-4.2.0b1}/README.md +132 -130
- bitstring-4.2.0b1/bitstring/__init__.py +263 -0
- {bitstring-4.1.4 → bitstring-4.2.0b1}/bitstring/__main__.py +49 -49
- {bitstring-4.1.4 → bitstring-4.2.0b1}/bitstring/array_.py +740 -740
- bitstring-4.1.4/bitstring/bitarray.py → bitstring-4.2.0b1/bitstring/bitarray_.py +576 -621
- {bitstring-4.1.4 → bitstring-4.2.0b1}/bitstring/bits.py +1789 -2095
- bitstring-4.2.0b1/bitstring/bitstore.py +247 -0
- {bitstring-4.1.4 → bitstring-4.2.0b1}/bitstring/bitstore_helpers.py +252 -337
- {bitstring-4.1.4 → bitstring-4.2.0b1}/bitstring/bitstream.py +686 -688
- bitstring-4.1.4/bitstring/options.py → bitstring-4.2.0b1/bitstring/bitstring_options.py +89 -72
- bitstring-4.2.0b1/bitstring/dtypes.py +244 -0
- {bitstring-4.1.4 → bitstring-4.2.0b1}/bitstring/exceptions.py +24 -23
- {bitstring-4.1.4 → bitstring-4.2.0b1}/bitstring/fp8.py +93 -93
- {bitstring-4.1.4 → bitstring-4.2.0b1}/bitstring/methods.py +98 -102
- bitstring-4.2.0b1/bitstring/utils.py +235 -0
- {bitstring-4.1.4 → bitstring-4.2.0b1/bitstring.egg-info}/PKG-INFO +18 -16
- {bitstring-4.1.4 → bitstring-4.2.0b1}/bitstring.egg-info/SOURCES.txt +3 -2
- bitstring-4.2.0b1/bitstring.egg-info/requires.txt +1 -0
- {bitstring-4.1.4 → bitstring-4.2.0b1}/pyproject.toml +37 -37
- {bitstring-4.1.4 → bitstring-4.2.0b1}/release_notes.txt +1870 -1856
- {bitstring-4.1.4 → bitstring-4.2.0b1}/tests/test_array.py +915 -880
- {bitstring-4.1.4 → bitstring-4.2.0b1}/tests/test_bitarray.py +978 -971
- {bitstring-4.1.4 → bitstring-4.2.0b1}/tests/test_bits.py +974 -836
- {bitstring-4.1.4 → bitstring-4.2.0b1}/tests/test_bitstore.py +93 -93
- {bitstring-4.1.4 → bitstring-4.2.0b1}/tests/test_bitstream.py +4174 -4183
- {bitstring-4.1.4 → bitstring-4.2.0b1}/tests/test_bitstring.py +200 -220
- {bitstring-4.1.4 → bitstring-4.2.0b1}/tests/test_constbitstream.py +247 -249
- bitstring-4.2.0b1/tests/test_dtypes.py +86 -0
- {bitstring-4.1.4 → bitstring-4.2.0b1}/tests/test_fp8.py +220 -220
- bitstring-4.1.4/bitstring/__init__.py +0 -199
- bitstring-4.1.4/bitstring/bitstore.py +0 -165
- bitstring-4.1.4/bitstring/dtypes.py +0 -118
- bitstring-4.1.4/bitstring/utils.py +0 -273
- bitstring-4.1.4/bitstring.egg-info/requires.txt +0 -1
- {bitstring-4.1.4 → bitstring-4.2.0b1}/bitstring/py.typed +0 -0
- {bitstring-4.1.4 → bitstring-4.2.0b1}/bitstring.egg-info/dependency_links.txt +0 -0
- {bitstring-4.1.4 → bitstring-4.2.0b1}/bitstring.egg-info/top_level.txt +0 -0
- {bitstring-4.1.4 → bitstring-4.2.0b1}/setup.cfg +0 -0
- {bitstring-4.1.4 → bitstring-4.2.0b1}/tests/__init__.py +0 -0
- {bitstring-4.1.4 → bitstring-4.2.0b1}/tests/smalltestfile +0 -0
- {bitstring-4.1.4 → bitstring-4.2.0b1}/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.
|
|
3
|
+
Version: 4.2.0b1
|
|
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
|
|
@@ -10,42 +10,44 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: Operating System :: OS Independent
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.8
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
18
|
Classifier: License :: OSI Approved :: MIT License
|
|
19
19
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
-
Requires-Python: >=3.
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: bitarray<3.0.0,>=2.
|
|
23
|
+
Requires-Dist: bitarray<3.0.0,>=2.9.0
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|

|
|
28
28
|
|
|
29
|
-
**bitstring** is a Python module to help make the creation and analysis of binary data as simple and efficient as possible.
|
|
29
|
+
**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.
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
It has been maintained since 2006 and now has many millions of downloads per year.
|
|
31
|
+
It has been actively maintained since 2006.
|
|
33
32
|
|
|
34
33
|
|
|
35
34
|
|
|
36
35
|
[](https://github.com/scott-griffiths/bitstring/actions/workflows/ci.yml)
|
|
37
|
-
[](https://bitstring.readthedocs.io/en/latest/)
|
|
38
|
-
[](https://app.codacy.com/gh/scott-griffiths/bitstring/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
39
|
-
[](https://bitstring.readthedocs.io/en/latest/)
|
|
37
|
+
[](https://app.codacy.com/gh/scott-griffiths/bitstring/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
38
|
+
[](https://libraries.io/pypi/bitstring)
|
|
39
|
+
|
|
40
|
+
[](https://pypistats.org/packages/bitstring)
|
|
41
|
+
[](https://pypistats.org/packages/bitstring)
|
|
42
|
+
|
|
41
43
|
|
|
42
44
|
News
|
|
43
45
|
----
|
|
44
|
-
**November 2023**: bitstring 4.1.
|
|
46
|
+
**29th November 2023**: bitstring 4.1.4 released. Version 4.1 is a large update in terms of how much of the code has changed.
|
|
45
47
|
|
|
46
|
-
* Speed increased with bitarray dependency.
|
|
47
48
|
* New Array class for homogeneous data.
|
|
48
49
|
* Support for 8-bit floating point values.
|
|
50
|
+
* Speed increased with bitarray dependency.
|
|
49
51
|
|
|
50
52
|
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.
|
|
51
53
|
|
|
@@ -146,9 +148,9 @@ The 700+ unit tests should all pass. They can be run from the root of the projec
|
|
|
146
148
|
Credits
|
|
147
149
|
-------
|
|
148
150
|
|
|
149
|
-
Created
|
|
150
|
-
Maintained and expanded ever since as it became unexpectedly popular.
|
|
151
|
-
and code (and bug reports) over the years.
|
|
151
|
+
Created in 2006 to help with ad hoc parsing and creation of compressed video files.
|
|
152
|
+
Maintained and expanded ever since as it became unexpectedly popular.
|
|
153
|
+
Thanks to all those who have contributed ideas and code (and bug reports) over the years.
|
|
152
154
|
|
|
153
155
|
|
|
154
156
|
<sub>Copyright (c) 2006 - 2023 Scott Griffiths</sub>
|
|
@@ -1,130 +1,132 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
**bitstring** is a Python module to help make the creation and analysis of binary data as simple and efficient as possible.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
[
|
|
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://pypistats.org/packages/bitstring)
|
|
17
|
+
[](https://pypistats.org/packages/bitstring)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
News
|
|
21
|
+
----
|
|
22
|
+
**29th November 2023**: bitstring 4.1.4 released. Version 4.1 is a large update in terms of how much of the code has changed.
|
|
23
|
+
|
|
24
|
+
* New Array class for homogeneous data.
|
|
25
|
+
* Support for 8-bit floating point values.
|
|
26
|
+
* Speed increased with bitarray dependency.
|
|
27
|
+
|
|
28
|
+
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.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Overview
|
|
32
|
+
--------
|
|
33
|
+
|
|
34
|
+
* Efficiently store and manipulate binary data in idiomatic Python.
|
|
35
|
+
* Create bitstrings from hex, octal, binary, files, formatted strings, bytes, integers and floats of different endiannesses.
|
|
36
|
+
* Powerful binary packing and unpacking functions.
|
|
37
|
+
* Bit-level slicing, joining, searching, replacing and more.
|
|
38
|
+
* Create and manipulate arrays of fixed-length bitstrings.
|
|
39
|
+
* Read from and interpret bitstrings as streams of binary data.
|
|
40
|
+
* Rich API - chances are that whatever you want to do there's a simple and elegant way of doing it.
|
|
41
|
+
* Open source software, released under the MIT licence.
|
|
42
|
+
|
|
43
|
+
Documentation
|
|
44
|
+
-------------
|
|
45
|
+
Extensive documentation for the bitstring module is available.
|
|
46
|
+
Some starting points are given below:
|
|
47
|
+
|
|
48
|
+
* [Overview](https://bitstring.readthedocs.io/en/stable/index.html)
|
|
49
|
+
* [Quick Reference](https://bitstring.readthedocs.io/en/stable/quick_reference.html)
|
|
50
|
+
* [Full Reference](https://bitstring.readthedocs.io/en/stable/reference.html)
|
|
51
|
+
|
|
52
|
+
You can also try out the interactive walkthrough notebook on [binder](https://mybinder.org/v2/gh/scott-griffiths/bitstring/main?labpath=doc%2Fwalkthrough.ipynb).
|
|
53
|
+
|
|
54
|
+
Release Notes
|
|
55
|
+
-------------
|
|
56
|
+
|
|
57
|
+
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).
|
|
58
|
+
|
|
59
|
+
Examples
|
|
60
|
+
--------
|
|
61
|
+
|
|
62
|
+
### Installation
|
|
63
|
+
|
|
64
|
+
$ pip install bitstring
|
|
65
|
+
|
|
66
|
+
### Creation
|
|
67
|
+
|
|
68
|
+
>>> from bitstring import Bits, BitArray, BitStream, pack
|
|
69
|
+
>>> a = BitArray(bin='00101')
|
|
70
|
+
>>> b = Bits(a_file_object)
|
|
71
|
+
>>> c = BitArray('0xff, 0b101, 0o65, uint6=22')
|
|
72
|
+
>>> d = pack('intle16, hex=a, 0b1', 100, a='0x34f')
|
|
73
|
+
>>> e = pack('<16h', *range(16))
|
|
74
|
+
|
|
75
|
+
### Different interpretations, slicing and concatenation
|
|
76
|
+
|
|
77
|
+
>>> a = BitArray('0x3348')
|
|
78
|
+
>>> a.hex, a.bin, a.uint, a.float, a.bytes
|
|
79
|
+
('3348', '0011001101001000', 13128, 0.2275390625, b'3H')
|
|
80
|
+
>>> a[10:3:-1].bin
|
|
81
|
+
'0101100'
|
|
82
|
+
>>> '0b100' + 3*a
|
|
83
|
+
BitArray('0x866906690669, 0b000')
|
|
84
|
+
|
|
85
|
+
### Reading data sequentially
|
|
86
|
+
|
|
87
|
+
>>> b = BitStream('0x160120f')
|
|
88
|
+
>>> b.read(12).hex
|
|
89
|
+
'160'
|
|
90
|
+
>>> b.pos = 0
|
|
91
|
+
>>> b.read('uint12')
|
|
92
|
+
352
|
|
93
|
+
>>> b.readlist('uint12, bin3')
|
|
94
|
+
[288, '111']
|
|
95
|
+
|
|
96
|
+
### Searching, inserting and deleting
|
|
97
|
+
|
|
98
|
+
>>> c = BitArray('0b00010010010010001111') # c.hex == '0x1248f'
|
|
99
|
+
>>> c.find('0x48')
|
|
100
|
+
(8,)
|
|
101
|
+
>>> c.replace('0b001', '0xabc')
|
|
102
|
+
>>> c.insert('0b0000', pos=3)
|
|
103
|
+
>>> del c[12:16]
|
|
104
|
+
|
|
105
|
+
### Arrays of fixed-length formats
|
|
106
|
+
|
|
107
|
+
>>> from bitstring import Array
|
|
108
|
+
>>> a = Array('uint7', [9, 100, 3, 1])
|
|
109
|
+
>>> a.data
|
|
110
|
+
BitArray('0x1390181')
|
|
111
|
+
>>> a[::2] *= 5
|
|
112
|
+
>>> a
|
|
113
|
+
Array('uint7', [45, 100, 15, 1])
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
Unit Tests
|
|
117
|
+
----------
|
|
118
|
+
|
|
119
|
+
The 700+ unit tests should all pass. They can be run from the root of the project with
|
|
120
|
+
|
|
121
|
+
python -m unittest
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
Credits
|
|
125
|
+
-------
|
|
126
|
+
|
|
127
|
+
Created in 2006 to help with ad hoc parsing and creation of compressed video files.
|
|
128
|
+
Maintained and expanded ever since as it became unexpectedly popular.
|
|
129
|
+
Thanks to all those who have contributed ideas and code (and bug reports) over the years.
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
<sub>Copyright (c) 2006 - 2023 Scott Griffiths</sub>
|