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


Python marshmallow.post_dump方法代码示例

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


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

示例1: post_dump

# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_dump [as 别名]
def post_dump(self, data, **kwargs):
        """Post dump hook."""
        data["service"] = []

        for service_entry in data["service_dids"]:
            data["service"].append(service_entry)
        for service_entry in data["service_blocks"]:
            data["service"].append(service_entry)

        del data["service_dids"]
        del data["service_blocks"]

        return data 
开发者ID:hyperledger,项目名称:aries-cloudagent-python,代码行数:15,代码来源:invitation.py

示例2: post_dump

# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_dump [as 别名]
def post_dump(self, data, **kwargs):
        if data["is_subdataset"]:
            data["subdataset"] = data["name"]
        else:
            data["dataset"] = data["name"]

        del data["name"]
        del data["is_subdataset"]
        return data 
开发者ID:paperswithcode,项目名称:sota-extractor,代码行数:11,代码来源:schemas.py

示例3: __init__

# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_dump [as 别名]
def __init__(
        self,
        # _id: str = None,
        *,
        comment: str = None,
        label: str = None,
        handshake_protocols: Sequence[Text] = None,
        request_attach: Sequence[AttachDecorator] = None,
        # When loading, we sort service in the two lists
        service: Sequence[Union[Service, Text]] = [],
        service_blocks: Sequence[Service] = [],
        service_dids: Sequence[Text] = [],
        **kwargs,
    ):
        """
        Initialize invitation object.

        Args:
            request_attach: request attachments

        """
        # super().__init__(_id=_id, **kwargs)
        super().__init__(**kwargs)
        self.label = label
        self.handshake_protocols = (
            list(handshake_protocols) if handshake_protocols else []
        )
        self.request_attach = list(request_attach) if request_attach else []

        # In order to accept and validate both string entries and
        # dict block entries, we include both in schema and manipulate
        # data in pre_load and post_dump
        self.service_blocks = list(service_blocks) if service_blocks else []
        self.service_dids = list(service_dids) if service_dids else []

        # In the case of loading, we need to sort
        # the entries into relevant lists for schema validation
        for s in service:
            if type(s) is Service:
                self.service_blocks.append(s)
            if type(s) is str:
                self.service_dids.append(s) 
开发者ID:hyperledger,项目名称:aries-cloudagent-python,代码行数:44,代码来源:invitation.py

示例4: __init__

# 需要导入模块: import marshmallow [as 别名]
# 或者: from marshmallow import post_dump [as 别名]
def __init__(self):
        self.Serializer = flask_ma.Schema
        self.ModelSerializer = ModelSerializer

        # alias marshmallow stuffs
        self.pre_load = ma.pre_load
        self.post_load = ma.post_load
        self.pre_dump = ma.pre_dump
        self.post_dump = ma.post_dump
        self.validates = ma.validates
        self.validates_schema = ma.validates_schema
        self.ValidationError = ma.ValidationError

        # alias marshmallow fields
        self.Bool = ma.fields.Bool
        self.Boolean = ma.fields.Boolean
        self.Constant = ma.fields.Constant
        self.Date = ma.fields.Date
        self.DateTime = ma.fields.DateTime
        self.NaiveDateTime = ma.fields.NaiveDateTime
        self.AwareDateTime = ma.fields.AwareDateTime
        self.Decimal = ma.fields.Decimal
        self.Dict = ma.fields.Dict
        self.Email = ma.fields.Email
        self.Field = ma.fields.Field
        self.Float = ma.fields.Float
        self.Function = ma.fields.Function
        self.Int = ma.fields.Int
        self.Integer = ma.fields.Integer
        self.List = ma.fields.List
        self.Mapping = ma.fields.Mapping
        self.Method = ma.fields.Method
        self.Nested = ma.fields.Nested
        self.Number = ma.fields.Number
        self.Pluck = ma.fields.Pluck
        self.Raw = ma.fields.Raw
        self.Str = ma.fields.Str
        self.String = ma.fields.String
        self.Time = ma.fields.Time
        self.TimeDelta = ma.fields.TimeDelta
        self.Tuple = ma.fields.Tuple
        self.UUID = ma.fields.UUID
        self.Url = ma.fields.Url
        self.URL = ma.fields.URL

        # alias flask_marshmallow fields
        self.AbsoluteUrlFor = flask_ma.fields.AbsoluteUrlFor
        self.AbsoluteURLFor = flask_ma.fields.AbsoluteURLFor
        self.UrlFor = flask_ma.fields.UrlFor
        self.URLFor = flask_ma.fields.URLFor
        self.Hyperlinks = flask_ma.fields.Hyperlinks
        self.HyperlinkRelated = HyperlinkRelated 
开发者ID:briancappello,项目名称:flask-unchained,代码行数:54,代码来源:marshmallow.py


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