-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make tomlkit dump toml's inline table
- Loading branch information
Showing
3 changed files
with
36 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
tasks/vendoring/patches/vendor/tomlkit-dump-inline-table.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
diff --git a/pipenv/vendor/tomlkit/items.py b/pipenv/vendor/tomlkit/items.py | ||
index 781e2e98..80e029d9 100644 | ||
--- a/pipenv/vendor/tomlkit/items.py | ||
+++ b/pipenv/vendor/tomlkit/items.py | ||
@@ -21,6 +21,7 @@ if PY2: | ||
from pipenv.vendor.backports.functools_lru_cache import lru_cache | ||
else: | ||
from functools import lru_cache | ||
+from toml.decoder import InlineTableDict | ||
|
||
|
||
def item(value, _parent=None): | ||
@@ -36,7 +37,10 @@ def item(value, _parent=None): | ||
elif isinstance(value, float): | ||
return Float(value, Trivia(), str(value)) | ||
elif isinstance(value, dict): | ||
- val = Table(Container(), Trivia(), False) | ||
+ if isinstance(value, InlineTableDict): | ||
+ val = InlineTable(Container(), Trivia()) | ||
+ else: | ||
+ val = Table(Container(), Trivia(), False) | ||
for k, v in sorted(value.items(), key=lambda i: (isinstance(i[1], dict), i[0])): | ||
val[k] = item(v, _parent=val) | ||
|