nitpick.tomlkit_ext module

Extensions for the tomlkit package, with drop-in replacement functions and classes.

Eventually, some of the code here should/could be proposed as pull requests to the original package.

nitpick.tomlkit_ext.load(file_pointer: IO[str] | IO[bytes] | Path) TOMLDocument[source]

Load a TOML file from a file-like object or path.

Return an empty document if the file doesn’t exist.

Drop-in replacement for tomlkit.api.load().

nitpick.tomlkit_ext.multiline_comment_with_markers(marker: str, text: str) list[str][source]

Add markers to a comment with multiple lines.

nitpick.tomlkit_ext.update_comment_before(table: Table, key: str, marker: str, comment: str) None[source]

Update a comment before a key, between markers.

Either replace an existing block or create a new one.