diff options
author | Anthon van der Neut <anthon@mnt.org> | 2021-03-09 09:02:50 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2021-03-09 09:02:50 +0100 |
commit | e73562c6f14d1d71a9fea174d58465e1b13f68af (patch) | |
tree | 309851cca7d411b31c27753555871d493282c7f0 /events.py | |
parent | 96839d9f64f4698bdc519cbfbd48d51178460714 (diff) | |
download | ruamel.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.py | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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): |