From 1f3be2584cbd805b9a67d37c481c00a1649e4495 Mon Sep 17 00:00:00 2001 From: Scott Griffiths Date: Tue, 16 Jan 2024 18:21:27 +0000 Subject: [PATCH] Fixes to docs. --- bitformat/py.typed | 0 doc/conf.py | 2 +- doc/index.rst | 18 +++++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 bitformat/py.typed diff --git a/bitformat/py.typed b/bitformat/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/doc/conf.py b/doc/conf.py index 9d1a3bb..a7b7f0f 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -35,5 +35,5 @@ "banner_hiding": "permanent", "show_theme_credit": False, "globaltoc_maxdepth": 2, - "source_url": 'https://github.com/scott-griffiths/bitstring/', + "source_url": 'https://github.com/scott-griffiths/bitformat/', } diff --git a/doc/index.rst b/doc/index.rst index e93b7ca..c94e85c 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -4,7 +4,23 @@ `bitformat `_ is a Python module for creating and parsing file formats, especially at the bit rather than byte level. -It is intended to complement the **bitstring** module, but is currently at a planning stage and is not yet recommended for use. +It is intended to complement the `bitstring `_ module, but is currently at a planning stage and is not yet recommended for use. + +---- + +The `bitformat` module provides the ``Format`` class which is used to define how to create and parse binary formats. :: + + from bitformat import Format, Dtype, Bits + + f1 = Format(Bits('0xabc')) # A bit literal (12 bits long) + f2 = Format(Dtype('u5')) # A 5-bit unsigned integer + + f3 = Format([f1, f2, f2]) # A format made of other formats + + d = f3.pack(3, 10) # A Bits object packed with the values 3 and 10 + f3.parse(d) # returns 3, 10 + + These docs are styled using the `Piccolo theme `_.