Support Specializing Custom Quantity Types
It seems like it is currently only supported to specialize native python types and not custom ones. I.e. the following works:
from nomad.metainfo import (
Quantity,
)
from nomad.datamodel.data import (
EntryData,
ArchiveSection,
)
class A(ArchiveSection):
a = Quantity(type=str)
class B(A):
a = A.a.m_copy()
a.type = int
class C(EntryData):
c = Quantity(type=A)
But trying to specialize the type of the property c
fails. I.e. adding this:
class D(C):
c = C.c.m_copy()
c.type = B
Will cause the following error message when running the appworker:
nomad.metainfo.metainfo.MetainfoError: Type <class 'hzb_unold_lab.schema.B'> of nomad.metainfo.metainfo.Quantity.type:Quantity is not a valid metainfo quantity type
The test was performed in a plugin called hzb_unold_lab
Not sure if it is relevant but VScode also doesn't seem to pick up the m_copy()
method for Quantity
like it does for SubSection
.