summaryrefslogtreecommitdiff
path: root/serializer.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 /serializer.py
parent96839d9f64f4698bdc519cbfbd48d51178460714 (diff)
downloadruamel.yaml-e73562c6f14d1d71a9fea174d58465e1b13f68af.tar.gz
remove python 2 specific code
add future deprecation warning to old style functions
Diffstat (limited to 'serializer.py')
-rw-r--r--serializer.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/serializer.py b/serializer.py
index a37885c..19b0424 100644
--- a/serializer.py
+++ b/serializer.py
@@ -1,9 +1,7 @@
# coding: utf-8
-from __future__ import absolute_import
-
from ruamel.yaml.error import YAMLError
-from ruamel.yaml.compat import nprint, DBG_NODE, dbg, string_types, nprintf # NOQA
+from ruamel.yaml.compat import nprint, DBG_NODE, dbg, nprintf # NOQA
from ruamel.yaml.util import RegExp
from ruamel.yaml.events import (
@@ -34,8 +32,8 @@ class SerializerError(YAMLError):
class Serializer(object):
# 'id' and 3+ numbers, but not 000
- ANCHOR_TEMPLATE = u'id%03d'
- ANCHOR_RE = RegExp(u'id(?!000$)\\d{3,}')
+ ANCHOR_TEMPLATE = 'id%03d'
+ ANCHOR_RE = RegExp('id(?!000$)\\d{3,}')
def __init__(
self,
@@ -53,7 +51,7 @@ class Serializer(object):
self.use_encoding = encoding
self.use_explicit_start = explicit_start
self.use_explicit_end = explicit_end
- if isinstance(version, string_types):
+ if isinstance(version, str):
self.use_version = tuple(map(int, version.split('.')))
else:
self.use_version = version # type: ignore