sdkagent

tomlkit API reference

107 public APIs from tomlkit (python-poetry/tomlkit) — 39 classes, 24 functions, 44 methods. Signatures extracted by static analysis of the actual source.

Repository: python-poetry/tomlkit

KindCount
Classes39
Functions24
Methods44

API list

functomlkit.api.aot() -> AoT
Create an array of table.
functomlkit.api.array(raw:str='[]') -> Array
Create an array item for its string representation.
functomlkit.api.boolean(raw:str | bool) -> Bool
Turn `true` or `false` into a boolean item.
functomlkit.api.comment(string:str) -> Comment
Create a comment item.
functomlkit.api.date(raw:str) -> Date
Create a TOML date.
functomlkit.api.datetime(raw:str) -> DateTime
Create a TOML datetime.
functomlkit.api.document() -> TOMLDocument
Returns a new TOMLDocument instance.
functomlkit.api.dump(data:Mapping[str, Any], fp:IO[str], *sort_keys:bool=False) -> None
Dump a TOMLDocument into a writable file stream.
functomlkit.api.dumps(data:Mapping[str, Any], sort_keys:bool=False) -> str
Dumps a TOMLDocument into a string.
functomlkit.api.float_(raw:str | float) -> Float
Create an float item from a number or string.
functomlkit.api.inline_table() -> InlineTable
Create an inline table.
functomlkit.api.integer(raw:str | int) -> Integer
Create an integer item from a number or string.
functomlkit.api.key(k:str | Iterable[str]) -> Key
Create a key from a string.
functomlkit.api.key_value(src:str) -> tuple[Key, _Item]
Parse a key-value pair from a string.
functomlkit.api.load(fp:IO[str] | IO[bytes]) -> TOMLDocument
Load toml document from a file-like object.
functomlkit.api.loads(string:str | bytes) -> TOMLDocument
Parses a string into a TOMLDocument.
functomlkit.api.nl() -> Whitespace
Create a newline item.
functomlkit.api.parse(string:str | bytes) -> TOMLDocument
Parses a string or bytes into a TOMLDocument.
functomlkit.api.string(raw:str, *literal:bool=False, *multiline:bool=False, *escape:bool=True) -> String
Create a string item.
functomlkit.api.table(is_super_table:bool | None=None) -> Table
Create an empty table.
functomlkit.api.time(raw:str) -> Time
Create a TOML time.
functomlkit.api.unregister_encoder(encoder:Encoder) -> None
Unregister a custom encoder.
functomlkit.api.value(raw:str) -> _Item
Parse a simple value from a string.
functomlkit.api.ws(src:str) -> Whitespace
Create a whitespace from a string.
classtomlkit.container.Container
A container for items within a TOMLDocument.
methodtomlkit.container.Container.add(key:Key | Item | str, item:Any=None) -> Container
Adds an item to the current Container.
methodtomlkit.container.Container.append(key:Key | str | None, item:Any, validate:bool=True) -> Container
Similar to :meth:`add` but both key and value must be given.
methodtomlkit.container.Container.as_string() -> str
Render as TOML string.
methodtomlkit.container.Container.item(key:Key | str) -> Item | OutOfOrderTableProxy
Get an item for the given key.
methodtomlkit.container.Container.last_item() -> Item | None
Get the last item.
methodtomlkit.container.Container.remove(key:Key | str) -> Container
Remove a key from the container.
methodtomlkit.container.Container.unwrap() -> dict[str, Any]
Returns as pure python object (ppo)
methodtomlkit.container.Container.value() -> dict[str, Any]
The wrapped dict value
classtomlkit.exceptions.ConvertError
Raised when item() fails to convert a value.
classtomlkit.exceptions.EmptyKeyError
An empty key was found during parsing.
classtomlkit.exceptions.EmptyTableNameError
An empty table name was found during parsing.
classtomlkit.exceptions.InternalParserError
An error that indicates a bug in the parser.
classtomlkit.exceptions.InvalidCharInStringError
The string being parsed contains an invalid character.
classtomlkit.exceptions.InvalidDateError
A date field was improperly specified.
classtomlkit.exceptions.InvalidDateTimeError
A datetime field was improperly specified.
classtomlkit.exceptions.InvalidNumberError
A numeric field was improperly specified.
classtomlkit.exceptions.InvalidNumberOrDateError
A numeric or date field was improperly specified.
classtomlkit.exceptions.InvalidTimeError
A date field was improperly specified.
classtomlkit.exceptions.InvalidUnicodeValueError
A unicode code was improperly specified.
classtomlkit.exceptions.KeyAlreadyPresent
An already present key was used.
classtomlkit.exceptions.MixedArrayTypesError
An array was found that had two or more element types.
classtomlkit.exceptions.NonExistentKey
A non-existent key was used.
classtomlkit.exceptions.UnexpectedCharError
An unexpected character was found during parsing.
classtomlkit.exceptions.UnexpectedEofError
The TOML being parsed ended before the end of a statement.
classtomlkit.items.AoT
An array of table literal
classtomlkit.items.Array
An array literal
methodtomlkit.items.Array.clear() -> None
Clear the array.
methodtomlkit.items.Array.multiline(multiline:bool) -> Array
Change the array to display in multiline or not.
classtomlkit.items.Bool
A boolean literal.
methodtomlkit.items.Bool.value() -> bool
The wrapped boolean value
classtomlkit.items.Comment
A comment literal.
classtomlkit.items.Date
A date literal.
classtomlkit.items.DateTime
A datetime literal.
classtomlkit.items.Float
A float literal.
methodtomlkit.items.Float.value() -> float
The wrapped float value
classtomlkit.items.InlineTable
An inline table literal.
methodtomlkit.items.InlineTable.append(key:Key | str | None, _item:Any) -> InlineTable
Appends a (key, item) to the table.
classtomlkit.items.Integer
An integer literal.
methodtomlkit.items.Integer.value() -> int
The wrapped integer value
classtomlkit.items.Item
An item within a TOML document.
methodtomlkit.items.Item.as_string() -> str
The TOML representation
methodtomlkit.items.Item.comment(comment:str) -> Item
Attach a comment to this item
methodtomlkit.items.Item.indent(indent:int) -> Item
Indent this item with given number of spaces
methodtomlkit.items.Item.trivia() -> Trivia
The trivia element associated with this item
methodtomlkit.items.Item.unwrap() -> Any
Returns as pure python object (ppo)
classtomlkit.items.Key
Base class for a key
methodtomlkit.items.Key.as_string() -> str
The TOML representation
methodtomlkit.items.Key.concat(other:Key) -> DottedKey
Concatenate keys into a dotted key
methodtomlkit.items.Key.is_dotted() -> bool
If the key is followed by other keys
methodtomlkit.items.Key.is_multi() -> bool
Check if the key contains multiple keys
classtomlkit.items.KeyType
The type of a Key.
classtomlkit.items.Null
A null item.
classtomlkit.items.SingleKey
A single key
methodtomlkit.items.SingleKey.delimiter() -> str
The delimiter: double quote/single quote/none
methodtomlkit.items.SingleKey.is_bare() -> bool
Check if the key is bare
classtomlkit.items.String
A string literal.
classtomlkit.items.Table
A table literal.
methodtomlkit.items.Table.append(key:Key | str | None, _item:Any) -> Table
Appends a (key, item) to the table.
methodtomlkit.items.Table.indent(indent:int) -> Table
Indent the table with given number of spaces.
methodtomlkit.items.Table.invalidate_display_name() -> None
Call ``invalidate_display_name`` on the contained tables
methodtomlkit.items.Table.is_aot_element() -> bool
True if the table is the direct child of an AOT element.
methodtomlkit.items.Table.raw_append(key:Key | str | None, _item:Any) -> Table
Similar to :meth:`append` but does not copy indentation.
classtomlkit.items.Time
A time literal.
classtomlkit.items.Trivia
Trivia information (aka metadata).
classtomlkit.items.Whitespace
A whitespace literal.
methodtomlkit.items.Whitespace.value() -> str
The wrapped string of the whitespace
classtomlkit.parser.Parser
Parser for TOML documents.
methodtomlkit.parser.Parser.consume(chars:str, min:int=0, max:int=-1) -> None
Consume chars until min/max is satisfied is valid.
methodtomlkit.parser.Parser.end() -> bool
Returns True if the parser has reached the end of the input.
methodtomlkit.parser.Parser.extract() -> str
Extracts the value between marker and index
methodtomlkit.parser.Parser.mark() -> None
Sets the marker to the index's current position
methodtomlkit.parser.Parser.parse_error(exception:type[ParseError]=ParseError, *args:Any, **kwargs:Any) -> ParseError
Creates a generic "parse error" at the current position.
methodtomlkit.source.Source.advance_until(stopset:frozenset) -> bool
Advance while the current character is NOT in ``stopset``.
methodtomlkit.source.Source.advance_while(charset:frozenset) -> bool
Advance while the current character is in ``charset``.
methodtomlkit.source.Source.consume(chars:str, min:int=0, max:int=-1) -> None
Consume chars until min/max is satisfied is valid.
methodtomlkit.source.Source.end() -> bool
Returns True if the parser has reached the end of the input.
methodtomlkit.source.Source.extract() -> str
Extracts the value between marker and index
methodtomlkit.source.Source.mark() -> None
Sets the marker to the index's current position
methodtomlkit.source.Source.parse_error(exception:type[ParseError]=ParseError, *args:Any, **kwargs:Any) -> ParseError
Creates a generic "parse error" at the current position.
classtomlkit.toml_document.TOMLDocument
A TOML document.
classtomlkit.toml_file.TOMLFile
Represents a TOML file.
methodtomlkit.toml_file.TOMLFile.write(data:TOMLDocument) -> None
Write the TOMLDocument to the file.

About this data

These signatures were extracted from the public source of python-poetry/tomlkit using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries