コード例 #1
0
ファイル: schema.py プロジェクト: labthings/python-labthings
    def __init__(self, field: fields.Field):
        """Create a converter for data of the field type

        Args:
            field (Field): Marshmallow Field type of data
        """
        Schema.__init__(self)
        self.field = field
コード例 #2
0
    def __init__(self, *args, **kwargs):
        schema_kwargs = {'many': kwargs.get('many', False)}
        # Remove any kwargs that are only valid for marshmallow schemas
        for key in _schema_kwargs:
            if key in kwargs:
                schema_kwargs[key] = kwargs.pop(key)

        super(Schema, self).__init__(*args, **kwargs)
        MarshmallowSchema.__init__(self, **schema_kwargs)
コード例 #3
0
    def __init__(self, *args, **kwargs):
        schema_kwargs = {"many": kwargs.get("many", False)}
        # Remove any kwargs that are only valid for marshmallow schemas
        for key in _schema_kwargs:
            if key in kwargs:
                schema_kwargs[key] = kwargs.pop(key)

        super(Schema, self).__init__(*args, **kwargs)
        MarshmallowSchema.__init__(self, **schema_kwargs)
コード例 #4
0
    def __init__(self, *args, **kwargs):
        schema_kwargs = {
            'many': kwargs.get('many', False)
        }
        # Remove any kwargs that are only valid for marshmallow schemas
        for key in _schema_kwargs:
            if key in kwargs:
                schema_kwargs[key] = kwargs.pop(key)

        super(Schema, self).__init__(*args, **kwargs)
        # XXX: Remove parent attribute so that Field.root resolves properly
        #  https://github.com/marshmallow-code/django-rest-marshmallow/issues/131#issuecomment-601089549
        delattr(self, 'parent')
        MarshmallowSchema.__init__(self, **schema_kwargs)
コード例 #5
0
ファイル: serializers.py プロジェクト: josephliu22/ARTBot
 def __init__(self, valid_color_keys):
     Schema.__init__(self)
     self._valid_color_keys = valid_color_keys