mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-02 02:40:07 +02:00
docs: Improve Python code snippet formatting in GVariant Specification
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
fa823ea3b4
commit
106ef532fc
@ -1219,19 +1219,23 @@ table, given as an array of 4-tuples.
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
def generate_table (items):
|
def generate_table(items):
|
||||||
(i, a, b, c) = (-1, 0, 0, 0)
|
(i, a, b, c) = (-1, 0, 0, 0)
|
||||||
table = []
|
table = []
|
||||||
|
|
||||||
for (d, e) in items:
|
for (d, e) in items:
|
||||||
if d <= b:
|
if d <= b:
|
||||||
(a, b, c) = (a, b, align(c, d)) # merge rule #1
|
(a, b, c) = (a, b, align(c, d)) # merge rule #1
|
||||||
else:
|
else:
|
||||||
(a, b, c) = (a + align(c, b), d, 0) # merge rule #2
|
(a, b, c) = (a + align(c, b), d, 0) # merge rule #2
|
||||||
|
|
||||||
table.append ((i, a, b, c))
|
table.append ((i, a, b, c))
|
||||||
|
|
||||||
if e == -1: # item is not fixed-sized
|
if e == -1: # item is not fixed-sized
|
||||||
(i, a, b, c) = (i + 1, 0, 0, 0)
|
(i, a, b, c) = (i + 1, 0, 0, 0)
|
||||||
else:
|
else:
|
||||||
(a, b, c) = (a, b, c + e) # merge rule #3
|
(a, b, c) = (a, b, c + e) # merge rule #3
|
||||||
|
|
||||||
return table
|
return table
|
||||||
|
|
||||||
It is assumed that ``align(a, b)`` computes :math:`(a ↑ b)`.
|
It is assumed that ``align(a, b)`` computes :math:`(a ↑ b)`.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user