forked from M-Labs/artiq
1
0
Fork 0

language/environment: BooleanValue: fix type detection

Signed-off-by: Etienne Wodey <wodey@iqo.uni-hannover.de>
This commit is contained in:
Etienne Wodey 2020-04-03 18:19:46 +02:00 committed by Sébastien Bourdeauducq
parent 9b03a365ed
commit 90d08988b2
1 changed files with 2 additions and 6 deletions

View File

@ -54,7 +54,6 @@ class PYONValue(_SimpleArgProcessor):
def __init__(self, default=NoDefault): def __init__(self, default=NoDefault):
# Override the _SimpleArgProcessor init, as list defaults are valid # Override the _SimpleArgProcessor init, as list defaults are valid
# PYON values # PYON values
# default stays decoded
if default is not NoDefault: if default is not NoDefault:
self.default_value = default self.default_value = default
@ -71,12 +70,9 @@ class PYONValue(_SimpleArgProcessor):
class BooleanValue(_SimpleArgProcessor): class BooleanValue(_SimpleArgProcessor):
"""A boolean argument.""" """A boolean argument."""
def process(self, x): def process(self, x):
if x is True: if type(x) != bool:
return True
elif x is False:
return False
else:
raise ValueError("Invalid BooleanValue value") raise ValueError("Invalid BooleanValue value")
return x
class EnumerationValue(_SimpleArgProcessor): class EnumerationValue(_SimpleArgProcessor):