diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-08-31 09:55:01 -0700 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2021-08-31 16:28:54 -0400 |
commit | 4d7031437c7a81b52c776d4ae1e32741bdb851ca (patch) | |
tree | 7716c4af0d3f43b450a7c94dd42ae5dbef8ebdff /mesonbuild/rewriter.py | |
parent | 06fdb29daace9ebe55e5df5336f65cba304773d2 (diff) | |
download | meson-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/rewriter.py')
-rw-r--r-- | mesonbuild/rewriter.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mesonbuild/rewriter.py b/mesonbuild/rewriter.py index d95b539..67cd871 100644 --- a/mesonbuild/rewriter.py +++ b/mesonbuild/rewriter.py @@ -698,7 +698,7 @@ class Rewriter: arg_node = root.args elif isinstance(root, ArgumentNode): arg_node = root - assert(arg_node is not None) + assert arg_node is not None mlog.log(' -- Removing source', mlog.green(i), 'from', mlog.yellow(f'{string_node.filename}:{string_node.lineno}')) arg_node.arguments.remove(string_node) @@ -782,10 +782,10 @@ class Rewriter: self.functions[cmd['type']](cmd) def apply_changes(self): - assert(all(hasattr(x, 'lineno') and hasattr(x, 'colno') and hasattr(x, 'filename') for x in self.modified_nodes)) - assert(all(hasattr(x, 'lineno') and hasattr(x, 'colno') and hasattr(x, 'filename') for x in self.to_remove_nodes)) - assert(all(isinstance(x, (ArrayNode, FunctionNode)) for x in self.modified_nodes)) - assert(all(isinstance(x, (ArrayNode, AssignmentNode, FunctionNode)) for x in self.to_remove_nodes)) + assert all(hasattr(x, 'lineno') and hasattr(x, 'colno') and hasattr(x, 'filename') for x in self.modified_nodes) + assert all(hasattr(x, 'lineno') and hasattr(x, 'colno') and hasattr(x, 'filename') for x in self.to_remove_nodes) + assert all(isinstance(x, (ArrayNode, FunctionNode)) for x in self.modified_nodes) + assert all(isinstance(x, (ArrayNode, AssignmentNode, FunctionNode)) for x in self.to_remove_nodes) # Sort based on line and column in reversed order work_nodes = [{'node': x, 'action': 'modify'} for x in self.modified_nodes] work_nodes += [{'node': x, 'action': 'rm'} for x in self.to_remove_nodes] |