当前位置: 首页>>代码示例>>Python>>正文


Python types.TypeSerializer方法代码示例

本文整理汇总了Python中boto3.dynamodb.types.TypeSerializer方法的典型用法代码示例。如果您正苦于以下问题:Python types.TypeSerializer方法的具体用法?Python types.TypeSerializer怎么用?Python types.TypeSerializer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boto3.dynamodb.types的用法示例。


在下文中一共展示了types.TypeSerializer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from boto3.dynamodb import types [as 别名]
# 或者: from boto3.dynamodb.types import TypeSerializer [as 别名]
def __init__(self, transformer=None, condition_builder=None,
                 serializer=None, deserializer=None):
        self._transformer = transformer
        if transformer is None:
            self._transformer = ParameterTransformer()

        self._condition_builder = condition_builder
        if condition_builder is None:
            self._condition_builder = ConditionExpressionBuilder()

        self._serializer = serializer
        if serializer is None:
            self._serializer = TypeSerializer()

        self._deserializer = deserializer
        if deserializer is None:
            self._deserializer = TypeDeserializer() 
开发者ID:skarlekar,项目名称:faces,代码行数:19,代码来源:transform.py

示例2: dict_to_ddb

# 需要导入模块: from boto3.dynamodb import types [as 别名]
# 或者: from boto3.dynamodb.types import TypeSerializer [as 别名]
def dict_to_ddb(item):
    # type: (Dict[str, Any]) -> Dict[str, Any]
    # TODO: narrow these types down
    """Converts a native Python dictionary to a raw DynamoDB item.

    :param dict item: Native item
    :returns: DynamoDB item
    :rtype: dict
    """
    serializer = TypeSerializer()
    return {key: serializer.serialize(value) for key, value in item.items()} 
开发者ID:aws,项目名称:aws-dynamodb-encryption-python,代码行数:13,代码来源:transform.py

示例3: _serialize_deserialize_cycle

# 需要导入模块: from boto3.dynamodb import types [as 别名]
# 或者: from boto3.dynamodb.types import TypeSerializer [as 别名]
def _serialize_deserialize_cycle(attribute):
    raw_attribute = TypeSerializer().serialize(attribute)
    serialized_attribute = serialize_attribute(raw_attribute)
    cycled_attribute = deserialize_attribute(serialized_attribute)
    deserialized_attribute = TypeDeserializer().deserialize(cycled_attribute)
    assert deserialized_attribute == attribute 
开发者ID:aws,项目名称:aws-dynamodb-encryption-python,代码行数:8,代码来源:test_attribute.py

示例4: dumps

# 需要导入模块: from boto3.dynamodb import types [as 别名]
# 或者: from boto3.dynamodb.types import TypeSerializer [as 别名]
def dumps(dct, as_dict=False, **kwargs):
    """ Dump the dict to json in DynamoDB Format
        You can use any other simplejson or json options
        :param dct - the dict to dump
        :param as_dict - returns the result as python dict (useful for DynamoDB boto3 library) or as json sting
        :returns: DynamoDB json format.
        """

    result_ = TypeSerializer().serialize(json.loads(json.dumps(dct, default=json_serial),
                                                    use_decimal=True))
    if as_dict:
        return next(six.iteritems(result_))[1]
    else:
        return json.dumps(next(six.iteritems(result_))[1], **kwargs) 
开发者ID:Alonreznik,项目名称:dynamodb-json,代码行数:16,代码来源:json_util.py


注:本文中的boto3.dynamodb.types.TypeSerializer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。