dom_toml.encoder¶
Source code: dom_toml/encoder.py
Dom’s custom encoder for Tom’s Obvious, Minimal Language.
New in version 0.2.0.
Classes:
|
TOML Encoder with adjustable array separator. |
|
TOML encoder which wraps long lists onto multiple lines and adds a blank line before arrays of tables. |
|
TOML Encoder with support for numpy types. |
|
TOML Encoder with pathlib support. |
-
class
TomlArraySeparatorEncoder(preserve=True, multiline_strings=False, separator=',')[source]¶ Bases:
TomlEncoderTOML Encoder with adjustable array separator.
- Parameters
New in version 2.0.0.
Methods:
format_inline_array(obj, nest_level)Format an inline array.
-
class
TomlEncoder(preserve=True, multiline_strings=False)[source]¶ Bases:
objectTOML encoder which wraps long lists onto multiple lines and adds a blank line before arrays of tables.
Changed in version 0.2.0: Moved from
__init__.pyChanged in version 2.0.0: Added
allow_multilineargument.Methods:
dumps(table, *, name[, inside_aot])Serialise the given table.
format_decimal(obj)Format a decimal value.
format_inline_array(obj, nest_level)Format an inline array.
format_inline_table(obj)Format an inline table.
format_key_part(part)Format part of a key.
format_literal(obj, *[, nest_level])Format a literal value.
format_string(s, *, allow_multiline)Format a string.
-
dumps(table, *, name, inside_aot=False)[source]¶ Serialise the given table.
- Parameters
- Return type
New in version 2.0.0.
-
-
class
TomlNumpyEncoder(preserve=True, multiline_strings=False)[source]¶ Bases:
TomlEncoderTOML Encoder with support for numpy types.
New in version 2.0.0.
Methods:
format_literal(obj, *[, nest_level])Format a literal value.
-
class
TomlPathlibEncoder(preserve=True, multiline_strings=False)[source]¶ Bases:
TomlEncoderTOML Encoder with pathlib support.
New in version 2.0.0.
Methods:
format_literal(obj, *[, nest_level])Format a literal value.