Skip to main content

review.formats.dump

review.formats.dump(kind, data)

Write a file of kind as TOML text: the one writer of all review files.

format = 1 comes first (it is added if data lacks it), then the scalar keys in the order of FIELDS, then every array of tables in that order, each table preceded by a blank line. Optional keys that data does not hold are left out. The same data always gives the same text, which ends with one newline.

Parameters

Name Type Description Default
kind str One of KINDS. required
data dict[str, object] The content, validated like load does. required

Returns

Name Type Description
str str The TOML text.

Raises

Name Type Description
ConfigurationError If data does not fit the table of kind.

Examples

from babregen.review.formats import dump

print(dump("gate-seal", {
    "sealed_at": "2026-01-01T00:00:00Z", "gate_sha256": "a" * 64,
    "survivors": 3, "drawn": 1, "key_sha256": "b" * 64,
    "shown_sha256": "c" * 64, "first_sha256": "d" * 64,
    "second_sha256": "e" * 64, "assignment_sha256": "f" * 64,
}))
format = 1
sealed_at = "2026-01-01T00:00:00Z"
gate_sha256 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
survivors = 3
drawn = 1
key_sha256 = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
shown_sha256 = "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
first_sha256 = "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
second_sha256 = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
assignment_sha256 = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"