aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/optinterpreter.py
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2016-08-27 08:47:29 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2016-08-27 15:47:29 +0300
commita2321b24f6ce0e7832f18c39d4de69d0236ba145 (patch)
treeb9ff4409172e191cac3f9bcf64184b23382c4d33 /mesonbuild/optinterpreter.py
parent7cd6206d9a8c686440209bee82e27c215dc4ece5 (diff)
downloadmeson-a2321b24f6ce0e7832f18c39d4de69d0236ba145.zip
meson-a2321b24f6ce0e7832f18c39d4de69d0236ba145.tar.gz
meson-a2321b24f6ce0e7832f18c39d4de69d0236ba145.tar.bz2
Flatten isinstance calls. (#715)
That is, isinstance(x, y) or isinstance(x, z) can be flattened with a tuple to isinstance(x, (y, z)).
Diffstat (limited to 'mesonbuild/optinterpreter.py')
-rw-r--r--mesonbuild/optinterpreter.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py
index e38bdb9..b355047 100644
--- a/mesonbuild/optinterpreter.py
+++ b/mesonbuild/optinterpreter.py
@@ -98,14 +98,11 @@ class OptionInterpreter:
def reduce_single(self, arg):
if isinstance(arg, str):
return arg
- elif isinstance(arg, mparser.StringNode):
- return arg.value
- elif isinstance(arg, mparser.BooleanNode):
+ elif isinstance(arg, (mparser.StringNode, mparser.BooleanNode,
+ mparser.NumberNode)):
return arg.value
elif isinstance(arg, mparser.ArrayNode):
return [self.reduce_single(curarg) for curarg in arg.args.arguments]
- elif isinstance(arg, mparser.NumberNode):
- return arg.value
else:
raise OptionException('Arguments may only be string, int, bool, or array of those.')