migrated secop_psi drivers to new syntax
- includes all changes up to 'fix inheritance order' from git_mlz
6a32ecf342
Change-Id: Ie3ceee3dbd0a9284b47b1d5b5dbe262eebe8f283
This commit is contained in:
@@ -20,40 +20,38 @@
|
||||
# *****************************************************************************
|
||||
"""Test command arguments"""
|
||||
|
||||
from secop.core import Module, Parameter, Command, FloatRange, StringType, BoolType, TupleOf, StructOf, ArrayOf
|
||||
from secop.core import ArrayOf, BoolType, Command, FloatRange, \
|
||||
Module, Parameter, StringType, StructOf, TupleOf
|
||||
|
||||
|
||||
class TestCmd(Module):
|
||||
|
||||
commands = {
|
||||
'arg':
|
||||
Command('5 args',
|
||||
argument=TupleOf(StringType(), FloatRange(), BoolType(), TupleOf(BoolType()), StructOf(a=StringType())),
|
||||
result=StringType()),
|
||||
'keyed':
|
||||
Command('keyworded arg', argument=StructOf(a=StringType(), b=FloatRange(), c=BoolType(), optional=['b']), result=StringType()),
|
||||
'one':
|
||||
Command('1 arg', argument=FloatRange(), result=StringType()),
|
||||
'none':
|
||||
Command('no arg', result=StringType()),
|
||||
}
|
||||
parameters = {
|
||||
'struct': Parameter('struct', StructOf(a=StringType(), b=FloatRange(), c=BoolType(), optional=['b']),
|
||||
readonly=False, default=dict(a='',c=True)),
|
||||
'array': Parameter('array', ArrayOf(BoolType()),
|
||||
readonly=False, default=[]),
|
||||
'tuple': Parameter('tuple', TupleOf(StringType(), FloatRange(), BoolType(), TupleOf(BoolType()), StructOf(a=StringType())),
|
||||
readonly=False, default=('',0,False,(False,),dict(a=''))),
|
||||
}
|
||||
struct = Parameter('struct', StructOf(a=StringType(), b=FloatRange(), c=BoolType(), optional=['b']),
|
||||
readonly=False, default=dict(a='', c=True))
|
||||
array = Parameter('array', ArrayOf(BoolType()),
|
||||
readonly=False, default=[])
|
||||
tuple = Parameter('tuple', TupleOf(StringType(), FloatRange(), BoolType(),
|
||||
TupleOf(BoolType()), StructOf(a=StringType())),
|
||||
readonly=False, default=('', 0, False, (False,), dict(a='')))
|
||||
|
||||
def do_arg(self, arg):
|
||||
@Command(argument=TupleOf(StringType(), FloatRange(), BoolType(), TupleOf(BoolType()), StructOf(a=StringType())),
|
||||
result=StringType())
|
||||
def arg(self, *arg):
|
||||
"""5 args"""
|
||||
return repr(arg)
|
||||
|
||||
def do_keyed(self, arg):
|
||||
@Command(argument=StructOf(a=StringType(), b=FloatRange(), c=BoolType(), optional=['b']),
|
||||
result=StringType())
|
||||
def keyed(self, **arg):
|
||||
"""keyworded arg"""
|
||||
return repr(arg)
|
||||
|
||||
def do_one(self, arg):
|
||||
@Command(argument=FloatRange(), result=StringType())
|
||||
def one(self, arg):
|
||||
"""1 arg"""
|
||||
return repr(arg)
|
||||
|
||||
def do_none(self):
|
||||
@Command(result=StringType())
|
||||
def none(self):
|
||||
"""no arg"""
|
||||
return repr(None)
|
||||
|
||||
Reference in New Issue
Block a user