From 68ea6b9ef755296c169b5416fe46ac48250e3c62 Mon Sep 17 00:00:00 2001 From: Anthon van der Neut Date: Fri, 9 Nov 2018 10:47:11 +0100 Subject: fix issue #194 object attributes always sorted Test for this issue in: https://bitbucket.org/ruamel/yaml.data/src/default/object/control_base_representer_mapping_sort.yaml *When this change indeed resolves your problem, please **Close** this issue*. *(You can do so using the WorkFlow pull-down (close to the top right of this page))* --- nodes.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'nodes.py') diff --git a/nodes.py b/nodes.py index 0a35752..d99e909 100644 --- a/nodes.py +++ b/nodes.py @@ -12,14 +12,14 @@ if False: # MYPY class Node(object): __slots__ = 'tag', 'value', 'start_mark', 'end_mark', 'comment', 'anchor' - def __init__(self, tag, value, start_mark, end_mark, comment=None): - # type: (Any, Any, Any, Any, Any) -> None + def __init__(self, tag, value, start_mark, end_mark, comment=None, anchor=None): + # type: (Any, Any, Any, Any, Any, Any) -> None self.tag = tag self.value = value self.start_mark = start_mark self.end_mark = end_mark self.comment = comment - self.anchor = None + self.anchor = anchor def __repr__(self): # type: () -> str @@ -78,14 +78,15 @@ class ScalarNode(Node): __slots__ = ('style',) id = 'scalar' - def __init__(self, tag, value, start_mark=None, end_mark=None, style=None, comment=None): - # type: (Any, Any, Any, Any, Any, Any) -> None - Node.__init__(self, tag, value, start_mark, end_mark, comment=comment) + def __init__(self, tag, value, start_mark=None, end_mark=None, style=None, comment=None, + anchor=None): + # type: (Any, Any, Any, Any, Any, Any, Any) -> None + Node.__init__(self, tag, value, start_mark, end_mark, comment=comment, anchor=anchor) self.style = style class CollectionNode(Node): - __slots__ = 'flow_style', 'anchor' + __slots__ = ('flow_style', ) def __init__( self, -- cgit v1.2.1