@@ -129,11 +129,11 @@ def connect(self):
129
129
raise NotImplementedError
130
130
131
131
@abc .abstractmethod
132
- def call (self , func_name , * args , ** kwargs ):
132
+ def call (self , func_name , * args ):
133
133
raise NotImplementedError
134
134
135
135
@abc .abstractmethod
136
- def eval (self , expr , * args , ** kwargs ):
136
+ def eval (self , expr , * args ):
137
137
raise NotImplementedError
138
138
139
139
@abc .abstractmethod
@@ -145,27 +145,28 @@ def insert(self, space_name, values):
145
145
raise NotImplementedError
146
146
147
147
@abc .abstractmethod
148
- def delete (self , space_name , key , ** kwargs ):
148
+ def delete (self , space_name , key , * , index = None ):
149
149
raise NotImplementedError
150
150
151
151
@abc .abstractmethod
152
- def upsert (self , space_name , tuple_value , op_list , ** kwargs ):
152
+ def upsert (self , space_name , tuple_value , op_list , * , index = None ):
153
153
raise NotImplementedError
154
154
155
155
@abc .abstractmethod
156
- def update (self , space_name , key , op_list , ** kwargs ):
156
+ def update (self , space_name , key , op_list , * , index = None ):
157
157
raise NotImplementedError
158
158
159
159
@abc .abstractmethod
160
160
def ping (self , notime ):
161
161
raise NotImplementedError
162
162
163
163
@abc .abstractmethod
164
- def select (self , space_name , key , ** kwargs ):
164
+ def select (self , space_name , key , * , offset = None , limit = None ,
165
+ index = None , iterator = None ):
165
166
raise NotImplementedError
166
167
167
168
@abc .abstractmethod
168
- def execute (self , query , params , ** kwargs ):
169
+ def execute (self , query , params ):
169
170
raise NotImplementedError
170
171
171
172
@@ -733,7 +734,7 @@ def insert(self, space_name, values):
733
734
request = RequestInsert (self , space_name , values )
734
735
return self ._send_request (request )
735
736
736
- def delete (self , space_name , key , ** kwargs ):
737
+ def delete (self , space_name , key , * , index = 0 ):
737
738
'''
738
739
Execute DELETE request.
739
740
Delete a single record identified by `key`. If you're using a secondary
@@ -746,17 +747,16 @@ def delete(self, space_name, key, **kwargs):
746
747
747
748
:rtype: `Response` instance
748
749
'''
749
- index_name = kwargs .get ("index" , 0 )
750
750
751
751
key = check_key (key )
752
752
if isinstance (space_name , str ):
753
753
space_name = self .schema .get_space (space_name ).sid
754
- if isinstance (index_name , str ):
755
- index_name = self .schema .get_index (space_name , index_name ).iid
756
- request = RequestDelete (self , space_name , index_name , key )
754
+ if isinstance (index , str ):
755
+ index = self .schema .get_index (space_name , index ).iid
756
+ request = RequestDelete (self , space_name , index , key )
757
757
return self ._send_request (request )
758
758
759
- def upsert (self , space_name , tuple_value , op_list , ** kwargs ):
759
+ def upsert (self , space_name , tuple_value , op_list , * , index = 0 ):
760
760
'''
761
761
Execute UPSERT request.
762
762
@@ -819,18 +819,17 @@ def upsert(self, space_name, tuple_value, op_list, **kwargs):
819
819
# Delete two fields, starting with the second field
820
820
[('#', 2, 2)]
821
821
'''
822
- index_name = kwargs .get ("index" , 0 )
823
822
824
823
if isinstance (space_name , str ):
825
824
space_name = self .schema .get_space (space_name ).sid
826
- if isinstance (index_name , str ):
827
- index_name = self .schema .get_index (space_name , index_name ).iid
825
+ if isinstance (index , str ):
826
+ index = self .schema .get_index (space_name , index ).iid
828
827
op_list = self ._ops_process (space_name , op_list )
829
- request = RequestUpsert (self , space_name , index_name , tuple_value ,
828
+ request = RequestUpsert (self , space_name , index , tuple_value ,
830
829
op_list )
831
830
return self ._send_request (request )
832
831
833
- def update (self , space_name , key , op_list , ** kwargs ):
832
+ def update (self , space_name , key , op_list , * , index = 0 ):
834
833
'''
835
834
Execute an UPDATE request.
836
835
@@ -894,15 +893,14 @@ def update(self, space_name, key, op_list, **kwargs):
894
893
# Delete two fields, starting with the second field
895
894
[('#', 2, 2)]
896
895
'''
897
- index_name = kwargs .get ("index" , 0 )
898
896
899
897
key = check_key (key )
900
898
if isinstance (space_name , str ):
901
899
space_name = self .schema .get_space (space_name ).sid
902
- if isinstance (index_name , str ):
903
- index_name = self .schema .get_index (space_name , index_name ).iid
900
+ if isinstance (index , str ):
901
+ index = self .schema .get_index (space_name , index ).iid
904
902
op_list = self ._ops_process (space_name , op_list )
905
- request = RequestUpdate (self , space_name , index_name , key , op_list )
903
+ request = RequestUpdate (self , space_name , index , key , op_list )
906
904
return self ._send_request (request )
907
905
908
906
def ping (self , notime = False ):
@@ -923,7 +921,7 @@ def ping(self, notime=False):
923
921
return "Success"
924
922
return t1 - t0
925
923
926
- def select (self , space_name , key = None , ** kwargs ):
924
+ def select (self , space_name , key = None , * , offset = 0 , limit = 0xffffffff , index = 0 , iterator = None ):
927
925
'''
928
926
Execute a SELECT request.
929
927
Select and retrieve data from the database.
@@ -964,28 +962,22 @@ def select(self, space_name, key=None, **kwargs):
964
962
>>> select(0, [])
965
963
'''
966
964
967
- # Initialize arguments and its defaults from **kwargs
968
- offset = kwargs .get ("offset" , 0 )
969
- limit = kwargs .get ("limit" , 0xffffffff )
970
- index_name = kwargs .get ("index" , 0 )
971
- iterator_type = kwargs .get ("iterator" )
972
-
973
- if iterator_type is None :
974
- iterator_type = ITERATOR_EQ
965
+ if iterator is None :
966
+ iterator = ITERATOR_EQ
975
967
if key is None or (isinstance (key , (list , tuple )) and
976
968
len (key ) == 0 ):
977
- iterator_type = ITERATOR_ALL
969
+ iterator = ITERATOR_ALL
978
970
979
971
# Perform smart type checking (scalar / list of scalars / list of
980
972
# tuples)
981
973
key = check_key (key , select = True )
982
974
983
975
if isinstance (space_name , str ):
984
976
space_name = self .schema .get_space (space_name ).sid
985
- if isinstance (index_name , str ):
986
- index_name = self .schema .get_index (space_name , index_name ).iid
987
- request = RequestSelect (self , space_name , index_name , key , offset ,
988
- limit , iterator_type )
977
+ if isinstance (index , str ):
978
+ index = self .schema .get_index (space_name , index ).iid
979
+ request = RequestSelect (self , space_name , index , key , offset ,
980
+ limit , iterator )
989
981
response = self ._send_request (request )
990
982
return response
991
983
0 commit comments