FIX: Get rid of basestring (not python3 compatible).

This commit is contained in:
2019-03-28 16:54:58 +01:00
parent fe7f6d6de1
commit e05bf3e56f
4 changed files with 12 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
import datetime
import logging
import re
from six import string_types
logger = logging.getLogger(__name__)
@@ -53,7 +54,7 @@ class Iso8601Serializer(object):
@classmethod
def deserialize(cls, value, ignore_unsupported_input=False):
prefix = '{marker}{sep}'.format(marker=cls.marker, sep=cls.separator)
if isinstance(value, basestring) and value.startswith(prefix):
if isinstance(value, string_types) and value.startswith(prefix):
haystack = value[len(prefix):]
m = cls._re.match(haystack)
if m is not None:
@@ -68,6 +69,6 @@ class Iso8601Serializer(object):
elif not ignore_unsupported_input:
raise ValueError('Format not recognized \'{str}\''.format(str=haystack))
elif not ignore_unsupported_input:
raise ValueError('Expected basestring,'
raise ValueError('Expected string type,'
' not {}'.format(value.__class__.__name__))
return value