tomlkit の API リファレンス
tomlkit (python-poetry/tomlkit) の公開 API 107 件 —— クラス 39、関数 24、メソッド 44。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。
リポジトリ: python-poetry/tomlkit
| 種別 | 件数 |
|---|---|
| クラス | 39 |
| 関数 | 24 |
| メソッド | 44 |
API 一覧
func
tomlkit.api.aot() -> AoTCreate an array of table.
func
tomlkit.api.array(raw:str='[]') -> ArrayCreate an array item for its string representation.
func
tomlkit.api.boolean(raw:str | bool) -> BoolTurn `true` or `false` into a boolean item.
func
tomlkit.api.comment(string:str) -> CommentCreate a comment item.
func
tomlkit.api.date(raw:str) -> DateCreate a TOML date.
func
tomlkit.api.datetime(raw:str) -> DateTimeCreate a TOML datetime.
func
tomlkit.api.document() -> TOMLDocumentReturns a new TOMLDocument instance.
func
tomlkit.api.dump(data:Mapping[str, Any], fp:IO[str], *sort_keys:bool=False) -> NoneDump a TOMLDocument into a writable file stream.
func
tomlkit.api.dumps(data:Mapping[str, Any], sort_keys:bool=False) -> strDumps a TOMLDocument into a string.
func
tomlkit.api.float_(raw:str | float) -> FloatCreate an float item from a number or string.
func
tomlkit.api.inline_table() -> InlineTableCreate an inline table.
func
tomlkit.api.integer(raw:str | int) -> IntegerCreate an integer item from a number or string.
func
tomlkit.api.key(k:str | Iterable[str]) -> KeyCreate a key from a string.
func
tomlkit.api.key_value(src:str) -> tuple[Key, _Item]Parse a key-value pair from a string.
func
tomlkit.api.load(fp:IO[str] | IO[bytes]) -> TOMLDocumentLoad toml document from a file-like object.
func
tomlkit.api.loads(string:str | bytes) -> TOMLDocumentParses a string into a TOMLDocument.
func
tomlkit.api.nl() -> WhitespaceCreate a newline item.
func
tomlkit.api.parse(string:str | bytes) -> TOMLDocumentParses a string or bytes into a TOMLDocument.
func
tomlkit.api.string(raw:str, *literal:bool=False, *multiline:bool=False, *escape:bool=True) -> StringCreate a string item.
func
tomlkit.api.table(is_super_table:bool | None=None) -> TableCreate an empty table.
func
tomlkit.api.time(raw:str) -> TimeCreate a TOML time.
func
tomlkit.api.unregister_encoder(encoder:Encoder) -> NoneUnregister a custom encoder.
func
tomlkit.api.value(raw:str) -> _ItemParse a simple value from a string.
func
tomlkit.api.ws(src:str) -> WhitespaceCreate a whitespace from a string.
class
tomlkit.container.ContainerA container for items within a TOMLDocument.
method
tomlkit.container.Container.add(key:Key | Item | str, item:Any=None) -> ContainerAdds an item to the current Container.
method
tomlkit.container.Container.append(key:Key | str | None, item:Any, validate:bool=True) -> ContainerSimilar to :meth:`add` but both key and value must be given.
method
tomlkit.container.Container.as_string() -> strRender as TOML string.
method
tomlkit.container.Container.item(key:Key | str) -> Item | OutOfOrderTableProxyGet an item for the given key.
method
tomlkit.container.Container.last_item() -> Item | NoneGet the last item.
method
tomlkit.container.Container.remove(key:Key | str) -> ContainerRemove a key from the container.
method
tomlkit.container.Container.unwrap() -> dict[str, Any]Returns as pure python object (ppo)
method
tomlkit.container.Container.value() -> dict[str, Any]The wrapped dict value
class
tomlkit.exceptions.ConvertErrorRaised when item() fails to convert a value.
class
tomlkit.exceptions.EmptyKeyErrorAn empty key was found during parsing.
class
tomlkit.exceptions.EmptyTableNameErrorAn empty table name was found during parsing.
class
tomlkit.exceptions.InternalParserErrorAn error that indicates a bug in the parser.
class
tomlkit.exceptions.InvalidCharInStringErrorThe string being parsed contains an invalid character.
class
tomlkit.exceptions.InvalidDateErrorA date field was improperly specified.
class
tomlkit.exceptions.InvalidDateTimeErrorA datetime field was improperly specified.
class
tomlkit.exceptions.InvalidNumberErrorA numeric field was improperly specified.
class
tomlkit.exceptions.InvalidNumberOrDateErrorA numeric or date field was improperly specified.
class
tomlkit.exceptions.InvalidTimeErrorA date field was improperly specified.
class
tomlkit.exceptions.InvalidUnicodeValueErrorA unicode code was improperly specified.
class
tomlkit.exceptions.KeyAlreadyPresentAn already present key was used.
class
tomlkit.exceptions.MixedArrayTypesErrorAn array was found that had two or more element types.
class
tomlkit.exceptions.NonExistentKeyA non-existent key was used.
class
tomlkit.exceptions.UnexpectedCharErrorAn unexpected character was found during parsing.
class
tomlkit.exceptions.UnexpectedEofErrorThe TOML being parsed ended before the end of a statement.
class
tomlkit.items.AoTAn array of table literal
class
tomlkit.items.ArrayAn array literal
method
tomlkit.items.Array.clear() -> NoneClear the array.
method
tomlkit.items.Array.multiline(multiline:bool) -> ArrayChange the array to display in multiline or not.
class
tomlkit.items.BoolA boolean literal.
method
tomlkit.items.Bool.value() -> boolThe wrapped boolean value
class
tomlkit.items.CommentA comment literal.
class
tomlkit.items.DateA date literal.
class
tomlkit.items.DateTimeA datetime literal.
class
tomlkit.items.FloatA float literal.
method
tomlkit.items.Float.value() -> floatThe wrapped float value
class
tomlkit.items.InlineTableAn inline table literal.
method
tomlkit.items.InlineTable.append(key:Key | str | None, _item:Any) -> InlineTableAppends a (key, item) to the table.
class
tomlkit.items.IntegerAn integer literal.
method
tomlkit.items.Integer.value() -> intThe wrapped integer value
class
tomlkit.items.ItemAn item within a TOML document.
method
tomlkit.items.Item.as_string() -> strThe TOML representation
method
tomlkit.items.Item.comment(comment:str) -> ItemAttach a comment to this item
method
tomlkit.items.Item.indent(indent:int) -> ItemIndent this item with given number of spaces
method
tomlkit.items.Item.trivia() -> TriviaThe trivia element associated with this item
method
tomlkit.items.Item.unwrap() -> AnyReturns as pure python object (ppo)
class
tomlkit.items.KeyBase class for a key
method
tomlkit.items.Key.as_string() -> strThe TOML representation
method
tomlkit.items.Key.concat(other:Key) -> DottedKeyConcatenate keys into a dotted key
method
tomlkit.items.Key.is_dotted() -> boolIf the key is followed by other keys
method
tomlkit.items.Key.is_multi() -> boolCheck if the key contains multiple keys
class
tomlkit.items.KeyTypeThe type of a Key.
class
tomlkit.items.NullA null item.
class
tomlkit.items.SingleKeyA single key
method
tomlkit.items.SingleKey.delimiter() -> strThe delimiter: double quote/single quote/none
method
tomlkit.items.SingleKey.is_bare() -> boolCheck if the key is bare
class
tomlkit.items.StringA string literal.
class
tomlkit.items.TableA table literal.
method
tomlkit.items.Table.append(key:Key | str | None, _item:Any) -> TableAppends a (key, item) to the table.
method
tomlkit.items.Table.indent(indent:int) -> TableIndent the table with given number of spaces.
method
tomlkit.items.Table.invalidate_display_name() -> NoneCall ``invalidate_display_name`` on the contained tables
method
tomlkit.items.Table.is_aot_element() -> boolTrue if the table is the direct child of an AOT element.
method
tomlkit.items.Table.raw_append(key:Key | str | None, _item:Any) -> TableSimilar to :meth:`append` but does not copy indentation.
class
tomlkit.items.TimeA time literal.
class
tomlkit.items.TriviaTrivia information (aka metadata).
class
tomlkit.items.WhitespaceA whitespace literal.
method
tomlkit.items.Whitespace.value() -> strThe wrapped string of the whitespace
class
tomlkit.parser.ParserParser for TOML documents.
method
tomlkit.parser.Parser.consume(chars:str, min:int=0, max:int=-1) -> NoneConsume chars until min/max is satisfied is valid.
method
tomlkit.parser.Parser.end() -> boolReturns True if the parser has reached the end of the input.
method
tomlkit.parser.Parser.extract() -> strExtracts the value between marker and index
method
tomlkit.parser.Parser.mark() -> NoneSets the marker to the index's current position
method
tomlkit.parser.Parser.parse_error(exception:type[ParseError]=ParseError, *args:Any, **kwargs:Any) -> ParseErrorCreates a generic "parse error" at the current position.
method
tomlkit.source.Source.advance_until(stopset:frozenset) -> boolAdvance while the current character is NOT in ``stopset``.
method
tomlkit.source.Source.advance_while(charset:frozenset) -> boolAdvance while the current character is in ``charset``.
method
tomlkit.source.Source.consume(chars:str, min:int=0, max:int=-1) -> NoneConsume chars until min/max is satisfied is valid.
method
tomlkit.source.Source.end() -> boolReturns True if the parser has reached the end of the input.
method
tomlkit.source.Source.extract() -> strExtracts the value between marker and index
method
tomlkit.source.Source.mark() -> NoneSets the marker to the index's current position
method
tomlkit.source.Source.parse_error(exception:type[ParseError]=ParseError, *args:Any, **kwargs:Any) -> ParseErrorCreates a generic "parse error" at the current position.
class
tomlkit.toml_document.TOMLDocumentA TOML document.
class
tomlkit.toml_file.TOMLFileRepresents a TOML file.
method
tomlkit.toml_file.TOMLFile.write(data:TOMLDocument) -> NoneWrite the TOMLDocument to the file.
この情報について
掲載しているシグネチャは python-poetry/tomlkit の公開ソースコードを
Python の ast モジュールで静的解析し、引数名・デフォルト値・
型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。
詳しくは仕組みの解説をご覧ください。