from __future__ import absolute_import
VARIABLETYPE = ["None", "Static", "Session", "Alarm"]
opt_parser = re.compile(r'(\w+)\s*(?:=\s*"([^"]+)"\s*|=([^\s]+)\s*)?')
variable_type_selection = 0,
options = VARIABLETYPE[opts.variable_type_selection]
if opts.min is not None or opts.max is not None:
options += ' min=' + str(opts.min if opts.min is not None else 0)
options += ' max=' + str(opts.max if opts.min is not None else 0)
options += ' precision=' + str(opts.precision)
options += ' disable=True'
for name in ['subgroup', 'unit', 'other', 'tags']:
quoting = '"' if ' ' in content else ''
options += ' ' + name + '=' + quoting + content + quoting
options = re.findall(opt_parser,opts)
for key,dblquote_value,smpl_value in options:
value = dblquote_value+smpl_value
elif key in VARIABLETYPE[1:]:
res.variable_type_selection = VARIABLETYPE.index(key)
if key in ["precision", "min","max"]:
raise Exception("Unknown key in options")