summaryrefslogtreecommitdiff
path: root/comments.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2020-09-22 08:29:17 +0200
committerAnthon van der Neut <anthon@mnt.org>2020-09-22 08:29:17 +0200
commitad245940e37c3169e990704c7b7a51813f48f8a8 (patch)
tree7c337dd1bcfb72389800bb344667e059d957f1aa /comments.py
parent80e0a9cd0c1606a12cd0db59d1b137da531ce35e (diff)
downloadruamel.yaml-ad245940e37c3169e990704c7b7a51813f48f8a8.tar.gz
fix issue 359
Diffstat (limited to 'comments.py')
-rw-r--r--comments.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/comments.py b/comments.py
index 1cfd662..d00cf0d 100644
--- a/comments.py
+++ b/comments.py
@@ -696,20 +696,22 @@ class CommentedMap(ordereddict, CommentedBase): # type: ignore
self.ca.comment[1] = pre_comments
return pre_comments
- def update(self, vals):
- # type: (Any) -> None
+ def update(self, *vals, **kw):
+ # type: (Any, Any) -> None
try:
- ordereddict.update(self, vals)
+ ordereddict.update(self, *vals, **kw)
except TypeError:
# probably a dict that is used
- for x in vals:
- self[x] = vals[x]
+ for x in *vals:
+ self[x] = *vals[x]
try:
- self._ok.update(vals.keys()) # type: ignore
+ self._ok.update(*vals.keys()) # type: ignore
except AttributeError:
# assume a list/tuple of two element lists/tuples
- for x in vals:
+ for x in *vals:
self._ok.add(x[0])
+ if kw:
+ self._ok.add(*kw.keys())
def insert(self, pos, key, value, comment=None):
# type: (Any, Any, Any, Optional[Any]) -> None