summaryrefslogtreecommitdiff
path: root/events.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2021-03-09 09:02:50 +0100
committerAnthon van der Neut <anthon@mnt.org>2021-03-09 09:02:50 +0100
commite73562c6f14d1d71a9fea174d58465e1b13f68af (patch)
tree309851cca7d411b31c27753555871d493282c7f0 /events.py
parent96839d9f64f4698bdc519cbfbd48d51178460714 (diff)
downloadruamel.yaml-e73562c6f14d1d71a9fea174d58465e1b13f68af.tar.gz
remove python 2 specific code
add future deprecation warning to old style functions
Diffstat (limited to 'events.py')
-rw-r--r--events.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/events.py b/events.py
index 58b2121..693519d 100644
--- a/events.py
+++ b/events.py
@@ -1,5 +1,7 @@
# coding: utf-8
+from ruamel.yaml.compat import _F
+
# Abstract classes.
if False: # MYPY
@@ -30,10 +32,16 @@ class Event(object):
for key in ['anchor', 'tag', 'implicit', 'value', 'flow_style', 'style']
if hasattr(self, key)
]
- arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) for key in attributes])
+ arguments = ', '.join(
+ [_F('{key!s}={attr!r})', key=key, attr=getattr(self, key)) for key in attributes]
+ )
if self.comment not in [None, CommentCheck]:
arguments += ', comment={!r}'.format(self.comment)
- return '%s(%s)' % (self.__class__.__name__, arguments)
+ return _F(
+ '{self_class_name!s}{}arguments!s}',
+ self_class_name=self.__class__.__name__,
+ arguments=arguments,
+ )
class NodeEvent(Event):