- 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:
parent
0f405272e5
commit
fc948972cc
@ -54,7 +54,6 @@ except ImportError:
|
|||||||
|
|
||||||
from secop.lib import formatExtendedStack, mkthread, unset_value
|
from secop.lib import formatExtendedStack, mkthread, unset_value
|
||||||
from secop.lib.enum import Enum
|
from secop.lib.enum import Enum
|
||||||
from secop.lib.parsing import format_time
|
|
||||||
from secop.errors import ConfigError, ProgrammingError
|
from secop.errors import ConfigError, ProgrammingError
|
||||||
from secop.datatypes import DataType, EnumType, TupleOf, StringType, FloatRange, get_datatype
|
from secop.datatypes import DataType, EnumType, TupleOf, StringType, FloatRange, get_datatype
|
||||||
|
|
||||||
@ -119,7 +118,7 @@ class Param(object):
|
|||||||
# return a copy of ourselfs
|
# return a copy of ourselfs
|
||||||
return Param(**self.__dict__)
|
return Param(**self.__dict__)
|
||||||
|
|
||||||
def as_dict(self, static_only=False):
|
def as_dict(self):
|
||||||
# used for serialisation only
|
# used for serialisation only
|
||||||
res = dict(
|
res = dict(
|
||||||
description=self.description,
|
description=self.description,
|
||||||
@ -130,10 +129,6 @@ class Param(object):
|
|||||||
res['unit'] = self.unit
|
res['unit'] = self.unit
|
||||||
if self.group:
|
if self.group:
|
||||||
res['group'] = 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
|
return res
|
||||||
|
|
||||||
def export_value(self):
|
def export_value(self):
|
||||||
|
@ -150,14 +150,14 @@ class Dispatcher(object):
|
|||||||
# return a copy of our list
|
# return a copy of our list
|
||||||
return self._export[:]
|
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)
|
self.log.debug(u'list_module_params(%r)' % modulename)
|
||||||
if modulename in self._export:
|
if modulename in self._export:
|
||||||
# omit export=False params!
|
# omit export=False params!
|
||||||
res = {}
|
res = {}
|
||||||
for paramname, param in list(self.get_module(modulename).parameters.items()):
|
for paramname, param in list(self.get_module(modulename).parameters.items()):
|
||||||
if param.export:
|
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' %
|
self.log.debug(u'list params for module %s -> %r' %
|
||||||
(modulename, res))
|
(modulename, res))
|
||||||
return res
|
return res
|
||||||
@ -186,7 +186,7 @@ class Dispatcher(object):
|
|||||||
# some of these need rework !
|
# some of these need rework !
|
||||||
mod_desc = {u'parameters': [], u'commands': []}
|
mod_desc = {u'parameters': [], u'commands': []}
|
||||||
for pname, param in list(self.list_module_params(
|
for pname, param in list(self.list_module_params(
|
||||||
modulename, only_static=True).items()):
|
modulename).items()):
|
||||||
mod_desc[u'parameters'].extend([pname, param])
|
mod_desc[u'parameters'].extend([pname, param])
|
||||||
for cname, cmd in list(self.list_module_cmds(modulename).items()):
|
for cname, cmd in list(self.list_module_cmds(modulename).items()):
|
||||||
mod_desc[u'commands'].extend([cname, cmd])
|
mod_desc[u'commands'].extend([cname, cmd])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user