diff options
author | Anthon van der Neut <anthon@mnt.org> | 2018-08-14 16:30:15 +0200 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2018-08-14 16:30:15 +0200 |
commit | 0923c2a691f57f9e095f5c4b9a8f06fa78bb46d2 (patch) | |
tree | ba2dc411b705bc0290711a591480a66225634352 /constructor.py | |
parent | 65d95151526615f21aa9fbecb92831e17da697bc (diff) | |
download | ruamel.yaml-0923c2a691f57f9e095f5c4b9a8f06fa78bb46d2.tar.gz |
reimplement CommentedSeq to subclass MutableSequence instead of list
re issue #176
Diffstat (limited to 'constructor.py')
-rw-r--r-- | constructor.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/constructor.py b/constructor.py index 8bf72bb..9de28d0 100644 --- a/constructor.py +++ b/constructor.py @@ -16,7 +16,8 @@ from ruamel.yaml.error import (MarkedYAMLError, MarkedYAMLFutureWarning, from ruamel.yaml.nodes import * # NOQA from ruamel.yaml.nodes import (SequenceNode, MappingNode, ScalarNode) from ruamel.yaml.compat import (utf8, builtins_module, to_str, PY2, PY3, # NOQA - ordereddict, text_type, nprint, version_tnf, Hashable) + ordereddict, text_type, nprint, version_tnf, Hashable, + MutableSequence) from ruamel.yaml.comments import * # NOQA from ruamel.yaml.comments import (CommentedMap, CommentedOrderedMap, CommentedSet, CommentedKeySeq, CommentedSeq, TaggedScalar) @@ -1311,7 +1312,7 @@ class RoundTripConstructor(SafeConstructor): key = self.construct_object(key_node, deep=True) # lists are not hashable, but tuples are if not isinstance(key, Hashable): - if isinstance(key, list): + if isinstance(key, MutableSequence): key_a = CommentedKeySeq(key) if key_node.flow_style is True: key_a.fa.set_flow_style() |