3535Input = TypeVar ("Input" )
3636Output = TypeVar ("Output" )
3737
38+
3839class DynamoDbEncryption :
3940 """Client for DynamoDbEncryption
4041
4142 :param config: Configuration for the client.
4243 """
44+
4345 def __init__ (
44- self ,
45- config : DynamoDbEncryptionConfig | None = None ,
46- dafny_client : IDynamoDbEncryptionClient | None = None
46+ self , config : DynamoDbEncryptionConfig | None = None , dafny_client : IDynamoDbEncryptionClient | None = None
4747 ):
4848 if config is None :
4949 self ._config = Config ()
@@ -60,7 +60,9 @@ def __init__(
6060 if dafny_client is not None :
6161 self ._config .dafnyImplInterface .impl = dafny_client
6262
63- def create_dynamo_db_encryption_branch_key_id_supplier (self , input : CreateDynamoDbEncryptionBranchKeyIdSupplierInput ) -> CreateDynamoDbEncryptionBranchKeyIdSupplierOutput :
63+ def create_dynamo_db_encryption_branch_key_id_supplier (
64+ self , input : CreateDynamoDbEncryptionBranchKeyIdSupplierInput
65+ ) -> CreateDynamoDbEncryptionBranchKeyIdSupplierOutput :
6466 """Create a Branch Key Supplier for use with the Hierarchical Keyring that decides what Branch Key to use based on the primary key of the DynamoDB item being read or written.
6567
6668 :param input: Inputs for creating a Branch Key Supplier from a DynamoDB Key Branch Key Id Supplier
@@ -74,7 +76,9 @@ def create_dynamo_db_encryption_branch_key_id_supplier(self, input: CreateDynamo
7476 operation_name = "CreateDynamoDbEncryptionBranchKeyIdSupplier" ,
7577 )
7678
77- def get_encrypted_data_key_description (self , input : GetEncryptedDataKeyDescriptionInput ) -> GetEncryptedDataKeyDescriptionOutput :
79+ def get_encrypted_data_key_description (
80+ self , input : GetEncryptedDataKeyDescriptionInput
81+ ) -> GetEncryptedDataKeyDescriptionOutput :
7882 """Returns encrypted data key description.
7983
8084 :param input: Input for getting encrypted data key description.
@@ -98,9 +102,7 @@ def _execute_operation(
98102 operation_name : str ,
99103 ) -> Output :
100104 try :
101- return self ._handle_execution (
102- input , plugins , serialize , deserialize , config , operation_name
103- )
105+ return self ._handle_execution (input , plugins , serialize , deserialize , config , operation_name )
104106 except Exception as e :
105107 # Make sure every exception that we throw is an instance of ServiceError so
106108 # customers can reliably catch everything we throw.
@@ -124,13 +126,11 @@ def _handle_execution(
124126 transport_response = None ,
125127 )
126128 try :
127- _client_interceptors = config .interceptors
129+ _client_interceptors = config .interceptors
128130 except AttributeError :
129- config .interceptors = []
130- _client_interceptors = config .interceptors
131- client_interceptors = cast (
132- list [Interceptor [Input , Output , DafnyRequest , DafnyResponse ]], _client_interceptors
133- )
131+ config .interceptors = []
132+ _client_interceptors = config .interceptors
133+ client_interceptors = cast (list [Interceptor [Input , Output , DafnyRequest , DafnyResponse ]], _client_interceptors )
134134 interceptors = client_interceptors
135135
136136 try :
@@ -163,9 +163,7 @@ def _handle_execution(
163163 interceptor .read_before_serialization (context )
164164
165165 # Step 4: Serialize the request
166- context_with_transport_request = cast (
167- InterceptorContext [Input , None , DafnyRequest , None ], context
168- )
166+ context_with_transport_request = cast (InterceptorContext [Input , None , DafnyRequest , None ], context )
169167 context_with_transport_request ._transport_request = serialize (
170168 context_with_transport_request .request , config
171169 )
@@ -176,8 +174,8 @@ def _handle_execution(
176174
177175 # Step 6: Invoke modify_before_retry_loop
178176 for interceptor in interceptors :
179- context_with_transport_request ._transport_request = (
180- interceptor . modify_before_retry_loop ( context_with_transport_request )
177+ context_with_transport_request ._transport_request = interceptor . modify_before_retry_loop (
178+ context_with_transport_request
181179 )
182180
183181 # Step 7: Acquire the retry token.
@@ -212,7 +210,7 @@ def _handle_execution(
212210 error_info = RetryErrorInfo (
213211 # TODO: Determine the error type.
214212 error_type = RetryErrorType .CLIENT_ERROR ,
215- )
213+ ),
216214 )
217215 except SmithyRetryException :
218216 raise context_with_response .response
@@ -226,9 +224,7 @@ def _handle_execution(
226224 # At this point, the context's request will have been definitively set, and
227225 # The response will be set either with the modeled output or an exception. The
228226 # transport_request and transport_response may be set or None.
229- execution_context = cast (
230- InterceptorContext [Input , Output , DafnyRequest | None , DafnyResponse | None ], context
231- )
227+ execution_context = cast (InterceptorContext [Input , Output , DafnyRequest | None , DafnyResponse | None ], context )
232228 return self ._finalize_execution (interceptors , execution_context )
233229
234230 def _handle_attempt (
@@ -248,9 +244,7 @@ def _handle_attempt(
248244 if config .dafnyImplInterface .impl is None :
249245 raise Exception ("No impl found on the operation config." )
250246
251- context_with_response = cast (
252- InterceptorContext [Input , None , DafnyRequest , DafnyResponse ], context
253- )
247+ context_with_response = cast (InterceptorContext [Input , None , DafnyRequest , DafnyResponse ], context )
254248
255249 context_with_response ._transport_response = config .dafnyImplInterface .handle_request (
256250 input = context_with_response .transport_request
@@ -262,8 +256,8 @@ def _handle_attempt(
262256
263257 # Step 7o: Invoke modify_before_deserialization
264258 for interceptor in interceptors :
265- context_with_response ._transport_response = (
266- interceptor . modify_before_deserialization ( context_with_response )
259+ context_with_response ._transport_response = interceptor . modify_before_deserialization (
260+ context_with_response
267261 )
268262
269263 # Step 7p: Invoke read_before_deserialization
@@ -275,9 +269,7 @@ def _handle_attempt(
275269 InterceptorContext [Input , Output , DafnyRequest , DafnyResponse ],
276270 context_with_response ,
277271 )
278- context_with_output ._response = deserialize (
279- context_with_output ._transport_response , config
280- )
272+ context_with_output ._response = deserialize (context_with_output ._transport_response , config )
281273
282274 # Step 7r: Invoke read_after_deserialization
283275 for interceptor in interceptors :
@@ -289,9 +281,7 @@ def _handle_attempt(
289281 # the response is either set or an exception, and the transport_resposne is either set or
290282 # None. This will also be true after _finalize_attempt because there is no opportunity
291283 # there to set the transport_response.
292- attempt_context = cast (
293- InterceptorContext [Input , Output , DafnyRequest , DafnyResponse | None ], context
294- )
284+ attempt_context = cast (InterceptorContext [Input , Output , DafnyRequest , DafnyResponse | None ], context )
295285 return self ._finalize_attempt (interceptors , attempt_context )
296286
297287 def _finalize_attempt (
@@ -302,9 +292,7 @@ def _finalize_attempt(
302292 # Step 7s: Invoke modify_before_attempt_completion
303293 try :
304294 for interceptor in interceptors :
305- context ._response = interceptor .modify_before_attempt_completion (
306- context
307- )
295+ context ._response = interceptor .modify_before_attempt_completion (context )
308296 except Exception as e :
309297 context ._response = e
310298
0 commit comments