@@ -107,7 +107,9 @@ def _execute_operation(
107
107
operation_name : str ,
108
108
) -> Output :
109
109
try :
110
- return self ._handle_execution (input , plugins , serialize , deserialize , config , operation_name )
110
+ return self ._handle_execution (
111
+ input , plugins , serialize , deserialize , config , operation_name
112
+ )
111
113
except Exception as e :
112
114
# Make sure every exception that we throw is an instance of ServiceError so
113
115
# customers can reliably catch everything we throw.
@@ -171,7 +173,9 @@ def _handle_execution(
171
173
interceptor .read_before_serialization (context )
172
174
173
175
# Step 4: Serialize the request
174
- context_with_transport_request = cast (InterceptorContext [Input , None , DafnyRequest , None ], context )
176
+ context_with_transport_request = cast (
177
+ InterceptorContext [Input , None , DafnyRequest , None ], context
178
+ )
175
179
context_with_transport_request ._transport_request = serialize (
176
180
context_with_transport_request .request , config
177
181
)
@@ -182,8 +186,8 @@ def _handle_execution(
182
186
183
187
# Step 6: Invoke modify_before_retry_loop
184
188
for interceptor in interceptors :
185
- context_with_transport_request ._transport_request = interceptor . modify_before_retry_loop (
186
- context_with_transport_request
189
+ context_with_transport_request ._transport_request = (
190
+ interceptor . modify_before_retry_loop ( context_with_transport_request )
187
191
)
188
192
189
193
# Step 7: Acquire the retry token.
@@ -233,7 +237,9 @@ def _handle_execution(
233
237
# The response will be set either with the modeled output or an exception. The
234
238
# transport_request and transport_response may be set or None.
235
239
execution_context = cast (
236
- InterceptorContext [Input , Output , DafnyRequest | None , DafnyResponse | None ],
240
+ InterceptorContext [
241
+ Input , Output , DafnyRequest | None , DafnyResponse | None
242
+ ],
237
243
context ,
238
244
)
239
245
return self ._finalize_execution (interceptors , execution_context )
@@ -255,10 +261,14 @@ def _handle_attempt(
255
261
if config .dafnyImplInterface .impl is None :
256
262
raise Exception ("No impl found on the operation config." )
257
263
258
- context_with_response = cast (InterceptorContext [Input , None , DafnyRequest , DafnyResponse ], context )
264
+ context_with_response = cast (
265
+ InterceptorContext [Input , None , DafnyRequest , DafnyResponse ], context
266
+ )
259
267
260
- context_with_response ._transport_response = config .dafnyImplInterface .handle_request (
261
- input = context_with_response .transport_request
268
+ context_with_response ._transport_response = (
269
+ config .dafnyImplInterface .handle_request (
270
+ input = context_with_response .transport_request
271
+ )
262
272
)
263
273
264
274
# Step 7n: Invoke read_after_transmit
@@ -267,8 +277,8 @@ def _handle_attempt(
267
277
268
278
# Step 7o: Invoke modify_before_deserialization
269
279
for interceptor in interceptors :
270
- context_with_response ._transport_response = interceptor . modify_before_deserialization (
271
- context_with_response
280
+ context_with_response ._transport_response = (
281
+ interceptor . modify_before_deserialization ( context_with_response )
272
282
)
273
283
274
284
# Step 7p: Invoke read_before_deserialization
@@ -280,7 +290,9 @@ def _handle_attempt(
280
290
InterceptorContext [Input , Output , DafnyRequest , DafnyResponse ],
281
291
context_with_response ,
282
292
)
283
- context_with_output ._response = deserialize (context_with_output ._transport_response , config )
293
+ context_with_output ._response = deserialize (
294
+ context_with_output ._transport_response , config
295
+ )
284
296
285
297
# Step 7r: Invoke read_after_deserialization
286
298
for interceptor in interceptors :
@@ -306,7 +318,9 @@ def _finalize_attempt(
306
318
# Step 7s: Invoke modify_before_attempt_completion
307
319
try :
308
320
for interceptor in interceptors :
309
- context ._response = interceptor .modify_before_attempt_completion (context )
321
+ context ._response = interceptor .modify_before_attempt_completion (
322
+ context
323
+ )
310
324
except Exception as e :
311
325
context ._response = e
312
326
@@ -322,7 +336,9 @@ def _finalize_attempt(
322
336
def _finalize_execution (
323
337
self ,
324
338
interceptors : list [Interceptor [Input , Output , DafnyRequest , DafnyResponse ]],
325
- context : InterceptorContext [Input , Output , DafnyRequest | None , DafnyResponse | None ],
339
+ context : InterceptorContext [
340
+ Input , Output , DafnyRequest | None , DafnyResponse | None
341
+ ],
326
342
) -> Output :
327
343
try :
328
344
# Step 9: Invoke modify_before_completion
0 commit comments