abx_spec_config.toml_util

Module Contents

Classes

JSONSchemaWithLambdas

Encode lambda functions in default values properly. Usage:

CustomTOMLEncoder

Custom TomlEncoder to work around https://github.com/uiri/toml’s many encoding bugs. More info: https://github.com/fabiocaccamo/python-benedict/issues/439

Functions

load_ini_value

Convert lax INI values into strict TOML-compliant (JSON) values

convert

Convert a string of INI config into its TOML equivalent (warning: strips comments)

better_toml_dump_str

Data

JSONValue

TOML_HEADER

API

abx_spec_config.toml_util.JSONValue[source]

None

abx_spec_config.toml_util.TOML_HEADER = <Multiline-String>[source]
abx_spec_config.toml_util.load_ini_value(val: str) abx_spec_config.toml_util.JSONValue[source]

Convert lax INI values into strict TOML-compliant (JSON) values

abx_spec_config.toml_util.convert(ini_str: str) str[source]

Convert a string of INI config into its TOML equivalent (warning: strips comments)

class abx_spec_config.toml_util.JSONSchemaWithLambdas[source]

Bases: pydantic.json_schema.GenerateJsonSchema

Encode lambda functions in default values properly. Usage:

json.dumps(value, encoder=JSONSchemaWithLambdas())

encode_default(default: Any) Any[source]
abx_spec_config.toml_util.better_toml_dump_str(val: Any) str[source]
class abx_spec_config.toml_util.CustomTOMLEncoder(**kwargs)[source]

Bases: toml.encoder.TomlEncoder

Custom TomlEncoder to work around https://github.com/uiri/toml’s many encoding bugs. More info: https://github.com/fabiocaccamo/python-benedict/issues/439

toml.dumps(value, encoder=CustomTOMLEncoder())

Initialization