fix parameter inheritance
Correct inheritance has to follow the MRO, not only consider the direct base classes. Patchset 3: changed only tests, indicating that we need to change the code Following patchsets include a major change in params.py and modules.py. The parameter properties for inheritance, corresponding mainly to the constructor arguments have to be stored separately from the property values including inherited stuff. Change-Id: Ibcbccb6abcc22e7e2d91df8f70ef64226684d8cc Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/26805 Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch> Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
This commit is contained in:
@ -958,7 +958,7 @@ class CommandType(DataType):
|
||||
argstr = repr(self.argument) if self.argument else ''
|
||||
if self.result is None:
|
||||
return 'CommandType(%s)' % argstr
|
||||
return 'CommandType(%s)->%s' % (argstr, repr(self.result))
|
||||
return 'CommandType(%s, %s)' % (argstr, repr(self.result))
|
||||
|
||||
def __call__(self, value):
|
||||
"""return the validated argument value or raise"""
|
||||
@ -999,7 +999,10 @@ class DataTypeType(DataType):
|
||||
returns the value or raises an appropriate exception"""
|
||||
if isinstance(value, DataType):
|
||||
return value
|
||||
raise ProgrammingError('%r should be a DataType!' % value)
|
||||
try:
|
||||
return get_datatype(value)
|
||||
except Exception as e:
|
||||
raise ProgrammingError(e) from None
|
||||
|
||||
def export_value(self, value):
|
||||
"""if needed, reformat value for transport"""
|
||||
@ -1034,6 +1037,13 @@ class ValueType(DataType):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def setProperty(self, key, value):
|
||||
"""silently ignored
|
||||
|
||||
as ValueType is used for the datatype default, this makes code
|
||||
shorter for cases, where the datatype may not yet be defined
|
||||
"""
|
||||
|
||||
|
||||
class NoneOr(DataType):
|
||||
"""validates a None or smth. else"""
|
||||
|
Reference in New Issue
Block a user