aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/ast
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-08-31 09:55:01 -0700
committerEli Schwartz <eschwartz93@gmail.com>2021-08-31 16:28:54 -0400
commit4d7031437c7a81b52c776d4ae1e32741bdb851ca (patch)
tree7716c4af0d3f43b450a7c94dd42ae5dbef8ebdff /mesonbuild/ast
parent06fdb29daace9ebe55e5df5336f65cba304773d2 (diff)
downloadmeson-4d7031437c7a81b52c776d4ae1e32741bdb851ca.zip
meson-4d7031437c7a81b52c776d4ae1e32741bdb851ca.tar.gz
meson-4d7031437c7a81b52c776d4ae1e32741bdb851ca.tar.bz2
pylint: turn on superflous-parens
We have a lot of these. Some of them are harmless, if unidiomatic, such as `if (condition)`, others are potentially dangerous `assert(...)`, as `assert(condtion)` works as expected, but `assert(condition, message)` will result in an assertion that never triggers, as what you're actually asserting is `bool(tuple[2])`, which will always be true.
Diffstat (limited to 'mesonbuild/ast')
-rw-r--r--mesonbuild/ast/interpreter.py12
-rw-r--r--mesonbuild/ast/introspection.py2
2 files changed, 7 insertions, 7 deletions
diff --git a/mesonbuild/ast/interpreter.py b/mesonbuild/ast/interpreter.py
index 0299014..8c2be37 100644
--- a/mesonbuild/ast/interpreter.py
+++ b/mesonbuild/ast/interpreter.py
@@ -182,7 +182,7 @@ class AstInterpreter(InterpreterBase):
return
with open(absname, encoding='utf-8') as f:
code = f.read()
- assert(isinstance(code, str))
+ assert isinstance(code, str)
try:
codeblock = mparser.Parser(code, absname).parse()
except mesonlib.MesonException as me:
@@ -199,7 +199,7 @@ class AstInterpreter(InterpreterBase):
return True
def evaluate_fstring(self, node: mparser.FormatStringNode) -> str:
- assert(isinstance(node, mparser.FormatStringNode))
+ assert isinstance(node, mparser.FormatStringNode)
return node.value
def evaluate_arithmeticstatement(self, cur: ArithmeticNode) -> int:
@@ -212,7 +212,7 @@ class AstInterpreter(InterpreterBase):
return 0
def evaluate_ternary(self, node: TernaryNode) -> None:
- assert(isinstance(node, TernaryNode))
+ assert isinstance(node, TernaryNode)
self.evaluate_statement(node.condition)
self.evaluate_statement(node.trueblock)
self.evaluate_statement(node.falseblock)
@@ -223,7 +223,7 @@ class AstInterpreter(InterpreterBase):
return node.value
return '__AST_UNKNOWN__'
arguments, kwargs = self.reduce_arguments(node.args, key_resolver=resolve_key)
- assert (not arguments)
+ assert not arguments
self.argument_depth += 1
for key, value in kwargs.items():
if isinstance(key, BaseNode):
@@ -232,7 +232,7 @@ class AstInterpreter(InterpreterBase):
return {}
def evaluate_plusassign(self, node: PlusAssignmentNode) -> None:
- assert(isinstance(node, PlusAssignmentNode))
+ assert isinstance(node, PlusAssignmentNode)
# Cheat by doing a reassignment
self.assignments[node.var_name] = node.value # Save a reference to the value node
if node.value.ast_id:
@@ -298,7 +298,7 @@ class AstInterpreter(InterpreterBase):
return 0
def assignment(self, node: AssignmentNode) -> None:
- assert(isinstance(node, AssignmentNode))
+ assert isinstance(node, AssignmentNode)
self.assignments[node.var_name] = node.value # Save a reference to the value node
if node.value.ast_id:
self.reverse_assignment[node.value.ast_id] = node
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py
index 42813db..9bd73d7 100644
--- a/mesonbuild/ast/introspection.py
+++ b/mesonbuild/ast/introspection.py
@@ -211,7 +211,7 @@ class IntrospectionInterpreter(AstInterpreter):
while inqueue:
curr = inqueue.pop(0)
arg_node = None
- assert(isinstance(curr, BaseNode))
+ assert isinstance(curr, BaseNode)
if isinstance(curr, FunctionNode):
arg_node = curr.args
elif isinstance(curr, ArrayNode):