Skip to content

Commit adc0bb1

Browse files
author
Lucas McDonald
committed
m
1 parent 2201e4a commit adc0bb1

File tree

39 files changed

+2176
-641
lines changed

39 files changed

+2176
-641
lines changed

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/smithygenerated/aws_cryptography_dbencryptionsdk_dynamodb/aws_sdk_to_dafny.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ def com_amazonaws_dynamodb_AttributeValue(native_input):
2525
"".join(
2626
[
2727
chr(int.from_bytes(pair, "big"))
28-
for pair in zip(*[iter(native_input["S"].encode("utf-16-be"))] * 2)
28+
for pair in zip(
29+
*[iter(native_input["S"].encode("utf-16-be"))] * 2
30+
)
2931
]
3032
)
3133
)
@@ -36,7 +38,9 @@ def com_amazonaws_dynamodb_AttributeValue(native_input):
3638
"".join(
3739
[
3840
chr(int.from_bytes(pair, "big"))
39-
for pair in zip(*[iter(native_input["N"].encode("utf-16-be"))] * 2)
41+
for pair in zip(
42+
*[iter(native_input["N"].encode("utf-16-be"))] * 2
43+
)
4044
]
4145
)
4246
)
@@ -51,7 +55,9 @@ def com_amazonaws_dynamodb_AttributeValue(native_input):
5155
"".join(
5256
[
5357
chr(int.from_bytes(pair, "big"))
54-
for pair in zip(*[iter(list_element.encode("utf-16-be"))] * 2)
58+
for pair in zip(
59+
*[iter(list_element.encode("utf-16-be"))] * 2
60+
)
5561
]
5662
)
5763
)
@@ -67,7 +73,9 @@ def com_amazonaws_dynamodb_AttributeValue(native_input):
6773
"".join(
6874
[
6975
chr(int.from_bytes(pair, "big"))
70-
for pair in zip(*[iter(list_element.encode("utf-16-be"))] * 2)
76+
for pair in zip(
77+
*[iter(list_element.encode("utf-16-be"))] * 2
78+
)
7179
]
7280
)
7381
)
@@ -76,14 +84,19 @@ def com_amazonaws_dynamodb_AttributeValue(native_input):
7684
)
7785
)
7886
elif "BS" in native_input.keys():
79-
AttributeValue_union_value = AttributeValue_BS(Seq([Seq(list_element) for list_element in native_input["BS"]]))
87+
AttributeValue_union_value = AttributeValue_BS(
88+
Seq([Seq(list_element) for list_element in native_input["BS"]])
89+
)
8090
elif "M" in native_input.keys():
8191
AttributeValue_union_value = AttributeValue_M(
8292
Map(
8393
{
8494
Seq(
8595
"".join(
86-
[chr(int.from_bytes(pair, "big")) for pair in zip(*[iter(key.encode("utf-16-be"))] * 2)]
96+
[
97+
chr(int.from_bytes(pair, "big"))
98+
for pair in zip(*[iter(key.encode("utf-16-be"))] * 2)
99+
]
87100
)
88101
): aws_cryptography_internal_dynamodb.smithygenerated.com_amazonaws_dynamodb.aws_sdk_to_dafny.com_amazonaws_dynamodb_AttributeValue(
89102
value
@@ -108,6 +121,8 @@ def com_amazonaws_dynamodb_AttributeValue(native_input):
108121
elif "BOOL" in native_input.keys():
109122
AttributeValue_union_value = AttributeValue_BOOL(native_input["BOOL"])
110123
else:
111-
raise ValueError("No recognized union value in union type: " + str(native_input))
124+
raise ValueError(
125+
"No recognized union value in union type: " + str(native_input)
126+
)
112127

113128
return AttributeValue_union_value

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/smithygenerated/aws_cryptography_dbencryptionsdk_dynamodb/client.py

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ def _execute_operation(
107107
operation_name: str,
108108
) -> Output:
109109
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+
)
111113
except Exception as e:
112114
# Make sure every exception that we throw is an instance of ServiceError so
113115
# customers can reliably catch everything we throw.
@@ -171,7 +173,9 @@ def _handle_execution(
171173
interceptor.read_before_serialization(context)
172174

173175
# 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+
)
175179
context_with_transport_request._transport_request = serialize(
176180
context_with_transport_request.request, config
177181
)
@@ -182,8 +186,8 @@ def _handle_execution(
182186

183187
# Step 6: Invoke modify_before_retry_loop
184188
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)
187191
)
188192

189193
# Step 7: Acquire the retry token.
@@ -233,7 +237,9 @@ def _handle_execution(
233237
# The response will be set either with the modeled output or an exception. The
234238
# transport_request and transport_response may be set or None.
235239
execution_context = cast(
236-
InterceptorContext[Input, Output, DafnyRequest | None, DafnyResponse | None],
240+
InterceptorContext[
241+
Input, Output, DafnyRequest | None, DafnyResponse | None
242+
],
237243
context,
238244
)
239245
return self._finalize_execution(interceptors, execution_context)
@@ -255,10 +261,14 @@ def _handle_attempt(
255261
if config.dafnyImplInterface.impl is None:
256262
raise Exception("No impl found on the operation config.")
257263

258-
context_with_response = cast(InterceptorContext[Input, None, DafnyRequest, DafnyResponse], context)
264+
context_with_response = cast(
265+
InterceptorContext[Input, None, DafnyRequest, DafnyResponse], context
266+
)
259267

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+
)
262272
)
263273

264274
# Step 7n: Invoke read_after_transmit
@@ -267,8 +277,8 @@ def _handle_attempt(
267277

268278
# Step 7o: Invoke modify_before_deserialization
269279
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)
272282
)
273283

274284
# Step 7p: Invoke read_before_deserialization
@@ -280,7 +290,9 @@ def _handle_attempt(
280290
InterceptorContext[Input, Output, DafnyRequest, DafnyResponse],
281291
context_with_response,
282292
)
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+
)
284296

285297
# Step 7r: Invoke read_after_deserialization
286298
for interceptor in interceptors:
@@ -306,7 +318,9 @@ def _finalize_attempt(
306318
# Step 7s: Invoke modify_before_attempt_completion
307319
try:
308320
for interceptor in interceptors:
309-
context._response = interceptor.modify_before_attempt_completion(context)
321+
context._response = interceptor.modify_before_attempt_completion(
322+
context
323+
)
310324
except Exception as e:
311325
context._response = e
312326

@@ -322,7 +336,9 @@ def _finalize_attempt(
322336
def _finalize_execution(
323337
self,
324338
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+
],
326342
) -> Output:
327343
try:
328344
# Step 9: Invoke modify_before_completion

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/smithygenerated/aws_cryptography_dbencryptionsdk_dynamodb/dafny_to_aws_sdk.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,40 @@ def com_amazonaws_dynamodb_AttributeValue(dafny_input):
2121
# Convert AttributeValue
2222
if isinstance(dafny_input, AttributeValue_S):
2323
AttributeValue_union_value = {
24-
"S": b"".join(ord(c).to_bytes(2, "big") for c in dafny_input.S).decode("utf-16-be")
24+
"S": b"".join(ord(c).to_bytes(2, "big") for c in dafny_input.S).decode(
25+
"utf-16-be"
26+
)
2527
}
2628
elif isinstance(dafny_input, AttributeValue_N):
2729
AttributeValue_union_value = {
28-
"N": b"".join(ord(c).to_bytes(2, "big") for c in dafny_input.N).decode("utf-16-be")
30+
"N": b"".join(ord(c).to_bytes(2, "big") for c in dafny_input.N).decode(
31+
"utf-16-be"
32+
)
2933
}
3034
elif isinstance(dafny_input, AttributeValue_B):
3135
AttributeValue_union_value = {"B": bytes(dafny_input.B)}
3236
elif isinstance(dafny_input, AttributeValue_SS):
3337
AttributeValue_union_value = {
3438
"SS": [
35-
b"".join(ord(c).to_bytes(2, "big") for c in list_element).decode("utf-16-be")
39+
b"".join(ord(c).to_bytes(2, "big") for c in list_element).decode(
40+
"utf-16-be"
41+
)
3642
for list_element in dafny_input.SS
3743
]
3844
}
3945
elif isinstance(dafny_input, AttributeValue_NS):
4046
AttributeValue_union_value = {
4147
"NS": [
42-
b"".join(ord(c).to_bytes(2, "big") for c in list_element).decode("utf-16-be")
48+
b"".join(ord(c).to_bytes(2, "big") for c in list_element).decode(
49+
"utf-16-be"
50+
)
4351
for list_element in dafny_input.NS
4452
]
4553
}
4654
elif isinstance(dafny_input, AttributeValue_BS):
47-
AttributeValue_union_value = {"BS": [bytes(list_element) for list_element in dafny_input.BS]}
55+
AttributeValue_union_value = {
56+
"BS": [bytes(list_element) for list_element in dafny_input.BS]
57+
}
4858
elif isinstance(dafny_input, AttributeValue_M):
4959
AttributeValue_union_value = {
5060
"M": {

0 commit comments

Comments
 (0)