dom_toml¶
Source code: dom_toml/__init__.py
Dom’s tools for Tom’s Obvious, Minimal Language.
Functions:
|
Writes out |
|
Convert |
|
Parse TOML from the given file. |
|
Parse the given string as TOML. |
-
dump(data, filename, encoder=<class 'TomlEncoder'>)[source]¶ Writes out
dataas TOML to the given file.- Parameters
filename (
Union[str,Path,PathLike]) – The filename to write to.encoder (
Union[Type[TomlEncoder],TomlEncoder]) – TheTomlEncoderto use for constructing the output string. Defaultdom_toml.encoder.TomlEncoder.
- Return type
- Returns
A string containing the
TOMLcorresponding todata.
Changed in version 2.0.0:
encodermust now be aTomlEncodertype or instance.
-
dumps(data, encoder=<class 'TomlEncoder'>)[source]¶ Convert
datato a TOML string.- Parameters
encoder (
Union[Type[TomlEncoder],TomlEncoder]) – TheTomlEncoderto use for constructing the output string. Defaultdom_toml.encoder.TomlEncoder.
- Return type
- Returns
A string containing the
TOMLcorresponding todata.
Changed in version 2.0.0:
encodermust now be aTomlEncodertype or instance.
-
load(filename, decoder=<class 'TomlDecoder'>)[source]¶ Parse TOML from the given file.
- Parameters
filename (
Union[str,Path,PathLike]) – The filename to read from to.decoder (
Union[Type[TomlDecoder],TomlDecoder]) – TheTomlEncoderto use for constructing the output string. Defaultdom_toml.decoder.TomlDecoder.
- Return type
- Returns
A mapping containing the
TOMLdata.
Changed in version 2.0.0:
decodermust now be aTomlDecodertype or instance.
-
loads(s, decoder=<class 'TomlDecoder'>)[source]¶ Parse the given string as TOML.
- Parameters
s (
str)decoder (
Union[Type[TomlDecoder],TomlDecoder]) – TheTomlEncoderto use for constructing the output string. Defaultdom_toml.decoder.TomlDecoder.
- Return type
- Returns
A mapping containing the
TOMLdata.
Changed in version 2.0.0:
decodermust now be aTomlDecodertype or instance.