diff --git a/frappy_psi/sea.py b/frappy_psi/sea.py index 2d98f92..0fc78e0 100644 --- a/frappy_psi/sea.py +++ b/frappy_psi/sea.py @@ -383,6 +383,19 @@ SEA_TO_SECOPTYPE = { } +class SeaEnum(EnumType): + """some sea enum nodes have text type -> accept '' also""" + def copy(self): + return SeaEnum(self._enum) + + def __call__(self, value): + try: + value = int(value) + except TypeError: + pass + return super().__call__(value) + + def get_datatype(paramdesc): typ = paramdesc['type'] result = SEA_TO_SECOPTYPE.get(typ, False) @@ -390,7 +403,7 @@ def get_datatype(paramdesc): return result # special cases if typ == 'enum': - return EnumType(paramdesc['enum']) + return SeaEnum(paramdesc['enum']) raise ValueError('unknown SEA type %r' % typ)