1010import time
1111
1212import redis
13- from redis ._compat import unicode , long , basestring
1413from redis .connection import Encoder as _Encoder
1514from redis .exceptions import ConnectionError , TimeoutError
1615from redis .exceptions import DataError
@@ -34,19 +33,19 @@ def encode(self, value):
3433 # )
3534 elif isinstance (value , float ):
3635 value = repr (value ).encode ()
37- elif isinstance (value , ( int , long ) ):
36+ elif isinstance (value , int ):
3837 # python 2 repr() on longs is '123L', so use str() instead
3938 value = str (value ).encode ()
4039 elif isinstance (value , (list , dict , tuple )):
41- value = unicode (value )
42- elif not isinstance (value , basestring ):
40+ value = str (value )
41+ elif not isinstance (value , str ):
4342 # a value we don't know how to deal with. throw an error
4443 typename = type (value ).__name__
4544 raise DataError (
4645 "Invalid input of type: '%s'. Convert to a "
4746 "bytes, string, int or float first." % typename
4847 )
49- if isinstance (value , unicode ):
48+ if isinstance (value , str ):
5049 value = value .encode (self .encoding , self .encoding_errors )
5150 return value
5251
0 commit comments