11
11
ManyToManyDescriptor ,
12
12
ReverseManyToOneDescriptor
13
13
)
14
- from django .utils import encoding , six
14
+ from django .utils import encoding
15
15
from django .utils .module_loading import import_string as import_class_from_dotted_path
16
16
from django .utils .translation import ugettext_lazy as _
17
17
from rest_framework import exceptions
@@ -63,7 +63,7 @@ def get_resource_name(context, expand_polymorphic_types=False):
63
63
except AttributeError :
64
64
resource_name = view .__class__ .__name__
65
65
66
- if not isinstance (resource_name , six . string_types ):
66
+ if not isinstance (resource_name , str ):
67
67
# The resource name is not a string - return as is
68
68
return resource_name
69
69
@@ -337,7 +337,7 @@ def get_default_included_resources_from_serializer(serializer):
337
337
def get_included_serializers (serializer ):
338
338
included_serializers = copy .copy (getattr (serializer , 'included_serializers' , dict ()))
339
339
340
- for name , value in six . iteritems (included_serializers ):
340
+ for name , value in iter (included_serializers . items () ):
341
341
if not isinstance (value , type ):
342
342
if value == 'self' :
343
343
included_serializers [name ] = (
@@ -367,7 +367,7 @@ def get_relation_instance(resource_instance, source, serializer):
367
367
return True , relation_instance
368
368
369
369
370
- class Hyperlink (six . text_type ):
370
+ class Hyperlink (str ):
371
371
"""
372
372
A string like object that additionally has an associated name.
373
373
We use this for hyperlinked URLs that may render as a named link
@@ -378,7 +378,7 @@ class Hyperlink(six.text_type):
378
378
"""
379
379
380
380
def __new__ (self , url , name ):
381
- ret = six . text_type .__new__ (self , url )
381
+ ret = str .__new__ (self , url )
382
382
ret .name = name
383
383
return ret
384
384
@@ -405,7 +405,7 @@ def format_drf_errors(response, context, exc):
405
405
# see if they passed a dictionary to ValidationError manually
406
406
if isinstance (error , dict ):
407
407
errors .append (error )
408
- elif isinstance (error , six . string_types ):
408
+ elif isinstance (error , str ):
409
409
classes = inspect .getmembers (exceptions , inspect .isclass )
410
410
# DRF sets the `field` to 'detail' for its own exceptions
411
411
if isinstance (exc , tuple (x [1 ] for x in classes )):
0 commit comments