Hello community,

here is the log from the commit of package python-tomlkit for 
openSUSE:Leap:15.2 checked in at 2020-03-27 16:45:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-tomlkit (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.python-tomlkit.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-tomlkit"

Fri Mar 27 16:45:20 2020 rev:2 rq:788721 version:0.5.11

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/python-tomlkit/python-tomlkit.changes  
2020-02-21 10:50:17.303036475 +0100
+++ 
/work/SRC/openSUSE:Leap:15.2/.python-tomlkit.new.3160/python-tomlkit.changes    
    2020-03-27 16:47:51.075923705 +0100
@@ -1,0 +2,15 @@
+Thu Mar 12 08:03:32 UTC 2020 - Tomáš Chvátal <[email protected]>
+
+- Fix build without python2
+
+-------------------------------------------------------------------
+Wed Mar 11 11:15:54 UTC 2020 - [email protected]
+
+- version update to 0.5.11
+  * Fix containers and our of order tables dictionary behavior (#82))
+  * Fixed out of order tables not behaving properly (#79)
+  * Fixed the behavior for out of order tables (#68).
+  * Fixed parsing errors when single quotes are present in a table name (#71).
+  * Fixed parsing errors when parsing some table names (#76).
+
+-------------------------------------------------------------------

Old:
----
  tomlkit-0.5.8.tar.gz

New:
----
  tomlkit-0.5.11.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-tomlkit.spec ++++++
--- /var/tmp/diff_new_pack.FoTPy1/_old  2020-03-27 16:47:52.435924504 +0100
+++ /var/tmp/diff_new_pack.FoTPy1/_new  2020-03-27 16:47:52.467924523 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-tomlkit
 #
-# Copyright (c) 2019 SUSE LLC
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,22 +17,24 @@
 
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%bcond_without python2
 Name:           python-tomlkit
-Version:        0.5.8
+Version:        0.5.11
 Release:        0
 Summary:        Style preserving TOML library
 License:        MIT
-Group:          Development/Languages/Python
 URL:            https://github.com/sdispater/tomlkit
 Source:         
https://files.pythonhosted.org/packages/source/t/tomlkit/tomlkit-%{version}.tar.gz
 BuildRequires:  %{python_module pytest}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  %{python_module typing >= 3.6}
 BuildRequires:  fdupes
-BuildRequires:  python-enum34
-BuildRequires:  python-functools32
 BuildRequires:  python-rpm-macros
 BuildArch:      noarch
+%if %{with python2}
+BuildRequires:  python-enum34
+BuildRequires:  python-functools32
+%endif
 %ifpython2
 Requires:       python-enum34
 Requires:       python-functools32

++++++ tomlkit-0.5.8.tar.gz -> tomlkit-0.5.11.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tomlkit-0.5.8/PKG-INFO new/tomlkit-0.5.11/PKG-INFO
--- old/tomlkit-0.5.8/PKG-INFO  1970-01-01 01:00:00.000000000 +0100
+++ new/tomlkit-0.5.11/PKG-INFO 2020-02-29 18:21:32.805722000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: tomlkit
-Version: 0.5.8
+Version: 0.5.11
 Summary: Style preserving TOML library
 Home-page: https://github.com/sdispater/tomlkit
 License: MIT
@@ -15,6 +15,7 @@
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
 Requires-Dist: enum34 (>=1.1,<2.0); python_version >= "2.7" and python_version 
< "2.8"
 Requires-Dist: functools32 (>=3.2.3,<4.0.0); python_version >= "2.7" and 
python_version < "2.8"
 Requires-Dist: typing (>=3.6,<4.0); python_version >= "2.7" and python_version 
< "2.8" or python_version >= "3.4" and python_version < "3.5"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tomlkit-0.5.8/pyproject.toml 
new/tomlkit-0.5.11/pyproject.toml
--- old/tomlkit-0.5.8/pyproject.toml    2019-10-11 16:27:47.492856000 +0200
+++ new/tomlkit-0.5.11/pyproject.toml   2020-02-29 18:21:26.120309000 +0100
@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "tomlkit"
-version = "0.5.8"
+version = "0.5.11"
 description = "Style preserving TOML library"
 authors = ["Sébastien Eustace <[email protected]>"]
 license = "MIT"
@@ -30,7 +30,7 @@
 [tool.poetry.dev-dependencies]
 pytest = "^4.6"
 pytest-cov = "^2.5"
-black = { version = "^19.3b0", python = "^3.6" }
+black = { version = "^19.3b0", markers = "python_version >= '3.6' and 
python_version < '4.0' and implementation_name != 'pypy'" }
 pre-commit = "^1.10"
 tox = "^3.1"
 codecov = "^2.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tomlkit-0.5.8/setup.py new/tomlkit-0.5.11/setup.py
--- old/tomlkit-0.5.8/setup.py  1970-01-01 01:00:00.000000000 +0100
+++ new/tomlkit-0.5.11/setup.py 2020-02-29 18:21:32.805093000 +0100
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-from distutils.core import setup
+from setuptools import setup
 
 packages = \
 ['tests', 'tomlkit']
@@ -22,7 +22,7 @@
 
 setup_kwargs = {
     'name': 'tomlkit',
-    'version': '0.5.8',
+    'version': '0.5.11',
     'description': 'Style preserving TOML library',
     'long_description': '[github_release]: 
https://img.shields.io/github/release/sdispater/tomlkit.svg?logo=github&logoColor=white\n[pypi_version]:
 
https://img.shields.io/pypi/v/tomlkit.svg?logo=python&logoColor=white\n[python_versions]:
 
https://img.shields.io/pypi/pyversions/tomlkit.svg?logo=python&logoColor=white\n[github_license]:
 
https://img.shields.io/github/license/sdispater/tomlkit.svg?logo=github&logoColor=white\n[travisci]:
 
https://img.shields.io/travis/com/sdispater/tomlkit/master.svg?logo=travis&logoColor=white&label=Travis%20CI\n[appveyor]:
 
https://img.shields.io/appveyor/ci/sdispater/tomlkit/master.svg?logo=appveyor&logoColor=white&label=AppVeyor\n<!--Codecov
 logo not offered by shields.io or simpleicons.org, this is Codecov\'s SVG 
image modified to be white-->\n[codecov]: 
https://img.shields.io/codecov/c/github/sdispater/tomlkit/master.svg?logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNDgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CgogPGc+CiAgPHRpdGxlPmJhY2tncm91bmQ8L3RpdGxlPgogIDxyZWN0IGZpbGw9Im5vbmUiIGlkPSJjYW52YXNfYmFja2dyb3VuZCIgaGVpZ2h0PSI0MDIiIHdpZHRoPSI1ODIiIHk9Ii0xIiB4PSItMSIvPgogPC9nPgogPGc+CiAgPHRpdGxlPkxheWVyIDE8L3RpdGxlPgogIDxwYXRoIGlkPSJzdmdfMSIgZmlsbC1ydWxlPSJldmVub2RkIiBmaWxsPSIjZmZmZmZmIiBkPSJtMjUuMDE0LDBjLTEzLjc4NCwwLjAxIC0yNS4wMDQsMTEuMTQ5IC0yNS4wMTQsMjQuODMybDAsMC4wNjJsNC4yNTQsMi40ODJsMC4wNTgsLTAuMDM5YTEyLjIzOCwxMi4yMzggMCAwIDEgOS4wNzgsLTEuOTI4YTExLjg0NCwxMS44NDQgMCAwIDEgNS45OCwyLjk3NWwwLjczLDAuNjhsMC40MTMsLTAuOTA0YzAuNCwtMC44NzQgMC44NjIsLTEuNjk2IDEuMzc0LC0yLjQ0M2MwLjIwNiwtMC4zIDAuNDMzLC0wLjYwNCAwLjY5MiwtMC45MjlsMC40MjcsLTAuNTM1bC0wLjUyNiwtMC40NGExNy40NSwxNy40NSAwIDAgMCAtOC4xLC0zLjc4MWExNy44NTMsMTcuODUzIDAgMCAwIC04LjM3NSwwLjQ5YzIuMDIzLC04Ljg2OCA5LjgyLC0xNS4wNSAxOS4wMjcsLTE1LjA1N2M1LjE5NSwwIDEwLjA3OCwyLjAwNyAxMy43NTIsNS42NTJjMi42MTksMi41OTggNC40MjIsNS44MzUgNS4yMjQsOS4zNzJhMTcuOTA4LDE3LjkwOCAwIDAgMCAtNS4yMDgsLTAuNzlsLTAuMzE4LC0wLjAwMWExOC4wOTYsMTguMDk2IDAgMCAwIC0yLjA2NywwLjE1M2wtMC4wODcsMC4wMTJjLTAuMzAzLDAuMDQgLTAuNTcsMC4wODEgLTAuODEzLDAuMTI2Yy0wLjExOSwwLjAyIC0wLjIzNywwLjA0NSAtMC4zNTUsMC4wNjhjLTAuMjgsMC4wNTcgLTAuNTU0LDAuMTE5IC0wLjgxNiwwLjE4NWwtMC4yODgsMC4wNzNjLTAuMzM2LDAuMDkgLTAuNjc1LDAuMTkxIC0xLjAwNiwwLjNsLTAuMDYxLDAuMDJjLTAuNzQsMC4yNTEgLTEuNDc4LDAuNTU4IC0yLjE5LDAuOTE0bC0wLjA1NywwLjAyOWMtMC4zMTYsMC4xNTggLTAuNjM2LDAuMzMzIC0wLjk3OCwwLjUzNGwtMC4wNzUsMC4wNDVhMTYuOTcsMTYuOTcgMCAwIDAgLTQuNDE0LDMuNzhsLTAuMTU3LDAuMTkxYy0wLjMxNywwLjM5NCAtMC41NjcsMC43MjcgLTAuNzg3LDEuMDQ4Yy0wLjE4NCwwLjI3IC0wLjM2OSwwLjU2IC0wLjYsMC45NDJsLTAuMTI2LDAuMjE3Yy0wLjE4NCwwLjMxOCAtMC4zNDgsMC42MjIgLTAuNDg3LDAuOWwtMC4wMzMsMC4wNjFjLTAuMzU0LDAuNzExIC0wLjY2MSwxLjQ1NSAtMC45MTcsMi4yMTRsLTAuMDM2LDAuMTExYTE3LjEzLDE3LjEzIDAgMCAwIC0wLjg1NSw1LjY0NGwwLjAwMywwLjIzNGEyMy41NjUsMjMuNTY1IDAgMCAwIDAuMDQzLDAuODIyYzAuMDEsMC4xMyAwLjAyMywwLjI1OSAwLjAzNiwwLjM4OGMwLjAxNSwwLjE1OCAwLjAzNCwwLjMxNiAwLjA1MywwLjQ3MWwwLjAxMSwwLjA4OGwwLjAyOCwwLjIxNGMwLjAzNywwLjI2NCAwLjA4LDAuNTI1IDAuMTMsMC43ODdjMC41MDMsMi42MzcgMS43Niw1LjI3NCAzLjYzNSw3LjYyNWwwLjA4NSwwLjEwNmwwLjA4NywtMC4xMDRjMC43NDgsLTAuODg0IDIuNjAzLC0zLjY4NyAyLjc2LC01LjM2OWwwLjAwMywtMC4wMzFsLTAuMDE1LC0wLjAyOGExMS43MzYsMTEuNzM2IDAgMCAxIC0xLjMzMywtNS40MDdjMCwtNi4yODQgNC45NCwtMTEuNTAyIDExLjI0MywtMTEuODhsMC40MTQsLTAuMDE1YzIuNTYxLC0wLjA1OCA1LjA2NCwwLjY3MyA3LjIzLDIuMTM2bDAuMDU4LDAuMDM5bDQuMTk3LC0yLjQ0bDAuMDU1LC0wLjAzM2wwLC0wLjA2MmMwLjAwNiwtNi42MzIgLTIuNTkyLC0xMi44NjUgLTcuMzE0LC0xNy41NTFjLTQuNzE2LC00LjY3OSAtMTAuOTkxLC03LjI1NSAtMTcuNjcyLC03LjI1NSIvPgogPC9nPgo8L3N2Zz4=&label=Codecov\n\n[![GitHub
 
Release][github_release]](https://github.com/sdispater/tomlkit/releases/)\n[![PyPI
 Version][pypi_version]](https://pypi.python.org/pypi/tomlkit/)\n[![Python 
Versions][python_versions]](https://pypi.python.org/pypi/tomlkit/)\n[![License][github_license]](https://github.com/sdispater/tomlkit/blob/master/LICENSE)\n<br>\n[![Travis
 
CI][travisci]](https://travis-ci.com/sdispater/tomlkit)\n[![AppVeyor][appveyor]](https://ci.appveyor.com/project/sdispater/tomlkit)\n[![Codecov][codecov]](https://codecov.io/gh/sdispater/tomlkit)\n\n#
 TOML Kit - Style-preserving TOML library for Python\n\nTOML Kit is a 
**0.5.0-compliant** [TOML](https://github.com/toml-lang/toml) library.\n\nIt 
includes a parser that preserves all comments, indentations, whitespace and 
internal element ordering,\nand makes them accessible and editable via an 
intuitive API.\n\nYou can also create new TOML documents from scratch using the 
provided helpers.\n\nPart of the implementation as been adapted, improved and 
fixed from [Molten](https://github.com/LeopoldArkham/Molten).\n\n## 
Usage\n\n### Parsing\n\nTOML Kit comes with a fast and style-preserving parser 
to help you access\nthe content of TOML files and strings.\n\n```python\n>>> 
from tomlkit import dumps\n>>> from tomlkit import parse  # you can also use 
loads\n\n>>> content = """[table]\n... foo = "bar"  # String\n... """\n>>> doc 
= parse(content)\n\n# doc is a TOMLDocument instance that holds all the 
information\n# about the TOML string.\n# It behaves like a standard 
dictionary.\n\n>>> assert doc["table"]["foo"] == "bar"\n\n# The string 
generated from the document is exactly the same\n# as the original string\n>>> 
assert dumps(doc) == content\n```\n\n### Modifying\n\nTOML Kit provides an 
intuitive API to modify TOML documents.\n\n```python\n>>> from tomlkit import 
dumps\n>>> from tomlkit import parse\n>>> from tomlkit import table\n\n>>> doc 
= parse("""[table]\n... foo = "bar"  # String\n... """)\n\n>>> 
doc["table"]["baz"] = 13\n\n>>> dumps(doc)\n"""[table]\nfoo = "bar"  # 
String\nbaz = 13\n"""\n\n# Add a new table\n>>> tab = table()\n>>> 
tab.add("array", [1, 2, 3])\n\n>>> doc["table2"] = tab\n\n>>> 
dumps(doc)\n"""[table]\nfoo = "bar"  # String\nbaz = 13\n\n[table2]\narray = 
[1, 2, 3]\n"""\n\n# Remove the newly added table\n>>> doc.remove("table2")\n# 
del doc["table2] is also possible\n```\n\n### Writing\n\nYou can also write a 
new TOML document from scratch.\n\nLet\'s say we want to create this following 
document:\n\n```toml\n# This is a TOML document.\n\ntitle = "TOML 
Example"\n\n[owner]\nname = "Tom Preston-Werner"\norganization = "GitHub"\nbio 
= "GitHub Cofounder & CEO\\nLikes tater tots and beer."\ndob = 
1979-05-27T07:32:00Z # First class dates? Why not?\n\n[database]\nserver = 
"192.168.1.1"\nports = [ 8001, 8001, 8002 ]\nconnection_max = 5000\nenabled = 
true\n```\n\nIt can be created with the following code:\n\n```python\n>>> from 
tomlkit import comment\n>>> from tomlkit import document\n>>> from tomlkit 
import nl\n>>> from tomlkit import table\n\n>>> doc = document()\n>>> 
doc.add(comment("This is a TOML document."))\n>>> doc.add(nl())\n>>> 
doc.add("title", "TOML Example")\n# Using doc["title"] = "TOML Example" is also 
possible\n\n>>> owner = table()\n>>> owner.add("name", "Tom 
Preston-Werner")\n>>> owner.add("organization", "GitHub")\n>>> owner.add("bio", 
"GitHub Cofounder & CEO\\nLikes tater tots and beer.")\n>>> owner.add("dob", 
datetime(1979, 5, 27, 7, 32, tzinfo=utc))\n>>> owner["dob"].comment("First 
class dates? Why not?")\n\n# Adding the table to the document\n>>> 
doc.add("owner", owner)\n\n>>> database = table()\n>>> database["server"] = 
"192.168.1.1"\n>>> database["ports"] = [8001, 8001, 8002]\n>>> 
database["connection_max"] = 5000\n>>> database["enabled"] = True\n\n>>> 
doc["database"] = database\n```\n\n\n## Installation\n\nIf you are using 
[Poetry](https://poetry.eustace.io),\nadd `tomlkit` to your `pyproject.toml` 
file by using:\n\n```bash\npoetry add tomlkit\n```\n\nIf not, you can use 
`pip`:\n\n```bash\npip install tomlkit\n```\n',
     'author': 'Sébastien Eustace',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tomlkit-0.5.8/tests/examples/json/table_names.json 
new/tomlkit-0.5.11/tests/examples/json/table_names.json
--- old/tomlkit-0.5.8/tests/examples/json/table_names.json      1970-01-01 
01:00:00.000000000 +0100
+++ new/tomlkit-0.5.11/tests/examples/json/table_names.json     2020-02-29 
13:19:19.664328800 +0100
@@ -0,0 +1,21 @@
+{
+    "Special \"table\"": {
+        "foo": "bar"
+    },
+    "BJ's Restaurant": {
+        "account": "dining"
+    },
+    "]": {
+        "foo": 1
+    },
+    "[bracket]": {
+        "bar": 2
+    },
+    "a": {
+        "b.c": {
+            "d": {
+                "baz": 3
+            }
+        }
+    }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tomlkit-0.5.8/tests/examples/table_names.toml 
new/tomlkit-0.5.11/tests/examples/table_names.toml
--- old/tomlkit-0.5.8/tests/examples/table_names.toml   1970-01-01 
01:00:00.000000000 +0100
+++ new/tomlkit-0.5.11/tests/examples/table_names.toml  2020-02-29 
13:19:19.664753700 +0100
@@ -0,0 +1,14 @@
+['Special "table"']
+foo = "bar"
+
+["BJ's Restaurant"]
+account = "dining"
+
+["]"]
+foo = 1
+
+[  "[bracket]"  ]
+bar = 2
+
+[  a . "b.c" . d  ]
+baz = 3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tomlkit-0.5.8/tests/test_api.py 
new/tomlkit-0.5.11/tests/test_api.py
--- old/tomlkit-0.5.8/tests/test_api.py 2019-07-23 09:52:09.924790100 +0200
+++ new/tomlkit-0.5.11/tests/test_api.py        2020-02-29 13:19:19.665425300 
+0100
@@ -53,6 +53,7 @@
         "newline_in_strings",
         "preserve_quotes_in_string",
         "string_slash_whitespace_newline",
+        "table_names",
     ],
 )
 def test_parse_can_parse_valid_toml_files(example, example_name):
@@ -60,7 +61,7 @@
     assert isinstance(loads(example(example_name)), TOMLDocument)
 
 
[email protected]("example_name", ["0.5.0", "pyproject"])
[email protected]("example_name", ["0.5.0", "pyproject", "table_names"])
 def test_parsed_document_are_properly_json_representable(
     example, json_example, example_name
 ):
@@ -110,6 +111,7 @@
         "pyproject",
         "0.5.0",
         "test",
+        "table_names",
     ],
 )
 def test_original_string_and_dumped_string_are_equal(example, example_name):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tomlkit-0.5.8/tests/test_toml_document.py 
new/tomlkit-0.5.11/tests/test_toml_document.py
--- old/tomlkit-0.5.8/tests/test_toml_document.py       2019-10-04 
14:50:51.284770000 +0200
+++ new/tomlkit-0.5.11/tests/test_toml_document.py      2020-02-29 
18:09:22.691695500 +0100
@@ -7,9 +7,11 @@
 
 from datetime import datetime
 
+import pytest
 import tomlkit
 from tomlkit import parse
 from tomlkit._utils import _utc
+from tomlkit.exceptions import NonExistentKey
 
 
 def test_document_is_a_dict(example):
@@ -473,3 +475,97 @@
     doc = parse(content)
     assert {"tommy": 87, "mary": 66, "bob": {"score": 91}} == doc["students"]
     assert {"tommy": 87, "mary": 66, "bob": {"score": 91}} == 
doc.get("students")
+
+
+def test_values_can_still_be_set_for_out_of_order_tables():
+    content = """
+[a.a]
+key = "value"
+
+[a.b]
+
+[a.a.c]
+"""
+
+    doc = parse(content)
+    doc["a"]["a"]["key"] = "new_value"
+
+    assert "new_value" == doc["a"]["a"]["key"]
+
+    expected = """
+[a.a]
+key = "new_value"
+
+[a.b]
+
+[a.a.c]
+"""
+
+    assert expected == doc.as_string()
+
+    doc["a"]["a"]["bar"] = "baz"
+
+    expected = """
+[a.a]
+key = "new_value"
+bar = "baz"
+
+[a.b]
+
+[a.a.c]
+"""
+
+    assert expected == doc.as_string()
+
+    del doc["a"]["a"]["key"]
+
+    expected = """
+[a.a]
+bar = "baz"
+
+[a.b]
+
+[a.a.c]
+"""
+
+    assert expected == doc.as_string()
+
+    with pytest.raises(NonExistentKey):
+        doc["a"]["a"]["key"]
+
+    with pytest.raises(NonExistentKey):
+        del doc["a"]["a"]["key"]
+
+
+def test_out_of_order_tables_are_still_dicts():
+    content = """
+[a.a]
+key = "value"
+
+[a.b]
+
+[a.a.c]
+"""
+
+    doc = parse(content)
+    assert isinstance(doc["a"], dict)
+    assert isinstance(doc["a"]["a"], dict)
+
+    table = doc["a"]["a"]
+    assert "key" in table
+    assert "c" in table
+    assert "value" == table.get("key")
+    assert {} == table.get("c")
+    assert table.get("d") is None
+    assert "foo" == table.get("d", "foo")
+
+    assert "bar" == table.setdefault("d", "bar")
+    assert "bar" == table["d"]
+
+    assert "value" == table.pop("key")
+    assert "key" not in table
+
+    assert "baz" == table.pop("missing", default="baz")
+
+    with pytest.raises(KeyError):
+        table.pop("missing")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tomlkit-0.5.8/tomlkit/__init__.py 
new/tomlkit-0.5.11/tomlkit/__init__.py
--- old/tomlkit-0.5.8/tomlkit/__init__.py       2019-10-11 16:28:40.078169600 
+0200
+++ new/tomlkit-0.5.11/tomlkit/__init__.py      2020-02-29 18:21:26.121214600 
+0100
@@ -22,4 +22,4 @@
 from .api import ws
 
 
-__version__ = "0.5.8"
+__version__ = "0.5.11"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tomlkit-0.5.8/tomlkit/container.py 
new/tomlkit-0.5.11/tomlkit/container.py
--- old/tomlkit-0.5.8/tomlkit/container.py      2019-10-11 15:01:23.036720800 
+0200
+++ new/tomlkit-0.5.11/tomlkit/container.py     2020-02-29 18:09:22.692561600 
+0100
@@ -23,6 +23,9 @@
 from .items import item as _item
 
 
+_NOT_SET = object()
+
+
 class Container(dict):
     """
     A container for items within a TOMLDocument.
@@ -501,6 +504,19 @@
 
         return self[key]
 
+    def pop(self, key, default=_NOT_SET):
+        try:
+            value = self[key]
+        except KeyError:
+            if default is _NOT_SET:
+                raise
+
+            return default
+
+        del self[key]
+
+        return value
+
     def setdefault(
         self, key, default=None
     ):  # type: (Union[Key, str], Any) -> Union[Item, Container]
@@ -524,21 +540,12 @@
             raise NonExistentKey(key)
 
         if isinstance(idx, tuple):
-            container = Container(True)
-
-            for i in idx:
-                item = self._body[i][1]
-
-                if isinstance(item, Table):
-                    for k, v in item.value.body:
-                        container.append(k, v)
-                else:
-                    container.append(key, item)
-
-            return container
+            # The item we are getting is an out of order table
+            # so we need a proxy to retrieve the proper objects
+            # from the parent container
+            return OutOfOrderTableProxy(self, idx)
 
         item = self._body[idx][1]
-
         if item.is_boolean():
             return item.value
 
@@ -571,6 +578,9 @@
     def _replace_at(
         self, idx, new_key, value
     ):  # type: (Union[int, Tuple[int]], Union[Key, str], Item) -> None
+        if not isinstance(new_key, Key):
+            new_key = Key(new_key)
+
         if isinstance(idx, tuple):
             for i in idx[1:]:
                 self._body[i] = (None, Null())
@@ -580,6 +590,8 @@
         k, v = self._body[idx]
 
         self._map[new_key] = self._map.pop(k)
+        if new_key != k:
+            super(Container, self).__delitem__(k)
 
         if isinstance(self._map[new_key], tuple):
             self._map[new_key] = self._map[new_key][0]
@@ -640,3 +652,99 @@
         c._map.update(self._map)
 
         return c
+
+
+class OutOfOrderTableProxy(dict):
+    def __init__(self, container, indices):  # type: (Container, Tuple) -> None
+        self._container = container
+        self._internal_container = Container(self._container.parsing)
+        self._tables = []
+        self._tables_map = {}
+        self._map = {}
+
+        for i in indices:
+            key, item = self._container._body[i]
+
+            if isinstance(item, Table):
+                self._tables.append(item)
+                table_idx = len(self._tables) - 1
+                for k, v in item.value.body:
+                    self._internal_container.append(k, v)
+                    self._tables_map[k] = table_idx
+            else:
+                self._internal_container.append(key, item)
+                self._map[key] = i
+
+    def __getitem__(self, key):  # type: (Union[Key, str]) -> Any
+        if key not in self._internal_container:
+            raise NonExistentKey(key)
+
+        return self._internal_container[key]
+
+    def __setitem__(self, key, item):  # type: (Union[Key, str], Any) -> None
+        if key in self._map:
+            idx = self._map[key]
+            self._container._replace_at(idx, key, item)
+        elif key in self._tables_map:
+            table = self._tables[self._tables_map[key]]
+            table[key] = item
+        elif self._tables:
+            table = self._tables[0]
+            table[key] = item
+        else:
+            self._container[key] = item
+
+    def __delitem__(self, key):  # type: (Union[Key, str]) -> None
+        if key in self._map:
+            idx = self._map[key]
+            del self._container[key]
+            del self._map[key]
+        elif key in self._tables_map:
+            table = self._tables[self._tables_map[key]]
+            del table[key]
+            del self._tables_map[key]
+        else:
+            raise NonExistentKey(key)
+
+        del self._internal_container[key]
+
+    def keys(self):
+        return self._internal_container.keys()
+
+    def values(self):
+        return self._internal_container.values()
+
+    def items(self):  # type: () -> Generator[Item]
+        return self._internal_container.items()
+
+    def update(self, other):  # type: (Dict) -> None
+        self._internal_container.update(other)
+
+    def get(self, key, default=None):  # type: (Any, Optional[Any]) -> Any
+        return self._internal_container.get(key, default=default)
+
+    def pop(self, key, default=_NOT_SET):
+        return self._internal_container.pop(key, default=default)
+
+    def setdefault(
+        self, key, default=None
+    ):  # type: (Union[Key, str], Any) -> Union[Item, Container]
+        return self._internal_container.setdefault(key, default=default)
+
+    def __contains__(self, key):
+        return key in self._internal_container
+
+    def __str__(self):
+        return str(self._internal_container)
+
+    def __repr__(self):
+        return repr(self._internal_container)
+
+    def __eq__(self, other):  # type: (Dict) -> bool
+        if not isinstance(other, dict):
+            return NotImplemented
+
+        return self._internal_container == other
+
+    def __getattr__(self, attribute):
+        return getattr(self._internal_container, attribute)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tomlkit-0.5.8/tomlkit/parser.py 
new/tomlkit-0.5.11/tomlkit/parser.py
--- old/tomlkit-0.5.8/tomlkit/parser.py 2019-07-23 09:52:09.930370300 +0200
+++ new/tomlkit-0.5.11/tomlkit/parser.py        2020-02-29 13:19:19.669257900 
+0100
@@ -201,7 +201,8 @@
         in_name = False
         current = ""
         t = KeyType.Bare
-        for c in name:
+        parts = 0
+        for c in name.strip():
             c = TOMLChar(c)
 
             if c == ".":
@@ -212,14 +213,20 @@
                 if not current:
                     raise self.parse_error()
 
-                yield Key(current, t=t, sep="")
+                yield Key(current.strip(), t=t, sep="")
+                parts += 1
 
                 current = ""
                 t = KeyType.Bare
                 continue
             elif c in {"'", '"'}:
                 if in_name:
-                    if t == KeyType.Literal and c == '"':
+                    if (
+                        t == KeyType.Literal
+                        and c == '"'
+                        or t == KeyType.Basic
+                        and c == "'"
+                    ):
                         current += c
                         continue
 
@@ -228,17 +235,35 @@
 
                     in_name = False
                 else:
+                    if current and TOMLChar(current[-1]).is_spaces() and not 
parts:
+                        raise self.parse_error()
+
                     in_name = True
                     t = KeyType.Literal if c == "'" else KeyType.Basic
 
                 continue
             elif in_name or c.is_bare_key_char():
+                if (
+                    not in_name
+                    and current
+                    and TOMLChar(current[-1]).is_spaces()
+                    and not parts
+                ):
+                    raise self.parse_error()
+
                 current += c
+            elif c.is_spaces():
+                # A space is only valid at this point
+                # if it's in between parts.
+                # We store it for now and will check
+                # later if it's valid
+                current += c
+                continue
             else:
                 raise self.parse_error()
 
-        if current:
-            yield Key(current, t=t, sep="")
+        if current.strip():
+            yield Key(current.strip(), t=t, sep="")
 
     def _parse_item(self):  # type: () -> Optional[Tuple[Optional[Key], Item]]
         """
@@ -911,15 +936,46 @@
 
             is_aot = True
 
-        # Key
+        # Consume any whitespace
         self.mark()
-        while self._current != "]" and self.inc():
-            if self.end():
-                raise self.parse_error(UnexpectedEofError)
-
+        while self._current.is_spaces() and self.inc():
             pass
 
-        name = self.extract()
+        ws_prefix = self.extract()
+
+        # Key
+        if self._current in [StringType.SLL.value, StringType.SLB.value]:
+            delimiter = (
+                StringType.SLL
+                if self._current == StringType.SLL.value
+                else StringType.SLB
+            )
+            name = self._parse_string(delimiter)
+            name = "{delimiter}{name}{delimiter}".format(
+                delimiter=delimiter.value, name=name
+            )
+
+            self.mark()
+            while self._current != "]" and self.inc():
+                if self.end():
+                    raise self.parse_error(UnexpectedEofError)
+
+                pass
+
+            ws_suffix = self.extract()
+            name += ws_suffix
+        else:
+            self.mark()
+            while self._current != "]" and self.inc():
+                if self.end():
+                    raise self.parse_error(UnexpectedEofError)
+
+                pass
+
+            name = self.extract()
+
+        name = ws_prefix + name
+
         if not name.strip():
             raise self.parse_error(EmptyTableNameError)
 


Reply via email to