Skip to content

feat(Python): Commit Smithy-generated code #1912

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: python-reviewed
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# Do not modify this file. This file is machine generated, and any changes to it will be overwritten.
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
# Do not modify this file. This file is machine generated, and any changes to it will be overwritten.

from _dafny import Map, Seq
from aws_cryptography_internal_dynamodb.internaldafny.generated.ComAmazonawsDynamodbTypes import (
AttributeValue_B,
AttributeValue_BOOL,
AttributeValue_BS,
AttributeValue_L,
AttributeValue_M,
AttributeValue_N,
AttributeValue_NS,
AttributeValue_NULL,
AttributeValue_S,
AttributeValue_SS,
)
import aws_cryptography_internal_dynamodb.smithygenerated.com_amazonaws_dynamodb.aws_sdk_to_dafny


def com_amazonaws_dynamodb_AttributeValue(native_input):
if "S" in native_input.keys():
AttributeValue_union_value = AttributeValue_S(
Seq(
"".join(
[
chr(int.from_bytes(pair, "big"))
for pair in zip(*[iter(native_input["S"].encode("utf-16-be"))] * 2)
]
)
)
)
elif "N" in native_input.keys():
AttributeValue_union_value = AttributeValue_N(
Seq(
"".join(
[
chr(int.from_bytes(pair, "big"))
for pair in zip(*[iter(native_input["N"].encode("utf-16-be"))] * 2)
]
)
)
)
elif "B" in native_input.keys():
AttributeValue_union_value = AttributeValue_B(Seq(native_input["B"]))
elif "SS" in native_input.keys():
AttributeValue_union_value = AttributeValue_SS(
Seq(
[
Seq(
"".join(
[
chr(int.from_bytes(pair, "big"))
for pair in zip(*[iter(list_element.encode("utf-16-be"))] * 2)
]
)
)
for list_element in native_input["SS"]
]
)
)
elif "NS" in native_input.keys():
AttributeValue_union_value = AttributeValue_NS(
Seq(
[
Seq(
"".join(
[
chr(int.from_bytes(pair, "big"))
for pair in zip(*[iter(list_element.encode("utf-16-be"))] * 2)
]
)
)
for list_element in native_input["NS"]
]
)
)
elif "BS" in native_input.keys():
AttributeValue_union_value = AttributeValue_BS(Seq([Seq(list_element) for list_element in native_input["BS"]]))
elif "M" in native_input.keys():
AttributeValue_union_value = AttributeValue_M(
Map(
{
Seq(
"".join(
[chr(int.from_bytes(pair, "big")) for pair in zip(*[iter(key.encode("utf-16-be"))] * 2)]
)
): aws_cryptography_internal_dynamodb.smithygenerated.com_amazonaws_dynamodb.aws_sdk_to_dafny.com_amazonaws_dynamodb_AttributeValue(
value
)
for (key, value) in native_input["M"].items()
}
)
)
elif "L" in native_input.keys():
AttributeValue_union_value = AttributeValue_L(
Seq(
[
aws_cryptography_internal_dynamodb.smithygenerated.com_amazonaws_dynamodb.aws_sdk_to_dafny.com_amazonaws_dynamodb_AttributeValue(
list_element
)
for list_element in native_input["L"]
]
)
)
elif "NULL" in native_input.keys():
AttributeValue_union_value = AttributeValue_NULL(native_input["NULL"])
elif "BOOL" in native_input.keys():
AttributeValue_union_value = AttributeValue_BOOL(native_input["BOOL"])
else:
raise ValueError("No recognized union value in union type: " + str(native_input))

return AttributeValue_union_value
Loading
Loading