44This module provides low-level API for Tarantool
55'''
66
7+ import six
78import time
89import errno
910import ctypes
@@ -154,7 +155,7 @@ def connect(self):
154155 raise NetworkError (e )
155156
156157 def _recv (self , to_read ):
157- buf = ''
158+ buf = b""
158159 while to_read > 0 :
159160 try :
160161 tmp = self ._socket .recv (to_read )
@@ -188,7 +189,7 @@ def _send_request_wo_reconnect(self, request):
188189
189190 # Repeat request in a loop if the server returns completion_status == 1
190191 # (try again)
191- for attempt in xrange (RETRY_MAX_ATTEMPTS ): # pylint: disable=W0612
192+ for attempt in range (RETRY_MAX_ATTEMPTS ): # pylint: disable=W0612
192193 self ._socket .sendall (bytes (request ))
193194 response = Response (self , self ._read_response ())
194195
@@ -328,7 +329,7 @@ def replace(self, space_name, values):
328329
329330 :rtype: `Response` instance
330331 '''
331- if isinstance (space_name , basestring ):
332+ if isinstance (space_name , six . string_types ):
332333 space_name = self .schema .get_space (space_name ).sid
333334 request = RequestReplace (self , space_name , values )
334335 return self ._send_request (request )
@@ -377,7 +378,7 @@ def insert(self, space_name, values):
377378
378379 :rtype: `Response` instance
379380 '''
380- if isinstance (space_name , basestring ):
381+ if isinstance (space_name , six . string_types ):
381382 space_name = self .schema .get_space (space_name ).sid
382383 request = RequestInsert (self , space_name , values )
383384 return self ._send_request (request )
@@ -397,9 +398,9 @@ def delete(self, space_name, key, **kwargs):
397398 index_name = kwargs .get ("index" , 0 )
398399
399400 key = check_key (key )
400- if isinstance (space_name , basestring ):
401+ if isinstance (space_name , six . string_types ):
401402 space_name = self .schema .get_space (space_name ).sid
402- if isinstance (index_name , basestring ):
403+ if isinstance (index_name , six . string_types ):
403404 index_name = self .schema .get_index (space_name , index_name ).iid
404405 request = RequestDelete (self , space_name , index_name , key )
405406 return self ._send_request (request )
@@ -427,9 +428,9 @@ def update(self, space_name, key, op_list, **kwargs):
427428 index_name = kwargs .get ("index" , 0 )
428429
429430 key = check_key (key )
430- if isinstance (space_name , basestring ):
431+ if isinstance (space_name , six . string_types ):
431432 space_name = self .schema .get_space (space_name ).sid
432- if isinstance (index_name , basestring ):
433+ if isinstance (index_name , six . string_types ):
433434 index_name = self .schema .get_index (space_name , index_name ).iid
434435 request = RequestUpdate (self , space_name , index_name , key , op_list )
435436 return self ._send_request (request )
@@ -503,9 +504,9 @@ def select(self, space_name, key=None, **kwargs):
503504 # tuples)
504505 key = check_key (key , select = True )
505506
506- if isinstance (space_name , basestring ):
507+ if isinstance (space_name , six . string_types ):
507508 space_name = self .schema .get_space (space_name ).sid
508- if isinstance (index_name , basestring ):
509+ if isinstance (index_name , six . string_types ):
509510 index_name = self .schema .get_index (space_name , index_name ).iid
510511 request = RequestSelect (self , space_name , index_name , key , offset ,
511512 limit , iterator_type )
0 commit comments