Skip to content

Commit c8c7f74

Browse files
Updating release notes for 4.2.2.
Adding some decorative line breaks in the documentation.
1 parent 64524f5 commit c8c7f74

9 files changed

Lines changed: 43 additions & 6 deletions

File tree

doc/array.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ Array
133133

134134
* The ``'b'`` and ``'B'`` type codes need to be preceded by an endianness character even though it makes no difference which one you use as they are only 1 byte long.
135135

136+
----
136137

137138
Methods
138139
-------
@@ -328,6 +329,7 @@ Methods
328329

329330
Each packed element of the Array is converted to an ordinary Python object such as a ``float`` or an ``int`` depending on the Array's format, and returned in a Python list.
330331

332+
----
331333

332334
Special Methods
333335
---------------
@@ -496,6 +498,7 @@ Python language operators
496498

497499
``del[start:end:step]``
498500

501+
----
499502

500503
Properties
501504
----------

doc/bitarray.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ BitArray
1010

1111
A :class:`BitArray` is a mutable :class:`Bits`, and so the one thing all of the methods listed here have in common is that they can modify the contents of the bitstring.
1212

13+
----
14+
1315
Methods
1416
-------
1517

@@ -181,6 +183,7 @@ Methods
181183
>>> s.bin
182184
'1010101010101010'
183185

186+
----
184187

185188
Properties
186189
----------
@@ -214,7 +217,7 @@ When used as a setter without a new length the value must fit into the current
214217
Other types also have restrictions on their lengths, and using an invalid length will raise a :exc:`CreationError`.
215218
For example trying to create a 20 bit floating point number or a two bit bool will raise this exception.
216219

217-
220+
----
218221

219222
Special Methods
220223
---------------

doc/bits.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ The ``Bits`` class is the simplest type in the bitstring module, and represents
3737

3838
In the methods below we use ``BitsType`` to indicate that any of the types that can auto initialise can be used.
3939

40+
----
4041

4142
Methods
4243
-------
@@ -308,6 +309,7 @@ Methods
308309
s = bitstring.pack('uint10, hex, int13, 0b11', 130, '3d', -23)
309310
a, b, c, d = s.unpack('uint10, hex, int13, bin2')
310311

312+
----
311313

312314
Properties
313315
----------
@@ -460,6 +462,7 @@ Note that the ``bin``, ``oct``, ``hex``, ``int``, ``uint`` and ``float`` propert
460462

461463
Property for the byte-wise native-endian unsigned base-2 integer representation of the bitstring.
462464

465+
----
463466

464467
Special Methods
465468
---------------

doc/constbitstream.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ ConstBitStream
99

1010
A :class:`ConstBitStream` is a :class:`Bits` with added methods and properties that allow it to be parsed as a stream of bits.
1111

12+
----
13+
1214
Reading and parsing
1315
---------------------
1416

@@ -62,6 +64,7 @@ In addition to the read methods there are matching peek methods. These are ident
6264
s.find('0x47')
6365

6466

67+
----
6568

6669
Methods
6770
-------
@@ -164,6 +167,8 @@ Methods
164167
>>> s.readto('0x47', bytealigned=True)
165168
ConstBitStream('0x04050647')
166169

170+
----
171+
167172
Properties
168173
----------
169174

doc/dtypes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ It can however be advantageous to to create `Dtype` objects directly for efficie
2323

2424
If you need to use the `scale` parameter then there is no way to specify this in the format token string, so you must directly use a `Dtype` object.
2525

26+
----
2627

2728
Methods
2829
-------
@@ -45,6 +46,7 @@ Parse a bitstring to find its value. The *b* parameter should be a bitstring of
4546
>>> d.parse('0b0001010101') # Equivalent to: Bits('0b0001010101').u10
4647
85
4748

49+
----
4850

4951
Properties
5052
----------

doc/functions.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Finally it is also possible just to use a keyword as a token::
8686

8787
s = bitstring.pack('hello, world', world='0x123', hello='0b110')
8888

89+
----
8990

9091
Options
9192
-------
@@ -227,6 +228,7 @@ See https://no-color.org for more information.
227228

228229
The terminal colours can also be turned off by setting ``bitstring.options.no_color`` to ``True``.
229230

231+
----
230232

231233
Command Line Usage
232234
------------------
@@ -247,6 +249,7 @@ The bitstring module can be called from the command line to perform simple opera
247249

248250
Command-line parameters are concatenated and a bitstring created from them. If the final parameter is either an interpretation string or ends with a ``.`` followed by an interpretation string then that interpretation of the bitstring will be used when printing it. If no interpretation is given then the bitstring is just printed.
249251

252+
----
250253

251254
Exceptions
252255
----------

doc/interpretation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ For example if you have initialised a bitstring from a 10 GiB file object and as
1616

1717
If you're in an interactive session then the pretty-print method :meth:`~Bits.pp` can be useful as it will only convert the bitstring one chunk at a time for display.
1818

19+
----
1920

2021
Properties
2122
----------

doc/introduction.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,17 @@ To summarise when to use each class:
3333

3434
The :class:`Bits` class is the base class of the other three class. This means that ``isinstance(s, Bits)`` will be true if ``s`` is an instance of any of the four classes.
3535

36+
----
3637

37-
``Bits(auto, /, length: Optional[int], offset: Optional[int], **kwargs)``
38+
Constructing bitstrings
39+
-----------------------
3840

3941
When initialising a bitstring you need to specify at most one initialiser.
40-
This can either be the first parameter in the constructor ('auto' initialisation, described below), or using a keyword argument for a data type:
42+
This can either be the first parameter in the constructor ('auto' initialisation, described below), or using a keyword argument for a data type.
43+
44+
``Bits(auto, /, length: Optional[int], offset: Optional[int], **kwargs)``
45+
46+
Some of the keyword arguments that can be used are:
4147

4248
* ``bytes`` : A ``bytes`` object, for example read from a binary file.
4349
* ``hex``, ``oct``, ``bin``: Hexadecimal, octal or binary strings.
@@ -57,7 +63,7 @@ The data type name can be combined with its length if appropriate, or the length
5763
For example::
5864

5965
a = Bits(hex='deadbeef')
60-
b = BitArray(float32=100.25) # or = BitArray(float=100.25, length=32)
66+
b = BitArray(f32=100.25) # or = BitArray(float=100.25, length=32)
6167
c = ConstBitStream(filename='a_big_file')
6268
d = Bits(u12=105)
6369
e = BitArray(bool=True)
@@ -67,6 +73,8 @@ Note that some types need a length to be specified, some don't need one, and oth
6773
Another way to create a bitstring is via the ``pack`` function, which packs multiple values according to a given format.
6874
See the entry on :func:`pack` for more information.
6975

76+
----
77+
7078
.. _auto_init:
7179

7280
The auto initialiser
@@ -140,7 +148,7 @@ Integers won't be auto promoted, but instead will raise a ``TypeError``::
140148
It's just a union of types rather than an actual class (though it's documented here as a class as I could find no alternative).
141149
It's not user accessible, but is just a shorthand way of saying any of the above types.
142150

143-
151+
----
144152

145153
Keyword initialisers
146154
--------------------

release_notes.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
bitstring module version history
33
--------------------------------
44

5+
-----------------------
6+
May 2024: version 4.2.2
7+
-----------------------
8+
A couple more minor bug fixes.
9+
10+
* Sometimes a ValueError was being raised instead of a ReadError. Bug #325.
11+
* Initialising a bitstring from None now raises a TypeError rather than generating
12+
an empty bitstring. Bug #323.
13+
514
-------------------------
615
April 2024: version 4.2.1
716
-------------------------
@@ -44,7 +53,7 @@ Other changes:
4453

4554
* New fromstring method as another way to create bitstrings from formatted strings.
4655
Instead of relying on the `auto` parameter you can now optionally use `fromstring`.
47-
>>> s1 = BitArray('u24=1000') # This is still fine
56+
>>> s1 = BitArray('u24=1000') # This is still fine.
4857
>>> s2 = BitArray.fromstring('u24=1000') # This may be clearer and more efficient.
4958

5059
* More types can now be pretty printed. For example integer and float formats can be used.

0 commit comments

Comments
 (0)