Skip to content

_parser

DEPRECATED_DEFAULT

Sentinel to be used as default arg during deprecation period of TOMLDecodeError's free-form arguments.

Flags

Flags that map to parsed keys/namespaces.

TOMLDecodeError

Bases: ValueError

An error raised if a document is not valid TOML.

Adds the following attributes to ValueError: msg: The unformatted error message doc: The TOML document being parsed pos: The index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos

load(__fp, *, parse_float=float)

Parse TOML from a binary file object.

loads(__s, *, parse_float=float)

Parse TOML from a string.

make_safe_parse_float(parse_float)

A decorator to make parse_float safe.

parse_float must not return dicts or lists, because these types would be mixed with parsed TOML tables and arrays, thus confusing the parser. The returned decorated callable raises ValueError instead of returning illegal types.