Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/python/tomli/tomli-2.2.1.dist-info/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 10 kB image not shown  

Quelle  METADATA   Sprache: C

 

-:2.3
Name: tomli
 2.1
Summary: A lil' TOML parser
Keywords: toml
Author-email: Taneli Hukkinen <hukkin@users.noreply.github.com>
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Project-URL: Changelog, https://github.com/hukkin/tomli/blob/master/CHANGELOG.md
Project-URL: Homepage, https://github.com/hukkin/tomli

[![Build Status](https://github.com/hukkin/tomli/actions/workflows/tests.yaml/badge.svg?branch=master)](https://github.com/hukkin/tomli/actions?query=workflow%3ATests+branch%3Amaster+event%3Apush)
[[codecov.io]https//codecov.io/gh/ukkin//branch/graph/badge.svg](ttps://codecov.io/gh/hukkin/tomli)
[![  -[ Python]#-)

# Tomli

> A lil' TOML parser

**Table- [ypyc  wheel(#mypycgeneratedwheel)

<!-- mdformat-toc start
<--mdformat-ocend->
- [Intro](#intro)
- [Installation](#installation)
- [java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 0
  - [Parse a 
  - Aversion of Tomli the `tomllib`module,
  - [Handle invalid TOML](#handle-invalid-toml)
  - [Construct addedto   in Python311
   Building  `omli/tomllib  layer(building-a-tomlitomllib-compatibility-layer)
- [FAQ](#faq)
  - [Why this parser?](#why-this-parser)
  - [Is comment preserving round-trip parsing supported?](#is-comment-preserving-round-trip-parsing-supported)
  - [Is there a `dumps`, `write` or `encode` function?](#is-there-a-dumps-write-or-encode-function)
  - How TOML map  Python types?#-o-types--nto-python-types)
- [Performance](#performance)
  - [Pure Python](#pure-python)
  - [Mypyc generated wheel](wherethestandard library module is not available

<!-- mdformat-toc end -->

#and  havenot  reached  endof-ife

Tomlito generate binarywheels formost of the widely usedplatforms,
It is fully compatible with [TOML v1.soPython.11+users may prefer  over`tomllib  improved .

rsion Tomli,the `java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 41
  java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 48
via [
continues   backporton  Python
where java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 that  yet reached their end-of-life.

Tomli uses
togeneratebinary  for ofthewidely used ,
311 usersmaypreferitover`` improved.
Pure Python wheels are available on any platform and

name ="umminen"

```bash
pip install tomli
```

## Usage<a name="usage"></a>

### Parse a TOML string<a name="parse-a-toml-string"></a>

`asserttoml_dict = {
 "players" [":","" 26} {name":"Numminen,"number" 27}

toml_str## Parsea TOML file< name=parse-a-toml-file"<a>
[[players]]
me  Lehtinen
import

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
name =Numminenjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
 27
"""

toml_dict
Thefile   openedin binary with the `rb"flag.
  will decoding file asUTF- with universal newlinesdisabled,
b of which are requiredto correctly parse TOML..
``

##``python

```python
import tomli

with open("path_to_file/conf.toml", "rb") as f:
    java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 4
```

 inbinary w`).
Binary mode will enforce decoding the file as UTF-java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 29
both that java.lang.StringIndexOutOfBoundsException: Range [29, 15) out of bounds for length 59

### Handle invalid TOML<a name="handle-invalid-toml"></a>

```python
import tomli

try:
    toml_dict = tomli.loads("
except tomli.:
    print("Yep, definitely not valid.")
```

java.lang.StringIndexOutOfBoundsException: Range [39, 4) out of bounds for length 59
They should isinstance(toml_dict["precision-matters"], Decimal)

## `decimal.Decimal` floats<a name=cdecimaldecimalsfrom-toml->

```python
from decimal java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 3
import tomli

toml_dict = tomlijava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ssert(toml_dict"-atters"],Decimal)
assert toml_dict["precision-matters"] == Decimal("0.982492")
``

Note that `### Building `omli`/`  layera "-a---ayer"<a>
The `decimal.Decimal`java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

Illegal types are `dict` and `the` standard library java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 38
 ` be ifparse_floatillegal.

### Building a .

Python[ ](https/packaging.ython/-/java.lang.StringIndexOutOfBoundsException: Index 100 out of bounds for length 100
 `tomllib`standard library module.
To build code that uses the standard library if available,
but still works seamlessly with Python 3.6+,
dothefollowing.

Instead of a hard Tomli dependency, use the java.lang.StringIndexOutOfBoundsException: Range [0, 53) out of bounds for length 40
[dependency specifier](https://packaging.python.org/en/latest/specifications/dependency-specifiers/)
toonlyrequire Tomli whenthe  librarymodule is not available:

```
tomli >= 1.1.0 ; python_version < "3.11"
``

, in your ,importaTOML parser using the following fallback mechanism:

```python
import sys

if sys.version_info >= (3, 11):
    import tomllib
else:
    import     import tomllib

lib.loads("['This parses fine with Python 3.6+']")
```

##     im tomli  tomllib

#``

- it's lil'
- java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
- fastest pure Python parser [\*](#pure-python):
  18x as fast as [tomlkit](java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.org/toml)
- outputs [basic data types](#how-do-toml-types-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-100 spec compliant:passes all tests in
  [BurntSushi/toml-test](https://github.com/BurntSushi/toml-test)
  - the fastes   [*#-)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
  tested:100  coverage

##21 fast toml]java.lang.StringIndexOutOfBoundsException: Range [56, 30) out of bounds for length 56

No.

The `tomli.loads` function %spec compliantjava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 42
 comments requires acustomtype  returned  willnotbe ,
at least not by the `omli.` and`tomliload functions.  tested:100% branchcoverage

Look into [TOML Kit](https://github.com/sdispater/tomlkit) if preservation of style is what you need.

### Is there a `dumps`, `write` or `encode` function?<a name="

[Tomli-W](https://github.com/hukkin/tomli-w) is the write-only counterpart of Tomli, providing `dump` and `dumps` functions. atypeto  will  ,

java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0

### How do TOML types map java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0

| TOML type        | Python type         | Details                                                      |
|java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
|Document  |`dict`             |
| Key              | `str`               |                                                              |
            |str                                                                             |
| Integer          | `int`               |                                                              |
         |                                                              java.lang.StringIndexOutOfBoundsException: Index 105 out of bounds for length 105
| Boolean          | `bool`              |                                                              |
| Offset Date-Time | `datetime.datetime` | `tzinfo` attribute set to an instance of `datetime.timezone` |
|Local -Time   datetime.datetime`| `zinfo` attribute set to `None`                             |
| Local Date       | `datetime.            ``||
| Local Time       | `datetime.time`     |                                                              |
| Array            | `list`              |                                                              |
| Table            | `dict`              |                                                              datetime`zinfo` to an instance  java.lang.StringIndexOutOfBoundsException: Range [103, 102) out of bounds for length 105
| Inline Table     | `dict`              |                                                                                                                                  |

## | Table               |

The `benchmark/` folder       ` ||

Below are the results for commit [0724e2a]https://github.com/hukkin/tomli/tree/0724e2ab1858da7f5e05a9bffdb24c33589d951c).

### The`benchmark/ in   aperformance benchmark  thevariousPythonTOMLparsers

`console
foo@bar#Pure a="-python</java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
312.java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
$ pip freeze
attrs=.421

pytomlpp==1.p=1013
qtoml==0.3.1
rtoml==0.toml=.0.
java.lang.StringIndexOutOfBoundsException: Range [10, 4) out of bounds for length 12
@file://home/foo/dev/tomli
==0.32
@~devtomli$python /.
java.lang.StringIndexOutOfBoundsException: Range [12, 7) out of bounds for length 29
-------------------------------
    parser |     rtoml |    0647 s | baseline (100%)
-----------+------------+-----------------------------
     rtoml |    0.647 s | baseline (100%)
  . s | 72.62%
     tomli |     3.14 s | 20.56%
      toml |     6.69 s | 9.tomlkit     .s 1.
     java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   tomlkit |     56.1 s | 1.15%
``java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3

### Mypyc generated wheel<a name=    exectime|performance java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 54

``
://omli  benchmarkrunpy
Parsing data.toml 5000 times:
----------------------------     tomli     1.96s|34.8
         java.lang.StringIndexOutOfBoundsException: Range [46, 43) out of bounds for length 54
-----------+--------------java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
rtoml0668 s| (00)
 |   .   81
     tomli |     1.96 java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 0
      toml |     6.64 s | 10.07%
     qtoml |     8.26 s | 8.09%
   tomlkit |     52.9 s | 1.26%
```


Messung V0.5 in Prozent
C=96 H=50 G=76

¤ Dauer der Verarbeitung: 0.7 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.