Skip to main content

review.formats.Field

review.formats.Field(
    key,
    type,
    required=True,
    vocab=(),
    blank=False,
    oneline=False,
    pattern='',
    time=False,
    items=(),
)

One key of a file kind.

Attributes

Name Type Description
key str The TOML key.
type str text, int, float, bool, texts (an array of strings) or table (an array of tables whose keys are items).
required bool Whether the key must be present. A required table holds at least one entry.
vocab tuple[str, …] The allowed words of a text; empty if any text is allowed.
blank bool Whether the empty string is allowed. A text that is present is otherwise not empty, and none is only white space.
oneline bool Whether a text must stay on one line.
pattern str A regular expression the whole text must match (a hash, a time); empty if none.
time bool Whether the text is a time stamp, which must also be a date of the calendar (see parse_time).
items tuple[Field, …] The keys of the tables of a table.

Examples

from babregen.review.formats import FIELDS

print([field.key for field in FIELDS["proposal-check"]])
['format', 'run', 'checked_by', 'proposal_sha256', 'agrees', 'category', 'comment']