Skip to content

Commit

Permalink
pylint: enable consider-using-in
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbaker authored and eli-schwartz committed Sep 20, 2022
1 parent 6f7ea0c commit 4da1491
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ disable=
cell-var-from-loop,
consider-merging-isinstance,
consider-using-f-string,
consider-using-in,
consider-using-max-builtin,
consider-using-min-builtin,
consider-using-with,
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/backend/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -1550,7 +1550,7 @@ def generate_target_install(self, d: InstallData) -> None:
outdirs, install_dir_names, custom_install_dir = t.get_install_dir()
# Sanity-check the outputs and install_dirs
num_outdirs, num_out = len(outdirs), len(t.get_outputs())
if num_outdirs != 1 and num_outdirs != num_out:
if num_outdirs not in {1, num_out}:
m = 'Target {!r} has {} outputs: {!r}, but only {} "install_dir"s were found.\n' \
"Pass 'false' for outputs that should not be installed and 'true' for\n" \
'using the default installation directory for an output.'
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -2331,7 +2331,7 @@ def generate_compile_rule_for(self, langname, compiler):
deps=deps, depfile=depfile))

def generate_pch_rule_for(self, langname, compiler):
if langname != 'c' and langname != 'cpp':
if langname not in {'c', 'cpp'}:
return
rule = self.compiler_to_pch_rule_name(compiler)
depargs = compiler.get_dependency_gen_args('$out', '$DEPFILE')
Expand Down
8 changes: 4 additions & 4 deletions mesonbuild/backend/vs2010backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ def generate_custom_generator_commands(self, target, parent_node):

def generate(self):
target_machine = self.interpreter.builtin['target_machine'].cpu_family_method(None, None)
if target_machine == '64' or target_machine == 'x86_64':
if target_machine in {'64', 'x86_64'}:
# amd64 or x86_64
self.platform = 'x64'
elif target_machine == 'x86':
# x86
self.platform = 'Win32'
elif target_machine == 'aarch64' or target_machine == 'arm64':
elif target_machine in {'aarch64', 'arm64'}:
target_cpu = self.interpreter.builtin['target_machine'].cpu_method(None, None)
if target_cpu == 'arm64ec':
self.platform = 'arm64ec'
Expand All @@ -198,13 +198,13 @@ def generate(self):
raise MesonException('Unsupported Visual Studio platform: ' + target_machine)

build_machine = self.interpreter.builtin['build_machine'].cpu_family_method(None, None)
if build_machine == '64' or build_machine == 'x86_64':
if build_machine in {'64', 'x86_64'}:
# amd64 or x86_64
self.build_platform = 'x64'
elif build_machine == 'x86':
# x86
self.build_platform = 'Win32'
elif build_machine == 'aarch64' or build_machine == 'arm64':
elif build_machine in {'aarch64', 'arm64'}:
target_cpu = self.interpreter.builtin['build_machine'].cpu_method(None, None)
if target_cpu == 'arm64ec':
self.build_platform = 'arm64ec'
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/cmake/traceparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def _cmake_set_property(self, tline: CMakeTraceLine) -> None:
curr = args.pop(0)
# XXX: APPEND_STRING is specifically *not* supposed to create a
# list, is treating them as aliases really okay?
if curr == 'APPEND' or curr == 'APPEND_STRING':
if curr in {'APPEND', 'APPEND_STRING'}:
append = True
continue

Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/compilers/cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
def non_msvc_eh_options(eh: str, args: T.List[str]) -> None:
if eh == 'none':
args.append('-fno-exceptions')
elif eh == 's' or eh == 'c':
elif eh in {'s', 'c'}:
mlog.warning('non-MSVC compilers do not support ' + eh + ' exception handling.' +
'You may want to set eh to \'default\'.')

Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/depfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def parse(lines: T.Iterable[str]) -> T.List[T.Tuple[T.List[str], T.List[str]]]:
out += c
escape = None
continue
if c == '\\' or c == '$':
if c in {'\\', '$'}:
escape = c
continue
elif c in (' ', '\n'):
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def detect_windows_arch(compilers: CompilersDict) -> str:
# 32-bit and pretend like we're running under WOW64. Else, return the
# actual Windows architecture that we deduced above.
for compiler in compilers.values():
if compiler.id == 'msvc' and (compiler.target == 'x86' or compiler.target == '80x86'):
if compiler.id == 'msvc' and (compiler.target in {'x86', '80x86'}):
return 'x86'
if compiler.id == 'clang-cl' and compiler.target == 'x86':
return 'x86'
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/mintro.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def find_buildsystem_files_list(src_dir: str) -> T.List[str]:
filelist = [] # type: T.List[str]
for root, _, files in os.walk(src_dir):
for f in files:
if f == 'meson.build' or f == 'meson_options.txt':
if f in {'meson.build', 'meson_options.txt'}:
filelist.append(os.path.relpath(os.path.join(root, f), src_dir))
return filelist

Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/mparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def lex(self, filename: str) -> T.Generator[Token, None, None]:
span_end = loc
bytespan = (span_start, span_end)
match_text = mo.group()
if tid == 'ignore' or tid == 'comment':
if tid in {'ignore', 'comment'}:
break
elif tid == 'lparen':
par_count += 1
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/rewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def find_target(self, target: str):
def check_list(name: str) -> T.List[BaseNode]:
result = []
for i in self.interpreter.targets:
if name == i['name'] or name == i['id']:
if name in {i['name'], i['id']}:
result += [i]
return result

Expand Down

0 comments on commit 4da1491

Please sign in to comment.