INI text to nested dicts (Effect's encoding/Ini, adapted from the
ini 7.0.0 package).
[a.b] sections nest (\. keeps a literal dot), key[] collects
values into a list, a key without = is True, and the values
true / false / null become True / False / None.
Quoted values are read as JSON strings when they parse; ; and #
start a comment in an unquoted value unless escaped.
Functions#
parse#
parse(text) -> dict[str, Any]The sections and properties of text. A property in a [section]
whose name holds a value (a=1 then [a] and b=2) raises
TypeError, as Effect's Ini.parse throws.
| Parameter | Type | Description |
|---|---|---|
text | str |
Returns dict[str, Any]
def parse(text: str) -> dict[str, Any]:
"""The sections and properties of ``text``. A property in a ``[section]``
whose name holds a value (``a=1`` then ``[a]`` and ``b=2``) raises
``TypeError``, as Effect's ``Ini.parse`` throws."""
return _nest_sections(_parse_lines(text))