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/cmake | |
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/cmake')
-rw-r--r-- | mesonbuild/cmake/fileapi.py | 10 | ||||
-rw-r--r-- | mesonbuild/cmake/interpreter.py | 10 | ||||
-rw-r--r-- | mesonbuild/cmake/traceparser.py | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/mesonbuild/cmake/fileapi.py b/mesonbuild/cmake/fileapi.py index 5d4d01a..710e4ed 100644 --- a/mesonbuild/cmake/fileapi.py +++ b/mesonbuild/cmake/fileapi.py @@ -80,15 +80,15 @@ class CMakeFileAPI: # parse the JSON for i in index['objects']: - assert(isinstance(i, dict)) - assert('kind' in i) - assert(i['kind'] in self.kind_resolver_map) + assert isinstance(i, dict) + assert 'kind' in i + assert i['kind'] in self.kind_resolver_map self.kind_resolver_map[i['kind']](i) def _parse_codemodel(self, data: T.Dict[str, T.Any]) -> None: - assert('configurations' in data) - assert('paths' in data) + assert 'configurations' in data + assert 'paths' in data source_dir = data['paths']['source'] build_dir = data['paths']['build'] diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py index fe66bec..aca8769 100644 --- a/mesonbuild/cmake/interpreter.py +++ b/mesonbuild/cmake/interpreter.py @@ -736,7 +736,7 @@ class ConverterCustomTarget: # Check if the command is a build target commands = [] # type: T.List[T.List[T.Union[str, ConverterTarget]]] for curr_cmd in self._raw_target.command: - assert(isinstance(curr_cmd, list)) + assert isinstance(curr_cmd, list) cmd = [] # type: T.List[T.Union[str, ConverterTarget]] for j in curr_cmd: @@ -1139,7 +1139,7 @@ class CMakeInterpreter: tgt_name = tgt.name elif isinstance(tgt, CustomTargetReference): tgt_name = tgt.ctgt.name - assert(tgt_name is not None and tgt_name in processed) + assert tgt_name is not None and tgt_name in processed res_var = processed[tgt_name]['tgt'] return id_node(res_var) if res_var else None @@ -1167,12 +1167,12 @@ class CMakeInterpreter: custom_targets = [] # type: T.List[ConverterCustomTarget] dependencies = [] # type: T.List[IdNode] for i in tgt.link_with: - assert(isinstance(i, ConverterTarget)) + assert isinstance(i, ConverterTarget) if i.name not in processed: process_target(i) link_with += [extract_tgt(i)] for i in tgt.object_libs: - assert(isinstance(i, ConverterTarget)) + assert isinstance(i, ConverterTarget) if i.name not in processed: process_target(i) objec_libs += [extract_tgt(i)] @@ -1361,7 +1361,7 @@ class CMakeInterpreter: # check if there exists a name mapping if target in self.internal_name_map: target = self.internal_name_map[target] - assert(target in self.generated_targets) + assert target in self.generated_targets return self.generated_targets[target] return None diff --git a/mesonbuild/cmake/traceparser.py b/mesonbuild/cmake/traceparser.py index 4ddc915..66dd4ef 100644 --- a/mesonbuild/cmake/traceparser.py +++ b/mesonbuild/cmake/traceparser.py @@ -180,7 +180,7 @@ class CMakeTraceParser: # "Execute" the CMake function if supported fn = self.functions.get(l.func, None) - if(fn): + if fn: fn(l) # Postprocess @@ -638,7 +638,7 @@ class CMakeTraceParser: def _meson_ps_execute_delayed_calls(self, tline: CMakeTraceLine) -> None: for l in self.stored_commands: fn = self.functions.get(l.func, None) - if(fn): + if fn: fn(l) # clear the stored commands |