remove irrelevant comments
+ improve error message 'can not convert %r to float' Change-Id: Idf534a4105086463fd238d7c91317424a809d7ba Change-Id: I09260dda8deff1e6ee0af2fa38a42a09884a2061 Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/26345 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
parent
9a60de9c1c
commit
6b610f1e25
@ -194,7 +194,7 @@ class FloatRange(DataType):
|
|||||||
try:
|
try:
|
||||||
value = float(value)
|
value = float(value)
|
||||||
except Exception:
|
except Exception:
|
||||||
raise BadValueError('Can not __call__ %r to float' % value) from None
|
raise BadValueError('Can not convert %r to float' % value) from None
|
||||||
# map +/-infty to +/-max possible number
|
# map +/-infty to +/-max possible number
|
||||||
value = clamp(-sys.float_info.max, value, sys.float_info.max)
|
value = clamp(-sys.float_info.max, value, sys.float_info.max)
|
||||||
|
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
"""Define Simulation classes"""
|
"""Define Simulation classes"""
|
||||||
|
|
||||||
|
|
||||||
# TODO: rework after syntax change!
|
|
||||||
|
|
||||||
import random
|
import random
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
@ -40,8 +38,6 @@ class SimBase:
|
|||||||
extra_params = cfgdict.pop('extra_params', '') or cfgdict.pop('.extra_params', '')
|
extra_params = cfgdict.pop('extra_params', '') or cfgdict.pop('.extra_params', '')
|
||||||
attrs = {}
|
attrs = {}
|
||||||
if extra_params:
|
if extra_params:
|
||||||
# make a copy of self.parameter
|
|
||||||
# self.accessibles = dict((k, v.copy()) for k, v in self.accessibles.items())
|
|
||||||
for k in extra_params.split(','):
|
for k in extra_params.split(','):
|
||||||
k = k.strip()
|
k = k.strip()
|
||||||
attrs[k] = Parameter('extra_param: %s' % k.strip(),
|
attrs[k] = Parameter('extra_param: %s' % k.strip(),
|
||||||
@ -82,14 +78,10 @@ class SimBase:
|
|||||||
|
|
||||||
class SimModule(SimBase, Module):
|
class SimModule(SimBase, Module):
|
||||||
pass
|
pass
|
||||||
# def __init__(self, devname, logger, cfgdict, dispatcher):
|
|
||||||
# SimBase.__init__(self, cfgdict)
|
|
||||||
# Module.__init__(self, devname, logger, cfgdict, dispatcher)
|
|
||||||
|
|
||||||
|
|
||||||
class SimReadable(SimBase, Readable):
|
class SimReadable(SimBase, Readable):
|
||||||
def __init__(self, devname, logger, cfgdict, dispatcher):
|
def __init__(self, devname, logger, cfgdict, dispatcher):
|
||||||
# SimBase.__init__(self, cfgdict)
|
|
||||||
super().__init__(devname, logger, cfgdict, dispatcher)
|
super().__init__(devname, logger, cfgdict, dispatcher)
|
||||||
self._value = self.parameters['value'].default
|
self._value = self.parameters['value'].default
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user