make entangle mapping a dict
Change-Id: I38d863a907469674001f0721140f88c17b53635b Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/30911 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Alexander Zaft <a.zaft@fz-juelich.de>
This commit is contained in:
@ -23,8 +23,9 @@
|
||||
|
||||
import random
|
||||
|
||||
from frappy.datatypes import FloatRange, StringType
|
||||
from frappy.modules import Communicator, Drivable, Parameter, Readable
|
||||
from frappy.datatypes import FloatRange, StringType, ValueType
|
||||
from frappy.modules import Communicator, Drivable, Parameter, Property, \
|
||||
Readable
|
||||
from frappy.params import Command
|
||||
|
||||
|
||||
@ -93,3 +94,10 @@ class Lower(Communicator):
|
||||
def communicate(self, command):
|
||||
"""lowercase a string"""
|
||||
return str(command).lower()
|
||||
|
||||
class Mapped(Readable):
|
||||
value = Parameter(datatype=StringType())
|
||||
choices = Property('List of choices',
|
||||
datatype=ValueType(list))
|
||||
def read_value(self):
|
||||
return self.choices[random.randrange(len(self.choices))]
|
||||
|
Reference in New Issue
Block a user