From 106ef532fcb72af671383a8e1f876808a18fb83f Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 2 Nov 2022 11:09:50 +0000 Subject: [PATCH] docs: Improve Python code snippet formatting in GVariant Specification Signed-off-by: Philip Withnall --- docs/reference/glib/gvariant-specification-1.0.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/reference/glib/gvariant-specification-1.0.rst b/docs/reference/glib/gvariant-specification-1.0.rst index 0b74a469b..56a1940c4 100644 --- a/docs/reference/glib/gvariant-specification-1.0.rst +++ b/docs/reference/glib/gvariant-specification-1.0.rst @@ -1219,19 +1219,23 @@ table, given as an array of 4-tuples. .. code-block:: python - def generate_table (items): + def generate_table(items): (i, a, b, c) = (-1, 0, 0, 0) table = [] + for (d, e) in items: if d <= b: (a, b, c) = (a, b, align(c, d)) # merge rule #1 else: (a, b, c) = (a + align(c, b), d, 0) # merge rule #2 + table.append ((i, a, b, c)) + if e == -1: # item is not fixed-sized (i, a, b, c) = (i + 1, 0, 0, 0) else: (a, b, c) = (a, b, c + e) # merge rule #3 + return table It is assumed that ``align(a, b)`` computes :math:`(a ↑ b)`.