diff --git a/README.md b/README.md
index e76f3845..1a99b827 100644
--- a/README.md
+++ b/README.md
@@ -4,16 +4,11 @@
[github_license]: https://img.shields.io/github/license/sdispater/tomlkit.svg?logo=github&logoColor=white
[github_action]: https://github.com/sdispater/tomlkit/actions/workflows/tests.yml/badge.svg
-
-
-[codecov]: https://img.shields.io/codecov/c/github/sdispater/tomlkit/master.svg?logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNDgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CgogPGc+CiAgPHRpdGxlPmJhY2tncm91bmQ8L3RpdGxlPgogIDxyZWN0IGZpbGw9Im5vbmUiIGlkPSJjYW52YXNfYmFja2dyb3VuZCIgaGVpZ2h0PSI0MDIiIHdpZHRoPSI1ODIiIHk9Ii0xIiB4PSItMSIvPgogPC9nPgogPGc+CiAgPHRpdGxlPkxheWVyIDE8L3RpdGxlPgogIDxwYXRoIGlkPSJzdmdfMSIgZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsPSIjZmZmZmZmIiBkPSJtMjUuMDE0LDBjLTEzLjc4NCwwLjAxIC0yNS4wMDQsMTEuMTQ5IC0yNS4wMTQsMjQuODMybDAsMC4wNjJsNC4yNTQsMi40ODJsMC4wNTgsLTAuMDM5YTEyLjIzOCwxMi4yMzggMCAwIDEgOS4wNzgsLTEuOTI4YTExLjg0NCwxMS44NDQgMCAwIDEgNS45OCwyLjk3NWwwLjczLDAuNjhsMC40MTMsLTAuOTA0YzAuNCwtMC44NzQgMC44NjIsLTEuNjk2IDEuMzc0LC0yLjQ0M2MwLjIwNiwtMC4zIDAuNDMzLC0wLjYwNCAwLjY5MiwtMC45MjlsMC40MjcsLTAuNTM1bC0wLjUyNiwtMC40NGExNy40NSwxNy40NSAwIDAgMCAtOC4xLC0zLjc4MWExNy44NTMsMTcuODUzIDAgMCAwIC04LjM3NSwwLjQ5YzIuMDIzLC04Ljg2OCA5LjgyLC0xNS4wNSAxOS4wMjcsLTE1LjA1N2M1LjE5NSwwIDEwLjA3OCwyLjAwNyAxMy43NTIsNS42NTJjMi42MTksMi41OTggNC40MjIsNS44MzUgNS4yMjQsOS4zNzJhMTcuOTA4LDE3LjkwOCAwIDAgMCAtNS4yMDgsLTAuNzlsLTAuMzE4LC0wLjAwMWExOC4wOTYsMTguMDk2IDAgMCAwIC0yLjA2NywwLjE1M2wtMC4wODcsMC4wMTJjLTAuMzAzLDAuMDQgLTAuNTcsMC4wODEgLTAuODEzLDAuMTI2Yy0wLjExOSwwLjAyIC0wLjIzNywwLjA0NSAtMC4zNTUsMC4wNjhjLTAuMjgsMC4wNTcgLTAuNTU0LDAuMTE5IC0wLjgxNiwwLjE4NWwtMC4yODgsMC4wNzNjLTAuMzM2LDAuMDkgLTAuNjc1LDAuMTkxIC0xLjAwNiwwLjNsLTAuMDYxLDAuMDJjLTAuNzQsMC4yNTEgLTEuNDc4LDAuNTU4IC0yLjE5LDAuOTE0bC0wLjA1NywwLjAyOWMtMC4zMTYsMC4xNTggLTAuNjM2LDAuMzMzIC0wLjk3OCwwLjUzNGwtMC4wNzUsMC4wNDVhMTYuOTcsMTYuOTcgMCAwIDAgLTQuNDE0LDMuNzhsLTAuMTU3LDAuMTkxYy0wLjMxNywwLjM5NCAtMC41NjcsMC43MjcgLTAuNzg3LDEuMDQ4Yy0wLjE4NCwwLjI3IC0wLjM2OSwwLjU2IC0wLjYsMC45NDJsLTAuMTI2LDAuMjE3Yy0wLjE4NCwwLjMxOCAtMC4zNDgsMC42MjIgLTAuNDg3LDAuOWwtMC4wMzMsMC4wNjFjLTAuMzU0LDAuNzExIC0wLjY2MSwxLjQ1NSAtMC45MTcsMi4yMTRsLTAuMDM2LDAuMTExYTE3LjEzLDE3LjEzIDAgMCAwIC0wLjg1NSw1LjY0NGwwLjAwMywwLjIzNGEyMy41NjUsMjMuNTY1IDAgMCAwIDAuMDQzLDAuODIyYzAuMDEsMC4xMyAwLjAyMywwLjI1OSAwLjAzNiwwLjM4OGMwLjAxNSwwLjE1OCAwLjAzNCwwLjMxNiAwLjA1MywwLjQ3MWwwLjAxMSwwLjA4OGwwLjAyOCwwLjIxNGMwLjAzNywwLjI2NCAwLjA4LDAuNTI1IDAuMTMsMC43ODdjMC41MDMsMi42MzcgMS43Niw1LjI3NCAzLjYzNSw3LjYyNWwwLjA4NSwwLjEwNmwwLjA4NywtMC4xMDRjMC43NDgsLTAuODg0IDIuNjAzLC0zLjY4NyAyLjc2LC01LjM2OWwwLjAwMywtMC4wMzFsLTAuMDE1LC0wLjAyOGExMS43MzYsMTEuNzM2IDAgMCAxIC0xLjMzMywtNS40MDdjMCwtNi4yODQgNC45NCwtMTEuNTAyIDExLjI0MywtMTEuODhsMC40MTQsLTAuMDE1YzIuNTYxLC0wLjA1OCA1LjA2NCwwLjY3MyA3LjIzLDIuMTM2bDAuMDU4LDAuMDM5bDQuMTk3LC0yLjQ0bDAuMDU1LC0wLjAzM2wwLC0wLjA2MmMwLjAwNiwtNi42MzIgLTIuNTkyLC0xMi44NjUgLTcuMzE0LC0xNy41NTFjLTQuNzE2LC00LjY3OSAtMTAuOTkxLC03LjI1NSAtMTcuNjcyLC03LjI1NSIvPgogPC9nPgo8L3N2Zz4=&label=Codecov
-
[![GitHub Release][github_release]](https://github.com/sdispater/tomlkit/releases/)
-[![PyPI Version][pypi_version]](https://pypi.python.org/pypi/tomlkit/)
-[![Python Versions][python_versions]](https://pypi.python.org/pypi/tomlkit/)
+[![PyPI Version][pypi_version]](https://pypi.org/project/tomlkit/)
+[![Python Versions][python_versions]](https://pypi.org/project/tomlkit/)
[![License][github_license]](https://github.com/sdispater/tomlkit/blob/master/LICENSE)
-[![Codecov][codecov]](https://codecov.io/gh/sdispater/tomlkit)
[![Tests][github_action]](https://github.com/sdispater/tomlkit/actions/workflows/tests.yml)
# TOML Kit - Style-preserving TOML library for Python
@@ -29,128 +24,7 @@ Part of the implementation as been adapted, improved and fixed from [Molten](htt
## Usage
-### Parsing
-
-TOML Kit comes with a fast and style-preserving parser to help you access
-the content of TOML files and strings.
-
-```python
->>> from tomlkit import dumps
->>> from tomlkit import parse # you can also use loads
-
->>> content = """[table]
-... foo = "bar" # String
-... """
->>> doc = parse(content)
-
-# doc is a TOMLDocument instance that holds all the information
-# about the TOML string.
-# It behaves like a standard dictionary.
-
->>> assert doc["table"]["foo"] == "bar"
-
-# The string generated from the document is exactly the same
-# as the original string
->>> assert dumps(doc) == content
-```
-
-### Modifying
-
-TOML Kit provides an intuitive API to modify TOML documents.
-
-```python
->>> from tomlkit import dumps
->>> from tomlkit import parse
->>> from tomlkit import table
-
->>> doc = parse("""[table]
-... foo = "bar" # String
-... """)
-
->>> doc["table"]["baz"] = 13
-
->>> dumps(doc)
-"""[table]
-foo = "bar" # String
-baz = 13
-"""
-
-# Add a new table
->>> tab = table()
->>> tab.add("array", [1, 2, 3])
-
->>> doc["table2"] = tab
-
->>> dumps(doc)
-"""[table]
-foo = "bar" # String
-baz = 13
-
-[table2]
-array = [1, 2, 3]
-"""
-
-# Remove the newly added table
->>> doc.remove("table2")
-# del doc["table2] is also possible
-```
-
-### Writing
-
-You can also write a new TOML document from scratch.
-
-Let's say we want to create this following document:
-
-```toml
-# This is a TOML document.
-
-title = "TOML Example"
-
-[owner]
-name = "Tom Preston-Werner"
-organization = "GitHub"
-bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
-dob = 1979-05-27T07:32:00Z # First class dates? Why not?
-
-[database]
-server = "192.168.1.1"
-ports = [ 8001, 8001, 8002 ]
-connection_max = 5000
-enabled = true
-```
-
-It can be created with the following code:
-
-```python
->>> from tomlkit import comment
->>> from tomlkit import document
->>> from tomlkit import nl
->>> from tomlkit import table
-
->>> doc = document()
->>> doc.add(comment("This is a TOML document."))
->>> doc.add(nl())
->>> doc.add("title", "TOML Example")
-# Using doc["title"] = "TOML Example" is also possible
-
->>> owner = table()
->>> owner.add("name", "Tom Preston-Werner")
->>> owner.add("organization", "GitHub")
->>> owner.add("bio", "GitHub Cofounder & CEO\nLikes tater tots and beer.")
->>> owner.add("dob", datetime(1979, 5, 27, 7, 32, tzinfo=utc))
->>> owner["dob"].comment("First class dates? Why not?")
-
-# Adding the table to the document
->>> doc.add("owner", owner)
-
->>> database = table()
->>> database["server"] = "192.168.1.1"
->>> database["ports"] = [8001, 8001, 8002]
->>> database["connection_max"] = 5000
->>> database["enabled"] = True
-
->>> doc["database"] = database
-```
+See the [documentation](https://tomlkit.readthedocs.io/en/latest/quickstart.html) for more information.
## Installation
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 00000000..d4bb2cbb
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,20 @@
+# Minimal makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line, and also
+# from the environment for the first two.
+SPHINXOPTS ?=
+SPHINXBUILD ?= sphinx-build
+SOURCEDIR = .
+BUILDDIR = _build
+
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+.PHONY: help Makefile
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/docs/api.rst b/docs/api.rst
new file mode 100644
index 00000000..2b06bee8
--- /dev/null
+++ b/docs/api.rst
@@ -0,0 +1,43 @@
+API Reference
+=============
+
+Public API
+----------
+
+Functions you need to create TOML elements to construct
+a TOML document.
+
+.. automodule:: tomlkit
+ :members:
+ :undoc-members:
+ :show-inheritance:
+
+TOML Document
+-------------
+
+.. module:: tomlkit.toml_document
+
+.. autoclass:: TOMLDocument
+ :show-inheritance:
+ :inherited-members:
+
+
+TOML File
+---------
+
+.. module:: tomlkit.toml_file
+
+.. autoclass:: TOMLFile
+ :show-inheritance:
+ :members:
+
+
+TOML Items
+----------
+
+.. module:: tomlkit.items
+
+.. automodule:: tomlkit.items
+ :show-inheritance:
+ :members:
+ :exclude-members: item, AbstractTable
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 00000000..80a025b4
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,60 @@
+# Configuration file for the Sphinx documentation builder.
+#
+# This file only contains a selection of the most common options. For a full
+# list see the documentation:
+# https://www.sphinx-doc.org/en/master/usage/configuration.html
+
+# -- Path setup --------------------------------------------------------------
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#
+import os
+import sys
+
+
+sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
+
+from tomlkit import __version__ # noqa: E402
+
+
+# -- Project information -----------------------------------------------------
+
+project = "TOML Kit"
+copyright = "2021, Sébastien Eustace"
+author = "Sébastien Eustace"
+
+# The full version, including alpha/beta/rc tags
+release = __version__
+
+
+# -- General configuration ---------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = [
+ "sphinx.ext.autodoc",
+]
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ["_templates"]
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+# This pattern also affects html_static_path and html_extra_path.
+exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
+
+
+# -- Options for HTML output -------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+#
+html_theme = "furo"
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ["_static"]
diff --git a/docs/index.rst b/docs/index.rst
new file mode 100644
index 00000000..b5d824ec
--- /dev/null
+++ b/docs/index.rst
@@ -0,0 +1,57 @@
+.. TOMLKit documentation master file, created by
+ sphinx-quickstart on Fri Dec 24 09:31:46 2021.
+ You can adapt this file completely to your liking, but it should at least
+ contain the root `toctree` directive.
+
+TOML Kit
+========
+
+ **Style-preserving TOML library for Python**
+
+.. image:: https://img.shields.io/pypi/v/tomlkit.svg?logo=python&logoColor=white
+ :target: https://pypi.org/project/tomlkit/
+.. image:: https://img.shields.io/pypi/pyversions/tomlkit.svg?logo=python&logoColor=white
+ :target: https://pypi.org/project/tomlkit/
+.. image:: https://img.shields.io/github/license/sdispater/tomlkit.svg?logo=github&logoColor=white
+ :target: https://github.com/sdispater/tomlkit/blob/master/LICENSE
+.. image:: https://img.shields.io/badge/TOML-1.0.0-9c4221
+ :target: https://toml.io/en/v1.0.0
+
+TOML Kit is a **1.0.0-compliant** `TOML `_ library.
+
+It includes a parser that preserves all comments, indentations, whitespace and internal element ordering,
+and makes them accessible and editable via an intuitive API.
+
+You can also create new TOML documents from scratch using the provided helpers.
+
+Part of the implementation as been adapted, improved and fixed from `Molten `_.
+
+Installation
+------------
+
+If you are using `Poetry `_,
+add ``tomlkit`` to your ``pyproject.toml`` file by using::
+
+ poetry add tomlkit
+
+If not, you can use ``pip``::
+
+ pip install tomlkit
+
+
+Contents
+--------
+
+.. toctree::
+ :maxdepth: 2
+
+ quickstart
+ api
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/docs/make.bat b/docs/make.bat
new file mode 100644
index 00000000..153be5e2
--- /dev/null
+++ b/docs/make.bat
@@ -0,0 +1,35 @@
+@ECHO OFF
+
+pushd %~dp0
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set SOURCEDIR=.
+set BUILDDIR=_build
+
+if "%1" == "" goto help
+
+%SPHINXBUILD% >NUL 2>NUL
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.https://www.sphinx-doc.org/
+ exit /b 1
+)
+
+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
+goto end
+
+:help
+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
+
+:end
+popd
diff --git a/docs/quickstart.rst b/docs/quickstart.rst
new file mode 100644
index 00000000..6e806686
--- /dev/null
+++ b/docs/quickstart.rst
@@ -0,0 +1,124 @@
+Quickstart
+==========
+
+Parsing
+-------
+
+TOML Kit comes with a fast and style-preserving parser to help you access
+the content of TOML files and strings::
+
+
+ >>> from tomlkit import dumps
+ >>> from tomlkit import parse # you can also use loads
+
+ >>> content = """[table]
+ ... foo = "bar" # String
+ ... """
+ >>> doc = parse(content)
+
+ # doc is a TOMLDocument instance that holds all the information
+ # about the TOML string.
+ # It behaves like a standard dictionary.
+
+ >>> assert doc["table"]["foo"] == "bar"
+
+ # The string generated from the document is exactly the same
+ # as the original string
+ >>> assert dumps(doc) == content
+
+
+Modifying
+---------
+
+TOML Kit provides an intuitive API to modify TOML documents::
+
+ >>> from tomlkit import dumps
+ >>> from tomlkit import parse
+ >>> from tomlkit import table
+
+ >>> doc = parse("""[table]
+ ... foo = "bar" # String
+ ... """)
+
+ >>> doc["table"]["baz"] = 13
+
+ >>> dumps(doc)
+ """[table]
+ foo = "bar" # String
+ baz = 13
+ """
+
+ # Add a new table
+ >>> tab = table()
+ >>> tab.add("array", [1, 2, 3])
+
+ >>> doc["table2"] = tab
+
+ >>> dumps(doc)
+ """[table]
+ foo = "bar" # String
+ baz = 13
+
+ [table2]
+ array = [1, 2, 3]
+ """
+
+ # Remove the newly added table
+ >>> doc.remove("table2")
+ # del doc["table2] is also possible
+
+Writing
+-------
+
+You can also write a new TOML document from scratch.
+
+Let's say we want to create this following document
+
+.. code-block:: toml
+
+ # This is a TOML document.
+
+ title = "TOML Example"
+
+ [owner]
+ name = "Tom Preston-Werner"
+ organization = "GitHub"
+ bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
+ dob = 1979-05-27T07:32:00Z # First class dates? Why not?
+
+ [database]
+ server = "192.168.1.1"
+ ports = [ 8001, 8001, 8002 ]
+ connection_max = 5000
+ enabled = true
+
+It can be created with the following code::
+
+ >>> from tomlkit import comment
+ >>> from tomlkit import document
+ >>> from tomlkit import nl
+ >>> from tomlkit import table
+
+ >>> doc = document()
+ >>> doc.add(comment("This is a TOML document."))
+ >>> doc.add(nl())
+ >>> doc.add("title", "TOML Example")
+ # Using doc["title"] = "TOML Example" is also possible
+
+ >>> owner = table()
+ >>> owner.add("name", "Tom Preston-Werner")
+ >>> owner.add("organization", "GitHub")
+ >>> owner.add("bio", "GitHub Cofounder & CEO\nLikes tater tots and beer.")
+ >>> owner.add("dob", datetime(1979, 5, 27, 7, 32, tzinfo=utc))
+ >>> owner["dob"].comment("First class dates? Why not?")
+
+ # Adding the table to the document
+ >>> doc.add("owner", owner)
+
+ >>> database = table()
+ >>> database["server"] = "192.168.1.1"
+ >>> database["ports"] = [8001, 8001, 8002]
+ >>> database["connection_max"] = 5000
+ >>> database["enabled"] = True
+
+ >>> doc["database"] = database
diff --git a/docs/requirements.txt b/docs/requirements.txt
new file mode 100644
index 00000000..e32bccd1
--- /dev/null
+++ b/docs/requirements.txt
@@ -0,0 +1,2 @@
+sphinx==4.3.2
+furo==2021.11.23
diff --git a/poetry.lock b/poetry.lock
index df6a557b..fd9415f8 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1,3 +1,11 @@
+[[package]]
+name = "alabaster"
+version = "0.7.12"
+description = "A configurable sidebar-enabled Sphinx theme"
+category = "dev"
+optional = false
+python-versions = "*"
+
[[package]]
name = "atomicwrites"
version = "1.4.0"
@@ -20,6 +28,17 @@ docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"]
tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface"]
tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins"]
+[[package]]
+name = "babel"
+version = "2.9.1"
+description = "Internationalization utilities"
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+
+[package.dependencies]
+pytz = ">=2015.7"
+
[[package]]
name = "backports.entry-points-selectable"
version = "1.1.1"
@@ -35,6 +54,29 @@ importlib-metadata = {version = "*", markers = "python_version < \"3.8\""}
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
testing = ["pytest", "pytest-flake8", "pytest-cov", "pytest-black (>=0.3.7)", "pytest-mypy", "pytest-checkdocs (>=2.4)", "pytest-enabler (>=1.0.1)"]
+[[package]]
+name = "beautifulsoup4"
+version = "4.10.0"
+description = "Screen-scraping library"
+category = "dev"
+optional = false
+python-versions = ">3.0.0"
+
+[package.dependencies]
+soupsieve = ">1.2"
+
+[package.extras]
+html5lib = ["html5lib"]
+lxml = ["lxml"]
+
+[[package]]
+name = "certifi"
+version = "2021.10.8"
+description = "Python package for providing Mozilla's CA Bundle."
+category = "dev"
+optional = false
+python-versions = "*"
+
[[package]]
name = "cfgv"
version = "3.3.1"
@@ -43,6 +85,17 @@ category = "dev"
optional = false
python-versions = ">=3.6.1"
+[[package]]
+name = "charset-normalizer"
+version = "2.0.9"
+description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
+category = "dev"
+optional = false
+python-versions = ">=3.5.0"
+
+[package.extras]
+unicode_backport = ["unicodedata2"]
+
[[package]]
name = "colorama"
version = "0.4.4"
@@ -73,6 +126,14 @@ category = "dev"
optional = false
python-versions = "*"
+[[package]]
+name = "docutils"
+version = "0.17.1"
+description = "Docutils -- Python Documentation Utilities"
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+
[[package]]
name = "filelock"
version = "3.4.0"
@@ -85,6 +146,23 @@ python-versions = ">=3.6"
docs = ["furo (>=2021.8.17b43)", "sphinx (>=4.1)", "sphinx-autodoc-typehints (>=1.12)"]
testing = ["covdefaults (>=1.2.0)", "coverage (>=4)", "pytest (>=4)", "pytest-cov", "pytest-timeout (>=1.4.2)"]
+[[package]]
+name = "furo"
+version = "2021.11.23"
+description = "A clean customisable Sphinx documentation theme."
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
+[package.dependencies]
+beautifulsoup4 = "*"
+pygments = ">=2.7,<3.0"
+sphinx = ">=4.0,<5.0"
+
+[package.extras]
+test = ["pytest", "pytest-cov", "pytest-xdist"]
+doc = ["myst-parser", "sphinx-copybutton", "sphinx-design", "sphinx-inline-tabs"]
+
[[package]]
name = "identify"
version = "2.4.0"
@@ -96,6 +174,22 @@ python-versions = ">=3.6.1"
[package.extras]
license = ["ukkonen"]
+[[package]]
+name = "idna"
+version = "3.3"
+description = "Internationalized Domain Names in Applications (IDNA)"
+category = "dev"
+optional = false
+python-versions = ">=3.5"
+
+[[package]]
+name = "imagesize"
+version = "1.3.0"
+description = "Getting image size from png/jpeg/jpeg2000/gif file"
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+
[[package]]
name = "importlib-metadata"
version = "4.8.3"
@@ -136,6 +230,28 @@ category = "dev"
optional = false
python-versions = "*"
+[[package]]
+name = "jinja2"
+version = "3.0.3"
+description = "A very fast and expressive template engine."
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
+[package.dependencies]
+MarkupSafe = ">=2.0"
+
+[package.extras]
+i18n = ["Babel (>=2.7)"]
+
+[[package]]
+name = "markupsafe"
+version = "2.0.1"
+description = "Safely add untrusted strings to HTML/XML markup."
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
[[package]]
name = "mypy"
version = "0.920"
@@ -234,6 +350,14 @@ category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
+[[package]]
+name = "pygments"
+version = "2.10.0"
+description = "Pygments is a syntax highlighting package written in Python."
+category = "dev"
+optional = false
+python-versions = ">=3.5"
+
[[package]]
name = "pyparsing"
version = "3.0.6"
@@ -282,6 +406,14 @@ pytest = ">=4.6"
[package.extras]
testing = ["fields", "hunter", "process-tests", "six", "pytest-xdist", "virtualenv"]
+[[package]]
+name = "pytz"
+version = "2021.3"
+description = "World timezone definitions, modern and historical"
+category = "dev"
+optional = false
+python-versions = "*"
+
[[package]]
name = "pyyaml"
version = "6.0"
@@ -290,6 +422,24 @@ category = "dev"
optional = false
python-versions = ">=3.6"
+[[package]]
+name = "requests"
+version = "2.26.0"
+description = "Python HTTP for Humans."
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
+
+[package.dependencies]
+certifi = ">=2017.4.17"
+charset-normalizer = {version = ">=2.0.0,<2.1.0", markers = "python_version >= \"3\""}
+idna = {version = ">=2.5,<4", markers = "python_version >= \"3\""}
+urllib3 = ">=1.21.1,<1.27"
+
+[package.extras]
+socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
+use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"]
+
[[package]]
name = "six"
version = "1.16.0"
@@ -298,6 +448,124 @@ category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
+[[package]]
+name = "snowballstemmer"
+version = "2.2.0"
+description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms."
+category = "dev"
+optional = false
+python-versions = "*"
+
+[[package]]
+name = "soupsieve"
+version = "2.3.1"
+description = "A modern CSS selector implementation for Beautiful Soup."
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
+[[package]]
+name = "sphinx"
+version = "4.3.2"
+description = "Python documentation generator"
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
+[package.dependencies]
+alabaster = ">=0.7,<0.8"
+babel = ">=1.3"
+colorama = {version = ">=0.3.5", markers = "sys_platform == \"win32\""}
+docutils = ">=0.14,<0.18"
+imagesize = "*"
+Jinja2 = ">=2.3"
+packaging = "*"
+Pygments = ">=2.0"
+requests = ">=2.5.0"
+snowballstemmer = ">=1.1"
+sphinxcontrib-applehelp = "*"
+sphinxcontrib-devhelp = "*"
+sphinxcontrib-htmlhelp = ">=2.0.0"
+sphinxcontrib-jsmath = "*"
+sphinxcontrib-qthelp = "*"
+sphinxcontrib-serializinghtml = ">=1.1.5"
+
+[package.extras]
+docs = ["sphinxcontrib-websupport"]
+lint = ["flake8 (>=3.5.0)", "isort", "mypy (>=0.920)", "docutils-stubs", "types-typed-ast", "types-pkg-resources", "types-requests"]
+test = ["pytest", "pytest-cov", "html5lib", "cython", "typed-ast"]
+
+[[package]]
+name = "sphinxcontrib-applehelp"
+version = "1.0.2"
+description = "sphinxcontrib-applehelp is a sphinx extension which outputs Apple help books"
+category = "dev"
+optional = false
+python-versions = ">=3.5"
+
+[package.extras]
+lint = ["flake8", "mypy", "docutils-stubs"]
+test = ["pytest"]
+
+[[package]]
+name = "sphinxcontrib-devhelp"
+version = "1.0.2"
+description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document."
+category = "dev"
+optional = false
+python-versions = ">=3.5"
+
+[package.extras]
+lint = ["flake8", "mypy", "docutils-stubs"]
+test = ["pytest"]
+
+[[package]]
+name = "sphinxcontrib-htmlhelp"
+version = "2.0.0"
+description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files"
+category = "dev"
+optional = false
+python-versions = ">=3.6"
+
+[package.extras]
+lint = ["flake8", "mypy", "docutils-stubs"]
+test = ["pytest", "html5lib"]
+
+[[package]]
+name = "sphinxcontrib-jsmath"
+version = "1.0.1"
+description = "A sphinx extension which renders display math in HTML via JavaScript"
+category = "dev"
+optional = false
+python-versions = ">=3.5"
+
+[package.extras]
+test = ["pytest", "flake8", "mypy"]
+
+[[package]]
+name = "sphinxcontrib-qthelp"
+version = "1.0.3"
+description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp document."
+category = "dev"
+optional = false
+python-versions = ">=3.5"
+
+[package.extras]
+lint = ["flake8", "mypy", "docutils-stubs"]
+test = ["pytest"]
+
+[[package]]
+name = "sphinxcontrib-serializinghtml"
+version = "1.1.5"
+description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)."
+category = "dev"
+optional = false
+python-versions = ">=3.5"
+
+[package.extras]
+lint = ["flake8", "mypy", "docutils-stubs"]
+test = ["pytest"]
+
[[package]]
name = "toml"
version = "0.10.2"
@@ -330,6 +598,19 @@ category = "dev"
optional = false
python-versions = ">=3.6"
+[[package]]
+name = "urllib3"
+version = "1.26.7"
+description = "HTTP library with thread-safe connection pooling, file post, and more."
+category = "dev"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
+
+[package.extras]
+brotli = ["brotlipy (>=0.6.0)"]
+secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
+socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
+
[[package]]
name = "virtualenv"
version = "20.10.0"
@@ -366,9 +647,13 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytes
[metadata]
lock-version = "1.1"
python-versions = "^3.6"
-content-hash = "d2ccbad1454dffcb826fc5ddffb5efa78534b3ec2cc2e74ae8549de2ea38d0de"
+content-hash = "cb9d8aae19c0bb57669dd490009b46ecf26f584f00f5e03d11757bb8e74ab8f3"
[metadata.files]
+alabaster = [
+ {file = "alabaster-0.7.12-py2.py3-none-any.whl", hash = "sha256:446438bdcca0e05bd45ea2de1668c1d9b032e1a9154c2c259092d77031ddd359"},
+ {file = "alabaster-0.7.12.tar.gz", hash = "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02"},
+]
atomicwrites = [
{file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"},
{file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"},
@@ -377,14 +662,30 @@ attrs = [
{file = "attrs-21.2.0-py2.py3-none-any.whl", hash = "sha256:149e90d6d8ac20db7a955ad60cf0e6881a3f20d37096140088356da6c716b0b1"},
{file = "attrs-21.2.0.tar.gz", hash = "sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb"},
]
+babel = [
+ {file = "Babel-2.9.1-py2.py3-none-any.whl", hash = "sha256:ab49e12b91d937cd11f0b67cb259a57ab4ad2b59ac7a3b41d6c06c0ac5b0def9"},
+ {file = "Babel-2.9.1.tar.gz", hash = "sha256:bc0c176f9f6a994582230df350aa6e05ba2ebe4b3ac317eab29d9be5d2768da0"},
+]
"backports.entry-points-selectable" = [
{file = "backports.entry_points_selectable-1.1.1-py2.py3-none-any.whl", hash = "sha256:7fceed9532a7aa2bd888654a7314f864a3c16a4e710b34a58cfc0f08114c663b"},
{file = "backports.entry_points_selectable-1.1.1.tar.gz", hash = "sha256:914b21a479fde881635f7af5adc7f6e38d6b274be32269070c53b698c60d5386"},
]
+beautifulsoup4 = [
+ {file = "beautifulsoup4-4.10.0-py3-none-any.whl", hash = "sha256:9a315ce70049920ea4572a4055bc4bd700c940521d36fc858205ad4fcde149bf"},
+ {file = "beautifulsoup4-4.10.0.tar.gz", hash = "sha256:c23ad23c521d818955a4151a67d81580319d4bf548d3d49f4223ae041ff98891"},
+]
+certifi = [
+ {file = "certifi-2021.10.8-py2.py3-none-any.whl", hash = "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"},
+ {file = "certifi-2021.10.8.tar.gz", hash = "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872"},
+]
cfgv = [
{file = "cfgv-3.3.1-py2.py3-none-any.whl", hash = "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426"},
{file = "cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"},
]
+charset-normalizer = [
+ {file = "charset-normalizer-2.0.9.tar.gz", hash = "sha256:b0b883e8e874edfdece9c28f314e3dd5badf067342e42fb162203335ae61aa2c"},
+ {file = "charset_normalizer-2.0.9-py3-none-any.whl", hash = "sha256:1eecaa09422db5be9e29d7fc65664e6c33bd06f9ced7838578ba40d58bdf3721"},
+]
colorama = [
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
{file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
@@ -442,14 +743,30 @@ distlib = [
{file = "distlib-0.3.4-py2.py3-none-any.whl", hash = "sha256:6564fe0a8f51e734df6333d08b8b94d4ea8ee6b99b5ed50613f731fd4089f34b"},
{file = "distlib-0.3.4.zip", hash = "sha256:e4b58818180336dc9c529bfb9a0b58728ffc09ad92027a3f30b7cd91e3458579"},
]
+docutils = [
+ {file = "docutils-0.17.1-py2.py3-none-any.whl", hash = "sha256:cf316c8370a737a022b72b56874f6602acf974a37a9fba42ec2876387549fc61"},
+ {file = "docutils-0.17.1.tar.gz", hash = "sha256:686577d2e4c32380bb50cbb22f575ed742d58168cee37e99117a854bcd88f125"},
+]
filelock = [
{file = "filelock-3.4.0-py3-none-any.whl", hash = "sha256:2e139a228bcf56dd8b2274a65174d005c4a6b68540ee0bdbb92c76f43f29f7e8"},
{file = "filelock-3.4.0.tar.gz", hash = "sha256:93d512b32a23baf4cac44ffd72ccf70732aeff7b8050fcaf6d3ec406d954baf4"},
]
+furo = [
+ {file = "furo-2021.11.23-py3-none-any.whl", hash = "sha256:6d396451ad1aadce380c662fca9362cb10f4fd85f296d74fe3ca32006eb641d7"},
+ {file = "furo-2021.11.23.tar.gz", hash = "sha256:54cecac5f3b688b5c7370d72ecdf1cd91a6c53f0f42751f4a719184b562cde70"},
+]
identify = [
{file = "identify-2.4.0-py2.py3-none-any.whl", hash = "sha256:eba31ca80258de6bb51453084bff4a923187cd2193b9c13710f2516ab30732cc"},
{file = "identify-2.4.0.tar.gz", hash = "sha256:a33ae873287e81651c7800ca309dc1f84679b763c9c8b30680e16fbfa82f0107"},
]
+idna = [
+ {file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"},
+ {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"},
+]
+imagesize = [
+ {file = "imagesize-1.3.0-py2.py3-none-any.whl", hash = "sha256:1db2f82529e53c3e929e8926a1fa9235aa82d0bd0c580359c67ec31b2fddaa8c"},
+ {file = "imagesize-1.3.0.tar.gz", hash = "sha256:cd1750d452385ca327479d45b64d9c7729ecf0b3969a58148298c77092261f9d"},
+]
importlib-metadata = [
{file = "importlib_metadata-4.8.3-py3-none-any.whl", hash = "sha256:65a9576a5b2d58ca44d133c42a241905cc45e34d2c06fd5ba2bafa221e5d7b5e"},
{file = "importlib_metadata-4.8.3.tar.gz", hash = "sha256:766abffff765960fcc18003801f7044eb6755ffae4521c8e8ce8e83b9c9b0668"},
@@ -462,6 +779,81 @@ iniconfig = [
{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},
{file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"},
]
+jinja2 = [
+ {file = "Jinja2-3.0.3-py3-none-any.whl", hash = "sha256:077ce6014f7b40d03b47d1f1ca4b0fc8328a692bd284016f806ed0eaca390ad8"},
+ {file = "Jinja2-3.0.3.tar.gz", hash = "sha256:611bb273cd68f3b993fabdc4064fc858c5b47a973cb5aa7999ec1ba405c87cd7"},
+]
+markupsafe = [
+ {file = "MarkupSafe-2.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d8446c54dc28c01e5a2dbac5a25f071f6653e6e40f3a8818e8b45d790fe6ef53"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:36bc903cbb393720fad60fc28c10de6acf10dc6cc883f3e24ee4012371399a38"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d7d807855b419fc2ed3e631034685db6079889a1f01d5d9dac950f764da3dad"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:add36cb2dbb8b736611303cd3bfcee00afd96471b09cda130da3581cbdc56a6d"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:4dc8f9fb58f7364b63fd9f85013b780ef83c11857ae79f2feda41e270468dd9b"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:20dca64a3ef2d6e4d5d615a3fd418ad3bde77a47ec8a23d984a12b5b4c74491a"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:cdfba22ea2f0029c9261a4bd07e830a8da012291fbe44dc794e488b6c9bb353a"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-win32.whl", hash = "sha256:99df47edb6bda1249d3e80fdabb1dab8c08ef3975f69aed437cb69d0a5de1e28"},
+ {file = "MarkupSafe-2.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:e0f138900af21926a02425cf736db95be9f4af72ba1bb21453432a07f6082134"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf5d821ffabf0ef3533c39c518f3357b171a1651c1ff6827325e4489b0e46c3c"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:0d4b31cc67ab36e3392bbf3862cfbadac3db12bdd8b02a2731f509ed5b829724"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:baa1a4e8f868845af802979fcdbf0bb11f94f1cb7ced4c4b8a351bb60d108145"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:deb993cacb280823246a026e3b2d81c493c53de6acfd5e6bfe31ab3402bb37dd"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:63f3268ba69ace99cab4e3e3b5840b03340efed0948ab8f78d2fd87ee5442a4f"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:8d206346619592c6200148b01a2142798c989edcb9c896f9ac9722a99d4e77e6"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-win32.whl", hash = "sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d"},
+ {file = "MarkupSafe-2.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e9936f0b261d4df76ad22f8fee3ae83b60d7c3e871292cd42f40b81b70afae85"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:2a7d351cbd8cfeb19ca00de495e224dea7e7d919659c2841bbb7f420ad03e2d6"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:60bf42e36abfaf9aff1f50f52644b336d4f0a3fd6d8a60ca0d054ac9f713a864"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:d6c7ebd4e944c85e2c3421e612a7057a2f48d478d79e61800d81468a8d842207"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:f0567c4dc99f264f49fe27da5f735f414c4e7e7dd850cfd8e69f0862d7c74ea9"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:89c687013cb1cd489a0f0ac24febe8c7a666e6e221b783e53ac50ebf68e45d86"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-win32.whl", hash = "sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415"},
+ {file = "MarkupSafe-2.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:5bb28c636d87e840583ee3adeb78172efc47c8b26127267f54a9c0ec251d41a9"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6fcf051089389abe060c9cd7caa212c707e58153afa2c649f00346ce6d260f1b"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:5855f8438a7d1d458206a2466bf82b0f104a3724bf96a1c781ab731e4201731a"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:3dd007d54ee88b46be476e293f48c85048603f5f516008bee124ddd891398ed6"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:aca6377c0cb8a8253e493c6b451565ac77e98c2951c45f913e0b52facdcff83f"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:04635854b943835a6ea959e948d19dcd311762c5c0c6e1f0e16ee57022669194"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6300b8454aa6930a24b9618fbb54b5a68135092bc666f7b06901f897fa5c2fee"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-win32.whl", hash = "sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64"},
+ {file = "MarkupSafe-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c47adbc92fc1bb2b3274c4b3a43ae0e4573d9fbff4f54cd484555edbf030baf1"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:37205cac2a79194e3750b0af2a5720d95f786a55ce7df90c3af697bfa100eaac"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:1f2ade76b9903f39aa442b4aadd2177decb66525062db244b35d71d0ee8599b6"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:4296f2b1ce8c86a6aea78613c34bb1a672ea0e3de9c6ba08a960efe0b0a09047"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9f02365d4e99430a12647f09b6cc8bab61a6564363f313126f775eb4f6ef798e"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5b6d930f030f8ed98e3e6c98ffa0652bdb82601e7a016ec2ab5d7ff23baa78d1"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-win32.whl", hash = "sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74"},
+ {file = "MarkupSafe-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8"},
+ {file = "MarkupSafe-2.0.1.tar.gz", hash = "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"},
+]
mypy = [
{file = "mypy-0.920-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:41f3575b20714171c832d8f6c7aaaa0d499c9a2d1b8adaaf837b4c9065c38540"},
{file = "mypy-0.920-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:431be889ffc8d9681813a45575c42e341c19467cbfa6dd09bf41467631feb530"},
@@ -512,6 +904,10 @@ py = [
{file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"},
{file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"},
]
+pygments = [
+ {file = "Pygments-2.10.0-py3-none-any.whl", hash = "sha256:b8e67fe6af78f492b3c4b3e2970c0624cbf08beb1e493b2c99b9fa1b67a20380"},
+ {file = "Pygments-2.10.0.tar.gz", hash = "sha256:f398865f7eb6874156579fdf36bc840a03cab64d1cde9e93d68f46a425ec52c6"},
+]
pyparsing = [
{file = "pyparsing-3.0.6-py3-none-any.whl", hash = "sha256:04ff808a5b90911829c55c4e26f75fa5ca8a2f5f36aa3a51f68e27033341d3e4"},
{file = "pyparsing-3.0.6.tar.gz", hash = "sha256:d9bdec0013ef1eb5a84ab39a3b3868911598afa494f5faa038647101504e2b81"},
@@ -524,6 +920,10 @@ pytest-cov = [
{file = "pytest-cov-3.0.0.tar.gz", hash = "sha256:e7f0f5b1617d2210a2cabc266dfe2f4c75a8d32fb89eafb7ad9d06f6d076d470"},
{file = "pytest_cov-3.0.0-py3-none-any.whl", hash = "sha256:578d5d15ac4a25e5f961c938b85a05b09fdaae9deef3bb6de9a6e766622ca7a6"},
]
+pytz = [
+ {file = "pytz-2021.3-py2.py3-none-any.whl", hash = "sha256:3672058bc3453457b622aab7a1c3bfd5ab0bdae451512f6cf25f64ed37f5b87c"},
+ {file = "pytz-2021.3.tar.gz", hash = "sha256:acad2d8b20a1af07d4e4c9d2e9285c5ed9104354062f275f3fcd88dcef4f1326"},
+]
pyyaml = [
{file = "PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"},
{file = "PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c"},
@@ -559,10 +959,50 @@ pyyaml = [
{file = "PyYAML-6.0-cp39-cp39-win_amd64.whl", hash = "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c"},
{file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"},
]
+requests = [
+ {file = "requests-2.26.0-py2.py3-none-any.whl", hash = "sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24"},
+ {file = "requests-2.26.0.tar.gz", hash = "sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7"},
+]
six = [
{file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"},
{file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"},
]
+snowballstemmer = [
+ {file = "snowballstemmer-2.2.0-py2.py3-none-any.whl", hash = "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"},
+ {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"},
+]
+soupsieve = [
+ {file = "soupsieve-2.3.1-py3-none-any.whl", hash = "sha256:1a3cca2617c6b38c0343ed661b1fa5de5637f257d4fe22bd9f1338010a1efefb"},
+ {file = "soupsieve-2.3.1.tar.gz", hash = "sha256:b8d49b1cd4f037c7082a9683dfa1801aa2597fb11c3a1155b7a5b94829b4f1f9"},
+]
+sphinx = [
+ {file = "Sphinx-4.3.2-py3-none-any.whl", hash = "sha256:6a11ea5dd0bdb197f9c2abc2e0ce73e01340464feaece525e64036546d24c851"},
+ {file = "Sphinx-4.3.2.tar.gz", hash = "sha256:0a8836751a68306b3fe97ecbe44db786f8479c3bf4b80e3a7f5c838657b4698c"},
+]
+sphinxcontrib-applehelp = [
+ {file = "sphinxcontrib-applehelp-1.0.2.tar.gz", hash = "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"},
+ {file = "sphinxcontrib_applehelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a"},
+]
+sphinxcontrib-devhelp = [
+ {file = "sphinxcontrib-devhelp-1.0.2.tar.gz", hash = "sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4"},
+ {file = "sphinxcontrib_devhelp-1.0.2-py2.py3-none-any.whl", hash = "sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e"},
+]
+sphinxcontrib-htmlhelp = [
+ {file = "sphinxcontrib-htmlhelp-2.0.0.tar.gz", hash = "sha256:f5f8bb2d0d629f398bf47d0d69c07bc13b65f75a81ad9e2f71a63d4b7a2f6db2"},
+ {file = "sphinxcontrib_htmlhelp-2.0.0-py2.py3-none-any.whl", hash = "sha256:d412243dfb797ae3ec2b59eca0e52dac12e75a241bf0e4eb861e450d06c6ed07"},
+]
+sphinxcontrib-jsmath = [
+ {file = "sphinxcontrib-jsmath-1.0.1.tar.gz", hash = "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"},
+ {file = "sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl", hash = "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178"},
+]
+sphinxcontrib-qthelp = [
+ {file = "sphinxcontrib-qthelp-1.0.3.tar.gz", hash = "sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72"},
+ {file = "sphinxcontrib_qthelp-1.0.3-py2.py3-none-any.whl", hash = "sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6"},
+]
+sphinxcontrib-serializinghtml = [
+ {file = "sphinxcontrib-serializinghtml-1.1.5.tar.gz", hash = "sha256:aa5f6de5dfdf809ef505c4895e51ef5c9eac17d0f287933eb49ec495280b6952"},
+ {file = "sphinxcontrib_serializinghtml-1.1.5-py2.py3-none-any.whl", hash = "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd"},
+]
toml = [
{file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"},
{file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"},
@@ -596,6 +1036,10 @@ typing-extensions = [
{file = "typing_extensions-4.0.1-py3-none-any.whl", hash = "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b"},
{file = "typing_extensions-4.0.1.tar.gz", hash = "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"},
]
+urllib3 = [
+ {file = "urllib3-1.26.7-py2.py3-none-any.whl", hash = "sha256:c4fdf4019605b6e5423637e01bc9fe4daef873709a7973e195ceba0a62bbc844"},
+ {file = "urllib3-1.26.7.tar.gz", hash = "sha256:4987c65554f7a2dbf30c18fd48778ef124af6fab771a377103da0585e2336ece"},
+]
virtualenv = [
{file = "virtualenv-20.10.0-py2.py3-none-any.whl", hash = "sha256:4b02e52a624336eece99c96e3ab7111f469c24ba226a53ec474e8e787b365814"},
{file = "virtualenv-20.10.0.tar.gz", hash = "sha256:576d05b46eace16a9c348085f7d0dc8ef28713a2cabaa1cf0aea41e8f12c9218"},
diff --git a/pyproject.toml b/pyproject.toml
index 9690556e..f76be36f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -24,6 +24,8 @@ pytest-cov = "^3.0.0"
PyYAML = "^6.0"
pre-commit = {version = "^2.1.0", python = "^3.6.1"}
mypy = "^0.920"
+Sphinx = "^4.3.2"
+furo = "^2021.11.23"
[tool.black]
line-length = 88
diff --git a/tomlkit/api.py b/tomlkit/api.py
index 6e0a9f9f..9a58be1e 100644
--- a/tomlkit/api.py
+++ b/tomlkit/api.py
@@ -31,7 +31,7 @@
from .toml_document import TOMLDocument
-def loads(string: str) -> TOMLDocument:
+def loads(string: Union[str, bytes]) -> TOMLDocument:
"""
Parses a string into a TOMLDocument.
@@ -66,13 +66,16 @@ def load(fp: IO) -> TOMLDocument:
def dump(data: Mapping, fp: IO[str], *, sort_keys: bool = False) -> None:
"""
Dump a TOMLDocument into a writable file stream.
+
+ :param data: a dict-like object to dump
+ :param sort_keys: if true, sort the keys in alphabetic order
"""
fp.write(dumps(data, sort_keys=sort_keys))
-def parse(string: str) -> TOMLDocument:
+def parse(string: Union[str, bytes]) -> TOMLDocument:
"""
- Parses a string into a TOMLDocument.
+ Parses a string or bytes into a TOMLDocument.
"""
return Parser(string).parse()
@@ -85,23 +88,28 @@ def document() -> TOMLDocument:
# Items
-def integer(raw: str) -> Integer:
+def integer(raw: Union[str, int]) -> Integer:
+ """Create an integer item from a number or string."""
return item(int(raw))
-def float_(raw: str) -> Float:
+def float_(raw: Union[str, float]) -> Float:
+ """Create an float item from a number or string."""
return item(float(raw))
def boolean(raw: str) -> Bool:
+ """Turn `true` or `false` into a boolean item."""
return item(raw == "true")
def string(raw: str) -> String:
+ """Create a string item."""
return item(raw)
def date(raw: str) -> Date:
+ """Create a TOML date."""
value = parse_rfc3339(raw)
if not isinstance(value, _datetime.date):
raise ValueError("date() only accepts date strings.")
@@ -110,6 +118,7 @@ def date(raw: str) -> Date:
def time(raw: str) -> Time:
+ """Create a TOML time."""
value = parse_rfc3339(raw)
if not isinstance(value, _datetime.time):
raise ValueError("time() only accepts time strings.")
@@ -118,6 +127,7 @@ def time(raw: str) -> Time:
def datetime(raw: str) -> DateTime:
+ """Create a TOML datetime."""
value = parse_rfc3339(raw)
if not isinstance(value, _datetime.datetime):
raise ValueError("datetime() only accepts datetime strings.")
@@ -126,6 +136,17 @@ def datetime(raw: str) -> DateTime:
def array(raw: str = None) -> Array:
+ """Create an array item for its string representation.
+
+ :Example:
+
+ >>> array("[1, 2, 3]") # Create from a string
+ [1, 2, 3]
+ >>> a = array()
+ >>> a.extend([1, 2, 3]) # Create from a list
+ >>> a
+ [1, 2, 3]
+ """
if raw is None:
raw = "[]"
@@ -133,38 +154,108 @@ def array(raw: str = None) -> Array:
def table(is_super_table: bool = False) -> Table:
+ """Create an empty table.
+
+ :param is_super_table: if true, the table is a super table
+
+ :Example:
+
+ >>> doc = document()
+ >>> foo = table(True)
+ >>> bar = table()
+ >>> bar.update({'x': 1})
+ >>> foo.append('bar', bar)
+ >>> doc.append('foo', foo)
+ >>> print(doc.as_string())
+ [foo.bar]
+ x = 1
+ """
return Table(Container(), Trivia(), False, is_super_table)
def inline_table() -> InlineTable:
+ """Create an inline table.
+
+ :Example:
+
+ >>> table = inline_table()
+ >>> table.update({'x': 1, 'y': 2})
+ >>> print(table.as_string())
+ {x = 1, y = 2}
+ """
return InlineTable(Container(), Trivia(), new=True)
def aot() -> AoT:
+ """Create an array of table.
+
+ :Example:
+
+ >>> doc = document()
+ >>> aot = aot()
+ >>> aot.append(item({'x': 1}))
+ >>> doc.append('foo', aot)
+ >>> print(doc.as_string())
+ [[foo]]
+ x = 1
+ """
return AoT([])
def key(k: Union[str, Iterable[str]]) -> Key:
+ """Create a key from a string. When a list of string is given,
+ it will create a dotted key.
+
+ :Example:
+
+ >>> doc = document()
+ >>> doc.append(key('foo'), 1)
+ >>> doc.append(key(['bar', 'baz']), 2)
+ >>> print(doc.as_string())
+ foo = 1
+ bar.baz = 2
+ """
if isinstance(k, str):
return SingleKey(k)
return DottedKey([key(_k) for _k in k])
def value(raw: str) -> _Item:
+ """Parse a simple value from a string.
+
+ :Example:
+
+ >>> value("1")
+ 1
+ >>> value("true")
+ True
+ >>> value("[1, 2, 3]")
+ [1, 2, 3]
+ """
return Parser(raw)._parse_value()
def key_value(src: str) -> Tuple[Key, _Item]:
+ """Parse a key-value pair from a string.
+
+ :Example:
+
+ >>> key_value("foo = 1")
+ (Key('foo'), 1)
+ """
return Parser(src)._parse_key_value()
def ws(src: str) -> Whitespace:
+ """Create a whitespace from a string."""
return Whitespace(src, fixed=True)
def nl() -> Whitespace:
+ """Create a newline item."""
return ws("\n")
def comment(string: str) -> Comment:
+ """Create a comment item."""
return Comment(Trivia(comment_ws=" ", comment="# " + string))
diff --git a/tomlkit/container.py b/tomlkit/container.py
index ecd2aae0..c6a4d8a4 100644
--- a/tomlkit/container.py
+++ b/tomlkit/container.py
@@ -32,6 +32,8 @@
class Container(_CustomDict):
"""
A container for items within a TOMLDocument.
+
+ This class implements the `dict` interface with copy/deepcopy protocol.
"""
def __init__(self, parsed: bool = False) -> None:
@@ -79,6 +81,13 @@ def add(
) -> "Container":
"""
Adds an item to the current Container.
+
+ :Example:
+
+ >>> # add a key-value pair
+ >>> doc.add('key', 'value')
+ >>> # add a comment or whitespace or newline
+ >>> doc.add(comment('# comment'))
"""
if item is None:
if not isinstance(key, (Comment, Whitespace)):
@@ -149,6 +158,7 @@ def _handle_dotted_key(self, key: Key, value: Item) -> None:
table = table[_name]
def append(self, key: Union[Key, str, None], item: Item) -> "Container":
+ """Similar to :meth:`add` but both key and value must be given."""
if not isinstance(key, Key) and key is not None:
key = SingleKey(key)
@@ -318,6 +328,7 @@ def append(self, key: Union[Key, str, None], item: Item) -> "Container":
return self
def remove(self, key: Union[Key, str]) -> "Container":
+ """Remove a key from the container."""
if not isinstance(key, Key):
key = SingleKey(key)
@@ -424,6 +435,7 @@ def _insert_at(self, idx: int, key: Union[Key, str], item: Any) -> "Container":
return self
def item(self, key: Union[Key, str]) -> Item:
+ """Get an item for the given key."""
if not isinstance(key, Key):
key = SingleKey(key)
@@ -440,10 +452,12 @@ def item(self, key: Union[Key, str]) -> Item:
return self._body[idx][1]
def last_item(self) -> Optional[Item]:
+ """Get the last item."""
if self._body:
return self._body[-1][1]
def as_string(self) -> str:
+ """Render as TOML string."""
s = ""
for k, v in self._body:
if k is not None:
diff --git a/tomlkit/items.py b/tomlkit/items.py
index 41c31577..ae6b9022 100644
--- a/tomlkit/items.py
+++ b/tomlkit/items.py
@@ -55,7 +55,22 @@ class _CustomDict(MutableMapping, dict):
"""Adds MutableMapping mixin while pretending to be a builtin dict"""
-def item(value, _parent=None, _sort_keys=False):
+def item(
+ value: Any, _parent: Optional["Item"] = None, _sort_keys: bool = False
+) -> "Item":
+ """Create a TOML item from a Python object.
+
+ :Example:
+
+ >>> item(42)
+ 42
+ >>> item([1, 2, 3])
+ [1, 2, 3]
+ >>> item({'a': 1, 'b': 2})
+ a = 1
+ b = 2
+ """
+
from .container import Container
if isinstance(value, Item):
@@ -235,6 +250,8 @@ class KeyType(Enum):
class Key(abc.ABC):
+ """Base class for a key"""
+
sep: str
_original: str
_keys: List["SingleKey"]
@@ -250,19 +267,23 @@ def __eq__(self, __o: object) -> bool:
pass
def is_dotted(self) -> bool:
+ """If the key is followed by other keys"""
return self._dotted
def __iter__(self) -> Iterator["SingleKey"]:
return iter(self._keys)
def concat(self, other: "Key") -> "DottedKey":
+ """Concatenate keys into a dotted key"""
keys = self._keys + other._keys
return DottedKey(keys, sep=self.sep)
def is_multi(self) -> bool:
+ """Check if the key contains multiple keys"""
return len(self._keys) > 1
def as_string(self) -> str:
+ """The TOML representation"""
return self._original
def __str__(self) -> str:
@@ -306,9 +327,11 @@ def __init__(
@property
def delimiter(self) -> str:
+ """The delimiter: double quote/single quote/none"""
return self.t.value
def is_bare(self) -> bool:
+ """Check if the key is bare"""
return self.t == KeyType.Bare
def __hash__(self) -> int:
@@ -354,6 +377,7 @@ def __init__(self, trivia: Trivia) -> None:
@property
def trivia(self) -> Trivia:
+ """The trivia element associated with this item"""
return self._trivia
@property
@@ -361,11 +385,13 @@ def discriminant(self) -> int:
raise NotImplementedError()
def as_string(self) -> str:
+ """The TOML representation"""
raise NotImplementedError()
# Helpers
def comment(self, comment: str) -> "Item":
+ """Attach a comment to this item"""
if not comment.strip().startswith("#"):
comment = "# " + comment
@@ -375,6 +401,7 @@ def comment(self, comment: str) -> "Item":
return self
def indent(self, indent: int) -> "Item":
+ """Indent this item with given number of spaces"""
if self._trivia.indent.startswith("\n"):
self._trivia.indent = "\n" + " " * indent
else:
@@ -419,6 +446,7 @@ def s(self) -> str:
@property
def value(self) -> str:
+ """The wrapped string of the whitespace"""
return self._s
@property
@@ -430,6 +458,7 @@ def discriminant(self) -> int:
return 0
def is_fixed(self) -> bool:
+ """If the whitespace is fixed, it can't be merged or discarded from the output."""
return self._fixed
def as_string(self) -> str:
@@ -483,6 +512,7 @@ def discriminant(self) -> int:
@property
def value(self) -> int:
+ """The wrapped integer value"""
return self
def as_string(self) -> str:
@@ -550,6 +580,7 @@ def discriminant(self) -> int:
@property
def value(self) -> float:
+ """The wrapped float value"""
return self
def as_string(self) -> str:
@@ -610,6 +641,7 @@ def discriminant(self) -> int:
@property
def value(self) -> bool:
+ """The wrapped boolean value"""
return self._value
def as_string(self) -> str:
@@ -896,6 +928,20 @@ def value(self) -> list:
return self
def multiline(self, multiline: bool) -> "Array":
+ """Change the array to display in multiline or not.
+
+ :Example:
+
+ >>> a = item([1, 2, 3])
+ >>> print(a.as_string())
+ [1, 2, 3]
+ >>> print(a.multiline(True).as_string())
+ [
+ 1,
+ 2,
+ 3,
+ ]
+ """
self._multiline = multiline
return self
@@ -930,9 +976,21 @@ def add_line(
add_comma: bool = True,
newline: bool = True,
) -> None:
- """Add multiple items in a line.
+ """Add multiple items in a line to control the format precisely.
When add_comma is True, only accept actual values and
", " will be added between values automatically.
+
+ :Example:
+
+ >>> a = array()
+ >>> a.add_line(1, 2, 3)
+ >>> a.add_line(4, 5, 6)
+ >>> a.add_line(indent="")
+ >>> print(a.as_string())
+ [
+ 1, 2, 3,
+ 4, 5, 6,
+ ]
"""
values = self._value[:]
new_values = []
@@ -977,6 +1035,7 @@ def append_item(el: Item) -> None:
self._reindex()
def clear(self) -> None:
+ """Clear the array."""
list.clear(self)
self._value.clear()
@@ -1246,7 +1305,7 @@ def append(self, key, _item):
if key is not None:
dict.__setitem__(self, key, _item)
- m = re.match("(?s)^[^ ]*([ ]+).*$", self._trivia.indent)
+ m = re.match(r"(?s)^[^ ]*([ ]+).*$", self._trivia.indent)
if not m:
return self
@@ -1262,6 +1321,7 @@ def append(self, key, _item):
return self
def raw_append(self, key: Union[Key, str], _item: Any) -> "Table":
+ """Similar to :meth:`append` but does not copy indentation."""
if not isinstance(_item, Item):
_item = item(_item)
@@ -1277,9 +1337,12 @@ def raw_append(self, key: Union[Key, str], _item: Any) -> "Table":
return self
def is_aot_element(self) -> bool:
+ """True if the table is the direct child of an AOT element."""
return self._is_aot_element
def is_super_table(self) -> bool:
+ """A super table is the intermediate parent of a nested table as in [a.b.c].
+ If true, it won't appear in the TOML representation."""
return self._is_super_table
def as_string(self) -> str:
@@ -1288,6 +1351,7 @@ def as_string(self) -> str:
# Helpers
def indent(self, indent: int) -> "Table":
+ """Indent the table with given number of spaces."""
super().indent(indent)
m = re.match("(?s)^[^ ]*([ ]+).*$", self._trivia.indent)
diff --git a/tomlkit/toml_file.py b/tomlkit/toml_file.py
index 6fa211a3..47c9f2c2 100644
--- a/tomlkit/toml_file.py
+++ b/tomlkit/toml_file.py
@@ -5,15 +5,19 @@
class TOMLFile:
"""
Represents a TOML file.
+
+ :param path: path to the TOML file
"""
def __init__(self, path: str) -> None:
self._path = path
def read(self) -> TOMLDocument:
+ """Read the file content as a :class:`tomlkit.toml_document.TOMLDocument`."""
with open(self._path, encoding="utf-8", newline="") as f:
return loads(f.read())
def write(self, data: TOMLDocument) -> None:
+ """Write the TOMLDocument to the file."""
with open(self._path, "w", encoding="utf-8", newline="") as f:
f.write(data.as_string())