Repository: sdispater/tomlkit (python)

Issue:
.get on class OutOfOrderTableProxy now always return None
I just updated to poetry 1.0.4 that uses tomlkit 0.5.10 and custom repository are not added anymore.

```
(Pdb++) local_config.get("source")
(Pdb++) local_config.get("name")
(Pdb++) local_config.get("name", "potatoes")
'potatoes'
(Pdb++) local_config["name"]
'test'
(Pdb++) local_config["source"]
<AoT [{'name': 'testrepo', 'url': 'https://test-repo-url'}]>
```

I'm pretty sure it is related to that change: https://github.com/sdispater/tomlkit/pull/79

OS: ArchLinux
Python: 3.7, 3.8

Reproduced in docker as well with images python:3.7.x and python:3.8.x


Pull request:
Fix containers and out of order tables dict behavior
Fixes #80 
Fixes https://github.com/python-poetry/poetry/issues/2110
Supersedes #81 

Patch:
diff --git a/.travis.yml b/.travis.yml
index 0d36421..a9e245c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,7 +25,6 @@ after_success:
 jobs:
   include:
     - python: "2.7"
-    - python: "3.4"
     - python: "3.5"
     - python: "3.6"
     - python: "3.7"
diff --git a/tomlkit/container.py b/tomlkit/container.py
index b8197ba..a7d4fe9 100644
--- a/tomlkit/container.py
+++ b/tomlkit/container.py
@@ -23,6 +23,9 @@ from .items import Whitespace
 from .items import item as _item
 
 
+_NOT_SET = object()
+
+
 class Container(dict):
     """
     A container for items within a TOMLDocument.
@@ -501,6 +504,19 @@ class Container(dict):
 
         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]
@@ -698,6 +714,23 @@ class OutOfOrderTableProxy(dict):
     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
 


Test patch:
diff --git a/tests/test_toml_document.py b/tests/test_toml_document.py
index b625e79..8c741ff 100644
--- a/tests/test_toml_document.py
+++ b/tests/test_toml_document.py
@@ -551,5 +551,21 @@ key = "value"
     assert isinstance(doc["a"], dict)
     assert isinstance(doc["a"]["a"], dict)
 
-    assert "key" in doc["a"]["a"]
-    assert "c" in doc["a"]["a"]
+    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")