class Artifact(EmbeddedDocument): key = StringField(required=True) type = StringField(required=True) mode = StringField(choices=("input", "output"), default="output") uri = StringField() hash = StringField() content_size = LongField() timestamp = LongField() type_data = EmbeddedDocumentField(ArtifactTypeData) display_data = SafeSortedListField(ListField(UnionField((int, float, str))))
def __init__(self, *args, **kwargs): super(ModelLabels, self).__init__(field=UnionField(types=(int, NoneType)), *args, **kwargs)