From 8631fd47a1b4c07ad0e57cdd12d3cf9961fb9eb9 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Tue, 24 Sep 2019 16:02:18 +0200 Subject: [PATCH] change datatype property to datainfo - according to SECoP v1.0 - internally the name 'datatype' is kept Change-Id: I0298a45f2db529ced3a07e2e9b344c91cfb7bb88 Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21300 Tested-by: JenkinsCodeReview Reviewed-by: Enrico Faulhaber Reviewed-by: Markus Zolliker --- secop/client/baseclient.py | 2 +- secop/params.py | 4 ++-- test/test_params.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/secop/client/baseclient.py b/secop/client/baseclient.py index fb70d3e..f30cc5d 100644 --- a/secop/client/baseclient.py +++ b/secop/client/baseclient.py @@ -386,7 +386,7 @@ class Client(object): for module, moduleData in self.describing_data['modules'].items(): for aname, adata in moduleData['accessibles'].items(): - datatype = get_datatype(adata['datatype']) + datatype = get_datatype(adata.pop('datainfo')) # *sigh* special handling for 'some' parameters.... if isinstance(datatype, EnumType): datatype._enum.name = aname diff --git a/secop/params.py b/secop/params.py index 24b4571..59424b7 100644 --- a/secop/params.py +++ b/secop/params.py @@ -95,7 +95,7 @@ class Parameter(Accessible): u'description': Property('Description of the Parameter', TextType(), extname=u'description', mandatory=True), u'datatype': Property('Datatype of the Parameter', DataTypeType(), - extname=u'datatype', mandatory=True), + extname=u'datainfo', mandatory=True), u'unit': Property('[legacy] unit of the parameter. This should now be on the datatype!', StringType(), extname=u'unit', default=''), # goodie, should be on the datatype! u'readonly': Property('Is the Parameter readonly? (vs. changeable via SECoP)', BoolType(), @@ -260,7 +260,7 @@ class Command(Accessible): u'optional': Property('[internal] is The comamnd optional to implement? (vs. mandatory', BoolType(), export=False, default=False, settable=False), u'datatype': Property('[internal] datatype of the command, auto generated from \'argument\' and \'result\'', - DataTypeType(), extname=u'datatype', mandatory=True), + DataTypeType(), extname=u'datainfo', mandatory=True), u'argument': Property('Datatype of the argument to the command, or None.', NoneOr(DataTypeType()), export=False, mandatory=True), u'result': Property('Datatype of the result from the command, or None.', diff --git a/test/test_params.py b/test/test_params.py index 47f1c12..93a8347 100644 --- a/test/test_params.py +++ b/test/test_params.py @@ -36,17 +36,17 @@ def test_Command(): assert cmd.ctr assert cmd.argument is None assert cmd.result is None - assert cmd.for_export() == {u'datatype': {'type': 'command'}, + assert cmd.for_export() == {u'datainfo': {'type': 'command'}, u'description': u'do_something'} cmd = Command(u'do_something', argument=IntRange(-9,9), result=IntRange(-1,1)) assert cmd.description assert isinstance(cmd.argument, IntRange) assert isinstance(cmd.result, IntRange) - assert cmd.for_export() == {u'datatype': {'type': 'command', 'argument': {'type': 'int', 'min':-9, 'max':9}, + assert cmd.for_export() == {u'datainfo': {'type': 'command', 'argument': {'type': 'int', 'min':-9, 'max':9}, u'result': {'type': 'int', 'min':-1, 'max':1}}, u'description': u'do_something'} - assert cmd.exportProperties() == {u'datatype': {'type': 'command', 'argument': {'type': 'int', 'max': 9, 'min': -9}, + assert cmd.exportProperties() == {u'datainfo': {'type': 'command', 'argument': {'type': 'int', 'max': 9, 'min': -9}, 'result': {'type': 'int', 'max': 1, 'min': -1}}, u'description': u'do_something'}