@@ -123,54 +123,35 @@ async def ReadRow(self, row_key, **kwargs):
123123
124124 @error_safe
125125 async def MutateRow (self , request , ** kwargs ):
126- import base64
127126 from google .cloud .bigtable .mutations import Mutation
128127 table_id = request ["table_name" ].split ("/" )[- 1 ]
129128 app_profile_id = self .app_profile_id or request .get ("app_profile_id" , None )
130129 table = self .client .get_table (self .instance_id , table_id , app_profile_id )
131130 kwargs ["operation_timeout" ] = kwargs .get ("operation_timeout" , self .per_operation_timeout ) or 20
132131 row_key = request ["row_key" ]
133- try :
134- # conformance tests send row keys as base64 encoded strings
135- row_key = base64 .b64decode (row_key )
136- except Exception :
137- pass
138132 mutations = [Mutation ._from_dict (d ) for d in request ["mutations" ]]
139133 await table .mutate_row (row_key , mutations , ** kwargs )
140134 return "OK"
141135
142136 @error_safe
143137 async def BulkMutateRows (self , request , ** kwargs ):
144138 from google .cloud .bigtable .mutations import RowMutationEntry
145- import base64
146139 table_id = request ["table_name" ].split ("/" )[- 1 ]
147140 app_profile_id = self .app_profile_id or request .get ("app_profile_id" , None )
148141 table = self .client .get_table (self .instance_id , table_id , app_profile_id )
149142 kwargs ["operation_timeout" ] = kwargs .get ("operation_timeout" , self .per_operation_timeout ) or 20
150- # conformance tests send row keys as base64 encoded strings
151- for entry in request ["entries" ]:
152- try :
153- entry ["row_key" ] = base64 .b64decode (entry ["row_key" ])
154- except Exception :
155- pass
156143 entry_list = [RowMutationEntry ._from_dict (entry ) for entry in request ["entries" ]]
157144 await table .bulk_mutate_rows (entry_list , ** kwargs )
158145 return "OK"
159146
160147 @error_safe
161148 async def CheckAndMutateRow (self , request , ** kwargs ):
162149 from google .cloud .bigtable .mutations import Mutation , SetCell
163- import base64
164150 table_id = request ["table_name" ].split ("/" )[- 1 ]
165151 app_profile_id = self .app_profile_id or request .get ("app_profile_id" , None )
166152 table = self .client .get_table (self .instance_id , table_id , app_profile_id )
167153 kwargs ["operation_timeout" ] = kwargs .get ("operation_timeout" , self .per_operation_timeout ) or 20
168154 row_key = request ["row_key" ]
169- try :
170- # conformance tests send row keys as base64 encoded strings
171- row_key = base64 .b64decode (row_key )
172- except Exception :
173- pass
174155 # add default values for incomplete dicts, so they can still be parsed to objects
175156 true_mutations = []
176157 for mut_dict in request .get ("true_mutations" , []):
@@ -200,32 +181,16 @@ async def CheckAndMutateRow(self, request, **kwargs):
200181 async def ReadModifyWriteRow (self , request , ** kwargs ):
201182 from google .cloud .bigtable .read_modify_write_rules import IncrementRule
202183 from google .cloud .bigtable .read_modify_write_rules import AppendValueRule
203- import base64
204184 table_id = request ["table_name" ].split ("/" )[- 1 ]
205185 app_profile_id = self .app_profile_id or request .get ("app_profile_id" , None )
206186 table = self .client .get_table (self .instance_id , table_id , app_profile_id )
207187 kwargs ["operation_timeout" ] = kwargs .get ("operation_timeout" , self .per_operation_timeout ) or 20
208188 row_key = request ["row_key" ]
209- try :
210- # conformance tests send row keys as base64 encoded strings
211- row_key = base64 .b64decode (row_key )
212- except Exception :
213- pass
214189 rules = []
215- # conformance tests send qualifiers and values as base64 encoded strings
216190 for rule_dict in request .get ("rules" , []):
217191 qualifier = rule_dict ["column_qualifier" ]
218- try :
219- qualifier = base64 .b64decode (qualifier )
220- except Exception :
221- pass
222192 if "append_value" in rule_dict :
223- value = rule_dict ["append_value" ]
224- try :
225- value = base64 .b64decode (value )
226- except Exception :
227- pass
228- new_rule = AppendValueRule (rule_dict ["family_name" ], qualifier , value )
193+ new_rule = AppendValueRule (rule_dict ["family_name" ], qualifier , rule_dict ["append_value" ])
229194 else :
230195 new_rule = IncrementRule (rule_dict ["family_name" ], qualifier , rule_dict ["increment_amount" ])
231196 rules .append (new_rule )
0 commit comments