summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2021-08-25 21:30:55 +0200
committerAnthon van der Neut <anthon@mnt.org>2021-08-25 21:30:55 +0200
commitb377e99595919aded00074a2db16001c4847fce8 (patch)
tree8ec452e26419b22e45ed702359e1bd74115491c6
parent849ef8a1a635186e57a414858937b5759101a2a2 (diff)
downloadruamel.yaml-b377e99595919aded00074a2db16001c4847fce8.tar.gz
fix issue with insert in merged-in dict0.17.14
-rw-r--r--CHANGES4
-rw-r--r--README.rst8
-rw-r--r--__init__.py4
-rw-r--r--_doc/_static/pypi.svg2
-rw-r--r--comments.py7
5 files changed, 19 insertions, 6 deletions
diff --git a/CHANGES b/CHANGES
index 31a1f36..8a29114 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+[0, 17, 14]: 2021-08-25
+ - fix issue 396, inserting key/val in merged-in dictionary (reported by `Bastien gerard
+ <https://sourceforge.net/u/bagerard/>`__)
+
[0, 17, 13]: 2021-08-21
- minor fix in attr handling
diff --git a/README.rst b/README.rst
index baeee11..50d6b28 100644
--- a/README.rst
+++ b/README.rst
@@ -4,8 +4,8 @@ ruamel.yaml
``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python.
-:version: 0.17.13
-:updated: 2021-08-21
+:version: 0.17.14
+:updated: 2021-08-25
:documentation: http://yaml.readthedocs.io
:repository: https://sourceforge.net/projects/ruamel-yaml/
:pypi: https://pypi.org/project/ruamel.yaml/
@@ -72,6 +72,10 @@ ChangeLog
.. should insert NEXT: at the beginning of line for next key (with empty line)
+0.17.14 (2021-08-25):
+ - fix issue 396, inserting key/val in merged-in dictionary (reported by `Bastien gerard
+ <https://sourceforge.net/u/bagerard/>`__)
+
0.17.13 (2021-08-21):
- minor fix in attr handling
diff --git a/__init__.py b/__init__.py
index cc6a438..99554f4 100644
--- a/__init__.py
+++ b/__init__.py
@@ -5,8 +5,8 @@ if False: # MYPY
_package_data = dict(
full_package_name='ruamel.yaml',
- version_info=(0, 17, 13),
- __version__='0.17.13',
+ version_info=(0, 17, 14),
+ __version__='0.17.14',
author='Anthon van der Neut',
author_email='a.van.der.neut@ruamel.eu',
description='ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order', # NOQA
diff --git a/_doc/_static/pypi.svg b/_doc/_static/pypi.svg
index 4a7e16e..a98dee3 100644
--- a/_doc/_static/pypi.svg
+++ b/_doc/_static/pypi.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="86" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="86" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h33v20H0z"/><path fill="#007ec6" d="M33 0h53v20H33z"/><path fill="url(#b)" d="M0 0h86v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="175" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="230">pypi</text><text x="175" y="140" transform="scale(.1)" textLength="230">pypi</text><text x="585" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">0.17.13</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.17.13</text></g> </svg>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="86" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="86" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h33v20H0z"/><path fill="#007ec6" d="M33 0h53v20H33z"/><path fill="url(#b)" d="M0 0h86v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="175" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="230">pypi</text><text x="175" y="140" transform="scale(.1)" textLength="230">pypi</text><text x="585" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">0.17.14</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.17.14</text></g> </svg>
diff --git a/comments.py b/comments.py
index 4b6f03e..6d1c4d8 100644
--- a/comments.py
+++ b/comments.py
@@ -881,8 +881,13 @@ class CommentedMap(ordereddict, CommentedBase):
"""insert key value into given position
attach comment if provided
"""
+ keys = list(self.keys()) + [key]
ordereddict.insert(self, pos, key, value)
- self._ok.add(key)
+ for keytmp in keys:
+ self._ok.add(keytmp)
+ for referer in self._ref:
+ for keytmp in keys:
+ referer.update_key_value(keytmp)
if comment is not None:
self.yaml_add_eol_comment(comment, key=key)