Skip to content

Commit e9b623f

Browse files
lucasmcdonald3Lucas McDonald
andauthored
feat(Python): Commit Smithy-generated code (#1912)
Co-authored-by: Lucas McDonald <lucmcdon@amazon.com>
1 parent 418687f commit e9b623f

59 files changed

Lines changed: 22989 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
# Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
# Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
4+
5+
from _dafny import Map, Seq
6+
from aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes import (
7+
AttributeValue_B,
8+
AttributeValue_BOOL,
9+
AttributeValue_BS,
10+
AttributeValue_L,
11+
AttributeValue_M,
12+
AttributeValue_N,
13+
AttributeValue_NS,
14+
AttributeValue_NULL,
15+
AttributeValue_S,
16+
AttributeValue_SS,
17+
)
18+
import aws_cryptography_internal_dynamodb.smithygenerated.com_amazonaws_dynamodb.aws_sdk_to_dafny
19+
20+
21+
def com_amazonaws_dynamodb_AttributeValue(native_input):
22+
if "S" in native_input.keys():
23+
AttributeValue_union_value = AttributeValue_S(
24+
Seq(
25+
"".join(
26+
[
27+
chr(int.from_bytes(pair, "big"))
28+
for pair in zip(*[iter(native_input["S"].encode("utf-16-be"))] * 2)
29+
]
30+
)
31+
)
32+
)
33+
elif "N" in native_input.keys():
34+
AttributeValue_union_value = AttributeValue_N(
35+
Seq(
36+
"".join(
37+
[
38+
chr(int.from_bytes(pair, "big"))
39+
for pair in zip(*[iter(native_input["N"].encode("utf-16-be"))] * 2)
40+
]
41+
)
42+
)
43+
)
44+
elif "B" in native_input.keys():
45+
AttributeValue_union_value = AttributeValue_B(Seq(native_input["B"]))
46+
elif "SS" in native_input.keys():
47+
AttributeValue_union_value = AttributeValue_SS(
48+
Seq(
49+
[
50+
Seq(
51+
"".join(
52+
[
53+
chr(int.from_bytes(pair, "big"))
54+
for pair in zip(*[iter(list_element.encode("utf-16-be"))] * 2)
55+
]
56+
)
57+
)
58+
for list_element in native_input["SS"]
59+
]
60+
)
61+
)
62+
elif "NS" in native_input.keys():
63+
AttributeValue_union_value = AttributeValue_NS(
64+
Seq(
65+
[
66+
Seq(
67+
"".join(
68+
[
69+
chr(int.from_bytes(pair, "big"))
70+
for pair in zip(*[iter(list_element.encode("utf-16-be"))] * 2)
71+
]
72+
)
73+
)
74+
for list_element in native_input["NS"]
75+
]
76+
)
77+
)
78+
elif "BS" in native_input.keys():
79+
AttributeValue_union_value = AttributeValue_BS(Seq([Seq(list_element) for list_element in native_input["BS"]]))
80+
elif "M" in native_input.keys():
81+
AttributeValue_union_value = AttributeValue_M(
82+
Map(
83+
{
84+
Seq(
85+
"".join(
86+
[chr(int.from_bytes(pair, "big")) for pair in zip(*[iter(key.encode("utf-16-be"))] * 2)]
87+
)
88+
): aws_cryptography_internal_dynamodb.smithygenerated.com_amazonaws_dynamodb.aws_sdk_to_dafny.com_amazonaws_dynamodb_AttributeValue(
89+
value
90+
)
91+
for (key, value) in native_input["M"].items()
92+
}
93+
)
94+
)
95+
elif "L" in native_input.keys():
96+
AttributeValue_union_value = AttributeValue_L(
97+
Seq(
98+
[
99+
aws_cryptography_internal_dynamodb.smithygenerated.com_amazonaws_dynamodb.aws_sdk_to_dafny.com_amazonaws_dynamodb_AttributeValue(
100+
list_element
101+
)
102+
for list_element in native_input["L"]
103+
]
104+
)
105+
)
106+
elif "NULL" in native_input.keys():
107+
AttributeValue_union_value = AttributeValue_NULL(native_input["NULL"])
108+
elif "BOOL" in native_input.keys():
109+
AttributeValue_union_value = AttributeValue_BOOL(native_input["BOOL"])
110+
else:
111+
raise ValueError("No recognized union value in union type: " + str(native_input))
112+
113+
return AttributeValue_union_value

0 commit comments

Comments
 (0)