Configuration Value#

rconf.Leaf#

alias of Union[str, int, float, bool, None, date, datetime, time, bytes, bytearray, memoryview]

class rconf.Value#

The core types of rconf.

A configuration rconf.Value is defined as

The mapping values and sequence elements can in turn be any valid rconf.Value instance.

This definition allows rconf to be a drop-in replacement for json.load(), json.loads(), tomllib.load() and tomllib.loads().

import typing
from datetime import date, datetime, time

Leaf = typing.Union[
    # JSON / TOML
    str,
    int,
    float,
    bool,
    # JSON null
    None,
    # TOML Date, Date-Time, Time
    date,
    datetime,
    time,
    # other
    bytes,
    bytearray,
    memoryview,
]

Value = typing.Union[
    # JSON object, TOML table
    typing.Dict[str, "Value"],
    # JSON array / TOML array
    typing.List["Value"],
    typing.Tuple["Value", ...],
    # Leaf
    Leaf,
]