Initial commit
This commit is contained in:
@@ -0,0 +1,179 @@
|
||||
****
|
||||
TOML
|
||||
****
|
||||
|
||||
.. image:: https://badge.fury.io/py/toml.svg
|
||||
:target: https://badge.fury.io/py/toml
|
||||
|
||||
.. image:: https://travis-ci.org/uiri/toml.svg?branch=master
|
||||
:target: https://travis-ci.org/uiri/toml
|
||||
|
||||
.. image:: https://img.shields.io/pypi/pyversions/toml.svg
|
||||
:target: https://pypi.org/project/toml/
|
||||
|
||||
|
||||
A Python library for parsing and creating `TOML <https://en.wikipedia.org/wiki/TOML>`_.
|
||||
|
||||
The module passes `the TOML test suite <https://github.com/BurntSushi/toml-test>`_.
|
||||
|
||||
See also:
|
||||
|
||||
* `The TOML Standard <https://github.com/toml-lang/toml>`_
|
||||
* `The currently supported TOML specification <https://github.com/toml-lang/toml/blob/v0.5.0/README.md>`_
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
To install the latest release on `PyPI <https://pypi.org/project/toml/>`_,
|
||||
simply run:
|
||||
|
||||
::
|
||||
|
||||
pip install toml
|
||||
|
||||
Or to install the latest development version, run:
|
||||
|
||||
::
|
||||
|
||||
git clone https://github.com/uiri/toml.git
|
||||
cd toml
|
||||
python setup.py install
|
||||
|
||||
Quick Tutorial
|
||||
==============
|
||||
|
||||
*toml.loads* takes in a string containing standard TOML-formatted data and
|
||||
returns a dictionary containing the parsed data.
|
||||
|
||||
.. code:: pycon
|
||||
|
||||
>>> import toml
|
||||
>>> toml_string = """
|
||||
... # This is a TOML document.
|
||||
...
|
||||
... title = "TOML Example"
|
||||
...
|
||||
... [owner]
|
||||
... name = "Tom Preston-Werner"
|
||||
... dob = 1979-05-27T07:32:00-08:00 # First class dates
|
||||
...
|
||||
... [database]
|
||||
... server = "192.168.1.1"
|
||||
... ports = [ 8001, 8001, 8002 ]
|
||||
... connection_max = 5000
|
||||
... enabled = true
|
||||
...
|
||||
... [servers]
|
||||
...
|
||||
... # Indentation (tabs and/or spaces) is allowed but not required
|
||||
... [servers.alpha]
|
||||
... ip = "10.0.0.1"
|
||||
... dc = "eqdc10"
|
||||
...
|
||||
... [servers.beta]
|
||||
... ip = "10.0.0.2"
|
||||
... dc = "eqdc10"
|
||||
...
|
||||
... [clients]
|
||||
... data = [ ["gamma", "delta"], [1, 2] ]
|
||||
...
|
||||
... # Line breaks are OK when inside arrays
|
||||
... hosts = [
|
||||
... "alpha",
|
||||
... "omega"
|
||||
... ]
|
||||
... """
|
||||
>>> parsed_toml = toml.loads(toml_string)
|
||||
|
||||
|
||||
*toml.dumps* takes a dictionary and returns a string containing the
|
||||
corresponding TOML-formatted data.
|
||||
|
||||
.. code:: pycon
|
||||
|
||||
>>> new_toml_string = toml.dumps(parsed_toml)
|
||||
>>> print(new_toml_string)
|
||||
title = "TOML Example"
|
||||
[owner]
|
||||
name = "Tom Preston-Werner"
|
||||
dob = 1979-05-27T07:32:00Z
|
||||
[database]
|
||||
server = "192.168.1.1"
|
||||
ports = [ 8001, 8001, 8002,]
|
||||
connection_max = 5000
|
||||
enabled = true
|
||||
[clients]
|
||||
data = [ [ "gamma", "delta",], [ 1, 2,],]
|
||||
hosts = [ "alpha", "omega",]
|
||||
[servers.alpha]
|
||||
ip = "10.0.0.1"
|
||||
dc = "eqdc10"
|
||||
[servers.beta]
|
||||
ip = "10.0.0.2"
|
||||
dc = "eqdc10"
|
||||
|
||||
For more functions, view the API Reference below.
|
||||
|
||||
API Reference
|
||||
=============
|
||||
|
||||
``toml.load(f, _dict=dict)``
|
||||
Parse a file or a list of files as TOML and return a dictionary.
|
||||
|
||||
:Args:
|
||||
* ``f``: A path to a file, list of filepaths (to be read into single
|
||||
object) or a file descriptor
|
||||
* ``_dict``: The class of the dictionary object to be returned
|
||||
|
||||
:Returns:
|
||||
A dictionary (or object ``_dict``) containing parsed TOML data
|
||||
|
||||
:Raises:
|
||||
* ``TypeError``: When ``f`` is an invalid type or is a list containing
|
||||
invalid types
|
||||
* ``TomlDecodeError``: When an error occurs while decoding the file(s)
|
||||
|
||||
``toml.loads(s, _dict=dict)``
|
||||
Parse a TOML-formatted string to a dictionary.
|
||||
|
||||
:Args:
|
||||
* ``s``: The TOML-formatted string to be parsed
|
||||
* ``_dict``: Specifies the class of the returned toml dictionary
|
||||
|
||||
:Returns:
|
||||
A dictionary (or object ``_dict``) containing parsed TOML data
|
||||
|
||||
:Raises:
|
||||
* ``TypeError``: When a non-string object is passed
|
||||
* ``TomlDecodeError``: When an error occurs while decoding the
|
||||
TOML-formatted string
|
||||
|
||||
``toml.dump(o, f)``
|
||||
Write a dictionary to a file containing TOML-formatted data
|
||||
|
||||
:Args:
|
||||
* ``o``: An object to be converted into TOML
|
||||
* ``f``: A File descriptor where the TOML-formatted output should be stored
|
||||
|
||||
:Returns:
|
||||
A string containing the TOML-formatted data corresponding to object ``o``
|
||||
|
||||
:Raises:
|
||||
* ``TypeError``: When anything other than file descriptor is passed
|
||||
|
||||
``toml.dumps(o)``
|
||||
Create a TOML-formatted string from an input object
|
||||
|
||||
:Args:
|
||||
* ``o``: An object to be converted into TOML
|
||||
|
||||
:Returns:
|
||||
A string containing the TOML-formatted data corresponding to object ``o``
|
||||
|
||||
Licensing
|
||||
=========
|
||||
|
||||
This project is released under the terms of the MIT Open Source License. View
|
||||
*LICENSE.txt* for more information.
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,26 @@
|
||||
The MIT License
|
||||
|
||||
Copyright 2013-2018 William Pearson
|
||||
Copyright 2015-2016 Julien Enselme
|
||||
Copyright 2016 Google Inc.
|
||||
Copyright 2017 Samuel Vasko
|
||||
Copyright 2017 Nate Prewitt
|
||||
Copyright 2017 Jack Evans
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
206
venv/lib/python3.8/site-packages/toml-0.10.0.dist-info/METADATA
Normal file
206
venv/lib/python3.8/site-packages/toml-0.10.0.dist-info/METADATA
Normal file
@@ -0,0 +1,206 @@
|
||||
Metadata-Version: 2.0
|
||||
Name: toml
|
||||
Version: 0.10.0
|
||||
Summary: Python Library for Tom's Obvious, Minimal Language
|
||||
Home-page: https://github.com/uiri/toml
|
||||
Author: William Pearson
|
||||
Author-email: uiri@xqz.ca
|
||||
License: MIT
|
||||
Description-Content-Type: UNKNOWN
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 2
|
||||
Classifier: Programming Language :: Python :: 2.6
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.3
|
||||
Classifier: Programming Language :: Python :: 3.4
|
||||
Classifier: Programming Language :: Python :: 3.5
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Programming Language :: Python :: Implementation :: CPython
|
||||
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
||||
|
||||
****
|
||||
TOML
|
||||
****
|
||||
|
||||
.. image:: https://badge.fury.io/py/toml.svg
|
||||
:target: https://badge.fury.io/py/toml
|
||||
|
||||
.. image:: https://travis-ci.org/uiri/toml.svg?branch=master
|
||||
:target: https://travis-ci.org/uiri/toml
|
||||
|
||||
.. image:: https://img.shields.io/pypi/pyversions/toml.svg
|
||||
:target: https://pypi.org/project/toml/
|
||||
|
||||
|
||||
A Python library for parsing and creating `TOML <https://en.wikipedia.org/wiki/TOML>`_.
|
||||
|
||||
The module passes `the TOML test suite <https://github.com/BurntSushi/toml-test>`_.
|
||||
|
||||
See also:
|
||||
|
||||
* `The TOML Standard <https://github.com/toml-lang/toml>`_
|
||||
* `The currently supported TOML specification <https://github.com/toml-lang/toml/blob/v0.5.0/README.md>`_
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
To install the latest release on `PyPI <https://pypi.org/project/toml/>`_,
|
||||
simply run:
|
||||
|
||||
::
|
||||
|
||||
pip install toml
|
||||
|
||||
Or to install the latest development version, run:
|
||||
|
||||
::
|
||||
|
||||
git clone https://github.com/uiri/toml.git
|
||||
cd toml
|
||||
python setup.py install
|
||||
|
||||
Quick Tutorial
|
||||
==============
|
||||
|
||||
*toml.loads* takes in a string containing standard TOML-formatted data and
|
||||
returns a dictionary containing the parsed data.
|
||||
|
||||
.. code:: pycon
|
||||
|
||||
>>> import toml
|
||||
>>> toml_string = """
|
||||
... # This is a TOML document.
|
||||
...
|
||||
... title = "TOML Example"
|
||||
...
|
||||
... [owner]
|
||||
... name = "Tom Preston-Werner"
|
||||
... dob = 1979-05-27T07:32:00-08:00 # First class dates
|
||||
...
|
||||
... [database]
|
||||
... server = "192.168.1.1"
|
||||
... ports = [ 8001, 8001, 8002 ]
|
||||
... connection_max = 5000
|
||||
... enabled = true
|
||||
...
|
||||
... [servers]
|
||||
...
|
||||
... # Indentation (tabs and/or spaces) is allowed but not required
|
||||
... [servers.alpha]
|
||||
... ip = "10.0.0.1"
|
||||
... dc = "eqdc10"
|
||||
...
|
||||
... [servers.beta]
|
||||
... ip = "10.0.0.2"
|
||||
... dc = "eqdc10"
|
||||
...
|
||||
... [clients]
|
||||
... data = [ ["gamma", "delta"], [1, 2] ]
|
||||
...
|
||||
... # Line breaks are OK when inside arrays
|
||||
... hosts = [
|
||||
... "alpha",
|
||||
... "omega"
|
||||
... ]
|
||||
... """
|
||||
>>> parsed_toml = toml.loads(toml_string)
|
||||
|
||||
|
||||
*toml.dumps* takes a dictionary and returns a string containing the
|
||||
corresponding TOML-formatted data.
|
||||
|
||||
.. code:: pycon
|
||||
|
||||
>>> new_toml_string = toml.dumps(parsed_toml)
|
||||
>>> print(new_toml_string)
|
||||
title = "TOML Example"
|
||||
[owner]
|
||||
name = "Tom Preston-Werner"
|
||||
dob = 1979-05-27T07:32:00Z
|
||||
[database]
|
||||
server = "192.168.1.1"
|
||||
ports = [ 8001, 8001, 8002,]
|
||||
connection_max = 5000
|
||||
enabled = true
|
||||
[clients]
|
||||
data = [ [ "gamma", "delta",], [ 1, 2,],]
|
||||
hosts = [ "alpha", "omega",]
|
||||
[servers.alpha]
|
||||
ip = "10.0.0.1"
|
||||
dc = "eqdc10"
|
||||
[servers.beta]
|
||||
ip = "10.0.0.2"
|
||||
dc = "eqdc10"
|
||||
|
||||
For more functions, view the API Reference below.
|
||||
|
||||
API Reference
|
||||
=============
|
||||
|
||||
``toml.load(f, _dict=dict)``
|
||||
Parse a file or a list of files as TOML and return a dictionary.
|
||||
|
||||
:Args:
|
||||
* ``f``: A path to a file, list of filepaths (to be read into single
|
||||
object) or a file descriptor
|
||||
* ``_dict``: The class of the dictionary object to be returned
|
||||
|
||||
:Returns:
|
||||
A dictionary (or object ``_dict``) containing parsed TOML data
|
||||
|
||||
:Raises:
|
||||
* ``TypeError``: When ``f`` is an invalid type or is a list containing
|
||||
invalid types
|
||||
* ``TomlDecodeError``: When an error occurs while decoding the file(s)
|
||||
|
||||
``toml.loads(s, _dict=dict)``
|
||||
Parse a TOML-formatted string to a dictionary.
|
||||
|
||||
:Args:
|
||||
* ``s``: The TOML-formatted string to be parsed
|
||||
* ``_dict``: Specifies the class of the returned toml dictionary
|
||||
|
||||
:Returns:
|
||||
A dictionary (or object ``_dict``) containing parsed TOML data
|
||||
|
||||
:Raises:
|
||||
* ``TypeError``: When a non-string object is passed
|
||||
* ``TomlDecodeError``: When an error occurs while decoding the
|
||||
TOML-formatted string
|
||||
|
||||
``toml.dump(o, f)``
|
||||
Write a dictionary to a file containing TOML-formatted data
|
||||
|
||||
:Args:
|
||||
* ``o``: An object to be converted into TOML
|
||||
* ``f``: A File descriptor where the TOML-formatted output should be stored
|
||||
|
||||
:Returns:
|
||||
A string containing the TOML-formatted data corresponding to object ``o``
|
||||
|
||||
:Raises:
|
||||
* ``TypeError``: When anything other than file descriptor is passed
|
||||
|
||||
``toml.dumps(o)``
|
||||
Create a TOML-formatted string from an input object
|
||||
|
||||
:Args:
|
||||
* ``o``: An object to be converted into TOML
|
||||
|
||||
:Returns:
|
||||
A string containing the TOML-formatted data corresponding to object ``o``
|
||||
|
||||
Licensing
|
||||
=========
|
||||
|
||||
This project is released under the terms of the MIT Open Source License. View
|
||||
*LICENSE.txt* for more information.
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
__pycache__/toml.cpython-38.pyc,,
|
||||
toml-0.10.0.dist-info/DESCRIPTION.rst,sha256=jhN7fjMTebcKKR-kHI3JPwlDyDaNXefdR4dEFIx33JM,4379
|
||||
toml-0.10.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
toml-0.10.0.dist-info/LICENSE.txt,sha256=qHnMQ8BqyhGto29xyNtyV0Sf9EUYdKCQPxKZIMZvzy0,1220
|
||||
toml-0.10.0.dist-info/METADATA,sha256=5wbaUeICU4iO6-K9LAuJFJ8zc34bHdDAmVG6FRQ4uis,5472
|
||||
toml-0.10.0.dist-info/RECORD,,
|
||||
toml-0.10.0.dist-info/WHEEL,sha256=AvR0WeTpDaxT645bl5FQxUK6NPsTls2ttpcGJg3j1Xg,110
|
||||
toml-0.10.0.dist-info/metadata.json,sha256=ILZk8X9gJbxCo5jdYcWLl167nrRhYs-zD2uWsXFU0h0,1183
|
||||
toml-0.10.0.dist-info/top_level.txt,sha256=2BO8ZRNnvJWgXyiQv66LBb_v87qBzcoUtEBefA75Ouk,5
|
||||
toml.py,sha256=D8pTQbgSGge2nDdpsAk8_C7UGJeva0qFq2tGGNaE70Q,35675
|
||||
toml/__init__.py,sha256=mRYusLs27dO-_F9Lh-yow4IYsGLu4fOD8Ywqtf76VDI,503
|
||||
toml/__pycache__/__init__.cpython-38.pyc,,
|
||||
toml/__pycache__/decoder.cpython-38.pyc,,
|
||||
toml/__pycache__/encoder.cpython-38.pyc,,
|
||||
toml/__pycache__/ordered.cpython-38.pyc,,
|
||||
toml/__pycache__/tz.cpython-38.pyc,,
|
||||
toml/decoder.py,sha256=SSP-mXQz-id5K4PUwooZcjp3u5Tll9Uj-p1q9Unr1ns,35055
|
||||
toml/encoder.py,sha256=DMN3Twu8VA6Ig8SeXmyIMD-4GWleqRHEMw68lqVyk1s,8116
|
||||
toml/ordered.py,sha256=mz03lZmV0bmc9lsYRIUOuj7Dsu5Ptwq-UtGVq5FdVZ4,354
|
||||
toml/tz.py,sha256=DrAgI3wZxZiGcLuV_l8ueA_nPrYoxQ3hZA9tJSjWRsQ,618
|
||||
@@ -0,0 +1,6 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.24.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"license": "MIT", "name": "toml", "metadata_version": "2.0", "generator": "bdist_wheel (0.24.0)", "summary": "Python Library for Tom's Obvious, Minimal Language", "version": "0.10.0", "extensions": {"python.details": {"project_urls": {"Home": "https://github.com/uiri/toml"}, "document_names": {"description": "DESCRIPTION.rst", "license": "LICENSE.txt"}, "contacts": [{"role": "author", "email": "uiri@xqz.ca", "name": "William Pearson"}]}}, "description_content_type": "UNKNOWN", "classifiers": ["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy"]}
|
||||
@@ -0,0 +1 @@
|
||||
toml
|
||||
Reference in New Issue
Block a user