當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。