diff options
author | Anthon van der Neut <anthon@mnt.org> | 2016-09-15 17:47:45 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2016-09-15 17:47:45 +0200 |
commit | 1dbffd0a290a757547da1bf9a98123b5b361b333 (patch) | |
tree | 3dd128f5d1ecd0e586437574a5a8a91a56691fad /comments.py | |
parent | 4682aff2579c954d79439f5dee6e1d848fe6ea58 (diff) | |
download | ruamel.yaml-1dbffd0a290a757547da1bf9a98123b5b361b333.tar.gz |
fix for issue #60, merges not printing correctly0.12.13
reported by Tal Liron
Diffstat (limited to 'comments.py')
-rw-r--r-- | comments.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/comments.py b/comments.py index c3d17b0..c57b647 100644 --- a/comments.py +++ b/comments.py @@ -501,6 +501,7 @@ class CommentedMap(ordereddict, CommentedBase): try: return ordereddict.__getitem__(self, key) except KeyError: + print('keyerror') for merged in getattr(self, merge_attrib, []): if key in merged[1]: return merged[1][key] @@ -525,6 +526,11 @@ class CommentedMap(ordereddict, CommentedBase): except: return default + def __repr__(self): + if not hasattr(self, merge_attrib): + return ordereddict.__repr__(self) + return 'ordereddict(' + repr(list(self._items())) + ')' + def non_merged_items(self): for x in ordereddict.__iter__(self): yield x, ordereddict.__getitem__(self, x) |