summaryrefslogtreecommitdiff
path: root/tokens.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 /tokens.py
parent96839d9f64f4698bdc519cbfbd48d51178460714 (diff)
downloadruamel.yaml-e73562c6f14d1d71a9fea174d58465e1b13f68af.tar.gz
remove python 2 specific code
add future deprecation warning to old style functions
Diffstat (limited to 'tokens.py')
-rw-r--r--tokens.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tokens.py b/tokens.py
index 5f5a663..3d3c566 100644
--- a/tokens.py
+++ b/tokens.py
@@ -1,7 +1,6 @@
-# # header
# coding: utf-8
-from __future__ import unicode_literals
+from ruamel.yaml.compat import _F
if False: # MYPY
from typing import Text, Any, Dict, Optional, List # NOQA
@@ -24,7 +23,9 @@ class Token(object):
# hasattr('self', key)]
attributes = [key for key in self.__slots__ if not key.endswith('_mark')]
attributes.sort()
- arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) for key in attributes])
+ arguments = ', '.join(
+ [_F('{key!s}={gattr!r})', key=key, gattr=getattr(self, key)) for key in attributes]
+ )
if SHOWLINES:
try:
arguments += ', line: ' + str(self.start_mark.line)
@@ -81,7 +82,7 @@ class Token(object):
# nprint('mco2:', self, target, target.comment, empty)
return self
if c[0] and tc[0] or c[1] and tc[1]:
- raise NotImplementedError('overlap in comment %r %r' % (c, tc))
+ raise NotImplementedError(_F('overlap in comment {c!r} {tc!r}', c=c, tc=tc))
if c[0]:
tc[0] = c[0]
if c[1]: