summaryrefslogtreecommitdiff
path: root/events.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2021-05-30 09:25:32 +0200
committerAnthon van der Neut <anthon@mnt.org>2021-05-30 09:25:32 +0200
commit73f4bec5f498b31fd7ce7c2ac7ced187b4fc4920 (patch)
treee2318c5891b58aecebdb178636c61b7aa6a84193 /events.py
parent17b35c376fd0fc9a94ba0adfdbf5bf63a6177dc9 (diff)
downloadruamel.yaml-73f4bec5f498b31fd7ce7c2ac7ced187b4fc4920.tar.gz
fix for issue 3840.17.5
aliased scalars in !!set would not round trip with ?
Diffstat (limited to 'events.py')
-rw-r--r--events.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/events.py b/events.py
index e0c7f68..7a02a29 100644
--- a/events.py
+++ b/events.py
@@ -32,7 +32,7 @@ class Event:
if True:
arguments = []
if hasattr(self, 'value'):
- arguments.append(repr(getattr(self, 'value')))
+ arguments.append(repr(self.value))
for key in ['anchor', 'tag', 'implicit', 'flow_style', 'style']:
v = getattr(self, key, None)
if v is not None:
@@ -40,8 +40,14 @@ class Event:
if self.comment not in [None, CommentCheck]:
arguments.append('comment={!r}'.format(self.comment))
if SHOW_LINES:
- arguments.append('({}:{}/{}:{})'.format(self.start_mark.line, self.start_mark.column,
- self.end_mark.line, self.end_mark.column))
+ arguments.append(
+ '({}:{}/{}:{})'.format(
+ self.start_mark.line,
+ self.start_mark.column,
+ self.end_mark.line,
+ self.end_mark.column,
+ )
+ )
arguments = ', '.join(arguments)
else:
attributes = [
@@ -50,7 +56,7 @@ class Event:
if hasattr(self, key)
]
arguments = ', '.join(
- [_F('{key!s}={attr!r}', key=key, attr=getattr(self, key)) for key in attributes]
+ [_F('{k!s}={attr!r}', k=key, attr=getattr(self, key)) for key in attributes]
)
if self.comment not in [None, CommentCheck]:
arguments += ', comment={!r}'.format(self.comment)
@@ -141,7 +147,11 @@ class DocumentEndEvent(Event):
class AliasEvent(NodeEvent):
- __slots__ = ()
+ __slots__ = 'style'
+
+ def __init__(self, anchor, start_mark=None, end_mark=None, style=None, comment=None):
+ NodeEvent.__init__(self, anchor, start_mark, end_mark, comment)
+ self.style = style
class ScalarEvent(NodeEvent):