Skip to content

Commit 1f3be25

Browse files
Fixes to docs.
1 parent c460abf commit 1f3be25

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

bitformat/py.typed

Whitespace-only changes.

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@
3535
"banner_hiding": "permanent",
3636
"show_theme_credit": False,
3737
"globaltoc_maxdepth": 2,
38-
"source_url": 'https://github.com/scott-griffiths/bitstring/',
38+
"source_url": 'https://github.com/scott-griffiths/bitformat/',
3939
}

doc/index.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,23 @@
44

55
`bitformat <https://github.com/scott-griffiths/bitformat/>`_ is a Python module for creating and parsing file formats, especially at the bit rather than byte level.
66

7-
It is intended to complement the **bitstring** module, but is currently at a planning stage and is not yet recommended for use.
7+
It is intended to complement the `bitstring <https://github.com/scott-griffiths/bitstring>`_ module, but is currently at a planning stage and is not yet recommended for use.
8+
9+
----
10+
11+
The `bitformat` module provides the ``Format`` class which is used to define how to create and parse binary formats. ::
12+
13+
from bitformat import Format, Dtype, Bits
14+
15+
f1 = Format(Bits('0xabc')) # A bit literal (12 bits long)
16+
f2 = Format(Dtype('u5')) # A 5-bit unsigned integer
17+
18+
f3 = Format([f1, f2, f2]) # A format made of other formats
19+
20+
d = f3.pack(3, 10) # A Bits object packed with the values 3 and 10
21+
f3.parse(d) # returns 3, 10
22+
23+
824

925

1026
These docs are styled using the `Piccolo theme <https://github.com/piccolo-orm/piccolo_theme>`_.

0 commit comments

Comments
 (0)