55'''
66
77import os
8- import six
9- import copy
108import time
119import errno
12- import ctypes
13- import ctypes .util
1410import socket
15- import msgpack
1611
12+ import ctypes
13+ import ctypes .util
1714try :
1815 from ctypes import c_ssize_t
1916except ImportError :
2017 from ctypes import c_longlong as c_ssize_t
2118
22- import tarantool
19+ import msgpack
20+
21+ import tarantool .error
2322from tarantool .response import Response
2423from tarantool .request import (
2524 Request ,
4544 REQUEST_TYPE_OK ,
4645 REQUEST_TYPE_ERROR ,
4746 IPROTO_GREETING_SIZE ,
48- ENCODING_DEFAULT ,
4947 ITERATOR_EQ ,
5048 ITERATOR_ALL
5149)
5250from tarantool .error import (
5351 NetworkError ,
54- # DatabaseError,
52+ DatabaseError ,
53+ InterfaceError ,
54+ SchemaError ,
5555 NetworkWarning ,
5656 SchemaReloadException ,
5757 warn
5858)
5959from tarantool .schema import Schema
60- from tarantool .utils import check_key , greeting_decode , version_id
60+ from tarantool .utils import (
61+ check_key ,
62+ greeting_decode ,
63+ version_id ,
64+ string_types ,
65+ ENCODING_DEFAULT ,
66+ )
6167
6268
6369class Connection (object ):
@@ -70,10 +76,10 @@ class Connection(object):
7076 (insert/delete/update/select).
7177 '''
7278 Error = tarantool .error
73- DatabaseError = tarantool . error . DatabaseError
74- InterfaceError = tarantool . error . InterfaceError
75- SchemaError = tarantool . error . SchemaError
76- NetworkError = tarantool . error . NetworkError
79+ DatabaseError = DatabaseError
80+ InterfaceError = InterfaceError
81+ SchemaError = SchemaError
82+ NetworkError = NetworkError
7783
7884 def __init__ (self , host , port ,
7985 user = None ,
@@ -376,7 +382,7 @@ def replace(self, space_name, values):
376382
377383 :rtype: `Response` instance
378384 '''
379- if isinstance (space_name , six . string_types ):
385+ if isinstance (space_name , string_types ):
380386 space_name = self .schema .get_space (space_name ).sid
381387 request = RequestReplace (self , space_name , values )
382388 return self ._send_request (request )
@@ -433,7 +439,7 @@ class JoinState:
433439 def _ops_process (self , space , update_ops ):
434440 new_ops = []
435441 for op in update_ops :
436- if isinstance (op [1 ], six . string_types ):
442+ if isinstance (op [1 ], string_types ):
437443 op = list (op )
438444 op [1 ] = self .schema .get_field (space , op [1 ])['id' ]
439445 new_ops .append (op )
@@ -469,7 +475,7 @@ def insert(self, space_name, values):
469475
470476 :rtype: `Response` instance
471477 '''
472- if isinstance (space_name , six . string_types ):
478+ if isinstance (space_name , string_types ):
473479 space_name = self .schema .get_space (space_name ).sid
474480 request = RequestInsert (self , space_name , values )
475481 return self ._send_request (request )
@@ -490,9 +496,9 @@ def delete(self, space_name, key, **kwargs):
490496 index_name = kwargs .get ("index" , 0 )
491497
492498 key = check_key (key )
493- if isinstance (space_name , six . string_types ):
499+ if isinstance (space_name , string_types ):
494500 space_name = self .schema .get_space (space_name ).sid
495- if isinstance (index_name , six . string_types ):
501+ if isinstance (index_name , string_types ):
496502 index_name = self .schema .get_index (space_name , index_name ).iid
497503 request = RequestDelete (self , space_name , index_name , key )
498504 return self ._send_request (request )
@@ -561,9 +567,9 @@ def upsert(self, space_name, tuple_value, op_list, **kwargs):
561567 '''
562568 index_name = kwargs .get ("index" , 0 )
563569
564- if isinstance (space_name , six . string_types ):
570+ if isinstance (space_name , string_types ):
565571 space_name = self .schema .get_space (space_name ).sid
566- if isinstance (index_name , six . string_types ):
572+ if isinstance (index_name , string_types ):
567573 index_name = self .schema .get_index (space_name , index_name ).iid
568574 op_list = self ._ops_process (space_name , op_list )
569575 request = RequestUpsert (self , space_name , index_name , tuple_value ,
@@ -636,9 +642,9 @@ def update(self, space_name, key, op_list, **kwargs):
636642 index_name = kwargs .get ("index" , 0 )
637643
638644 key = check_key (key )
639- if isinstance (space_name , six . string_types ):
645+ if isinstance (space_name , string_types ):
640646 space_name = self .schema .get_space (space_name ).sid
641- if isinstance (index_name , six . string_types ):
647+ if isinstance (index_name , string_types ):
642648 index_name = self .schema .get_index (space_name , index_name ).iid
643649 op_list = self ._ops_process (space_name , op_list )
644650 request = RequestUpdate (self , space_name , index_name , key , op_list )
@@ -719,9 +725,9 @@ def select(self, space_name, key=None, **kwargs):
719725 # tuples)
720726 key = check_key (key , select = True )
721727
722- if isinstance (space_name , six . string_types ):
728+ if isinstance (space_name , string_types ):
723729 space_name = self .schema .get_space (space_name ).sid
724- if isinstance (index_name , six . string_types ):
730+ if isinstance (index_name , string_types ):
725731 index_name = self .schema .get_index (space_name , index_name ).iid
726732 request = RequestSelect (self , space_name , index_name , key , offset ,
727733 limit , iterator_type )
0 commit comments