make arguments of Parameter and Override consistent
- allow (description and) datatype being positional args in Override - disallow ctr and unit being a positional arg in Parameter - disallow reorder being a positional arg in Override Change-Id: Ic5711d091af11d5843943b0b2b31567127f8ed8c Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/24934 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
parent
05fec236da
commit
24cffad4df
@ -118,7 +118,7 @@ class Parameter(Accessible):
|
|||||||
NoneOr(BoolType()), export=False, default=None, mandatory=False, settable=False),
|
NoneOr(BoolType()), export=False, default=None, mandatory=False, settable=False),
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, description, datatype, ctr=None, unit=None, **kwds):
|
def __init__(self, description, datatype, *, ctr=None, unit=None, **kwds):
|
||||||
|
|
||||||
if not isinstance(datatype, DataType):
|
if not isinstance(datatype, DataType):
|
||||||
if issubclass(datatype, DataType):
|
if issubclass(datatype, DataType):
|
||||||
@ -221,11 +221,13 @@ class Override:
|
|||||||
note: overrides are applied by the metaclass during class creating
|
note: overrides are applied by the metaclass during class creating
|
||||||
reorder= True: use position of Override instead of inherited for the order
|
reorder= True: use position of Override instead of inherited for the order
|
||||||
"""
|
"""
|
||||||
def __init__(self, description="", reorder=False, **kwds):
|
def __init__(self, description="", datatype=None, *, reorder=False, **kwds):
|
||||||
self.kwds = kwds
|
self.kwds = kwds
|
||||||
# allow to override description without keyword
|
# allow to override description and datatype without keyword
|
||||||
if description:
|
if description:
|
||||||
self.kwds['description'] = description
|
self.kwds['description'] = description
|
||||||
|
if datatype is not None:
|
||||||
|
self.kwds['datatype'] = datatype
|
||||||
if reorder: # result from apply must use new ctr from Override
|
if reorder: # result from apply must use new ctr from Override
|
||||||
self.kwds['ctr'] = next(object_counter)
|
self.kwds['ctr'] = next(object_counter)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user