diff --git a/docs/api.rst b/docs/api.rst index 82ab5799..954477d5 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -19,7 +19,14 @@ TOML Document .. autoclass:: TOMLDocument :show-inheritance: - :inherited-members: + :members: add, append, as_string, clear, copy, fromkeys, get, item, items, keys, + last_item, pop, popitem, remove, setdefault, unwrap, update, value, + values + +Container +--------- + +.. autoclass:: tomlkit.container.Container TOML File diff --git a/docs/conf.py b/docs/conf.py index cf4e8159..234e5dec 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -39,6 +39,10 @@ "sphinx.ext.intersphinx", ] +# Built-in mapping docstrings start with text such as ``D.clear() -> None``. +# Parse those first lines as prose rather than malformed autodoc signatures. +autodoc_docstring_signature = False + # Resolve references to the standard library and other projects, so that # annotations such as collections.abc.Mapping or datetime.datetime link to # their documentation instead of producing "reference target not found" @@ -47,6 +51,19 @@ "python": ("https://docs.python.org/3", None), } +# These targets are intentionally not standalone API pages: the wrapper types +# are private implementation bases, while E and Encoder exist only for typing. +nitpick_ignore = { + ("py:class", "tomlkit._types._CustomDict"), + ("py:class", "tomlkit._types._CustomFloat"), + ("py:class", "tomlkit._types._CustomInt"), + ("py:class", "tomlkit._types._CustomList"), + ("py:class", "tomlkit.items.AbstractTable"), + ("py:class", "tomlkit.container.OutOfOrderTableProxy"), + ("py:class", "E"), + ("py:class", "Encoder"), +} + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff --git a/tomlkit/api.py b/tomlkit/api.py index a7f3abdd..c1c617d6 100644 --- a/tomlkit/api.py +++ b/tomlkit/api.py @@ -358,7 +358,8 @@ def register_encoder(encoder: E) -> E: The encoder should return a TOMLKit item or raise a ``ConvertError``. - Example: + Example:: + @register_encoder def encode_custom_dict(obj, _parent=None, _sort_keys=False): if isinstance(obj, CustomDict):