- remove obsolete option static_only of Param.as_dict

- remove obsolete import of format_time
- fix commit message

Change-Id: Ie3a03694c5a40a0f3b86b2902a435131fd75e051
Reviewed-on: https://forge.frm2.tum.de/review/18191
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
zolliker 2018-06-19 09:47:04 +02:00
parent 0f405272e5
commit fc948972cc
2 changed files with 4 additions and 9 deletions

View File

@ -54,7 +54,6 @@ except ImportError:
from secop.lib import formatExtendedStack, mkthread, unset_value
from secop.lib.enum import Enum
from secop.lib.parsing import format_time
from secop.errors import ConfigError, ProgrammingError
from secop.datatypes import DataType, EnumType, TupleOf, StringType, FloatRange, get_datatype
@ -119,7 +118,7 @@ class Param(object):
# return a copy of ourselfs
return Param(**self.__dict__)
def as_dict(self, static_only=False):
def as_dict(self):
# used for serialisation only
res = dict(
description=self.description,
@ -130,10 +129,6 @@ class Param(object):
res['unit'] = self.unit
if self.group:
res['group'] = self.group
if not static_only:
res['value'] = self.value
if self.timestamp:
res['timestamp'] = format_time(self.timestamp)
return res
def export_value(self):

View File

@ -150,14 +150,14 @@ class Dispatcher(object):
# return a copy of our list
return self._export[:]
def list_module_params(self, modulename, only_static=False):
def list_module_params(self, modulename):
self.log.debug(u'list_module_params(%r)' % modulename)
if modulename in self._export:
# omit export=False params!
res = {}
for paramname, param in list(self.get_module(modulename).parameters.items()):
if param.export:
res[paramname] = param.as_dict(only_static)
res[paramname] = param.as_dict()
self.log.debug(u'list params for module %s -> %r' %
(modulename, res))
return res
@ -186,7 +186,7 @@ class Dispatcher(object):
# some of these need rework !
mod_desc = {u'parameters': [], u'commands': []}
for pname, param in list(self.list_module_params(
modulename, only_static=True).items()):
modulename).items()):
mod_desc[u'parameters'].extend([pname, param])
for cname, cmd in list(self.list_module_cmds(modulename).items()):
mod_desc[u'commands'].extend([cname, cmd])