“ str”不是棉花糖和棉花糖数据类的数据类错误

时间:2020-03-12 15:25:01

标签: python types marshmallow python-dataclasses

我正在使用python,尝试使用marshmallowmarshmallow-dataclass为我的数据类创建数据模式。我相信我已经遵循了文档,将修饰符添加到相关的数据类中,并将NewType添加到非标准python对象的字段中。但是,在加载程序之前我遇到了一个错误。

错误与str不是数据类有关,我也不知道装饰器如何处理字符串而不是数据类。

我敢肯定,我错过了一些简单的事情,如果是这样,请提前道歉。

该代码的摘要版本为:

from marshmallow_dataclass import dataclass as m_dataclass, NewType

ProjectileDataType = NewType("ProjectileDataType", Any)

@m_dataclass
class ProjectileData:
    Schema: ClassVar[Type[Schema]] = Schema

    # what created it?
    skill_name: str = field(default="None")

    # what does it look like?
    sprite: str = field(default="None")

defintions.py:https://pastebin.com/tHnVE2Gc 错误回溯:https://pastebin.com/htuqhKSU 文件:https://github.com/lovasoa/marshmallow_dataclasshttps://marshmallow.readthedocs.io/en/stable/quickstart.html

0 个答案:

没有答案