pylint: enable consider-using-in

pull/10783/head
Dylan Baker 2 years ago committed by Eli Schwartz
parent 6f7ea0cc28
commit 4da14918cd
  1. 1
      .pylintrc
  2. 2
      mesonbuild/backend/backends.py
  3. 2
      mesonbuild/backend/ninjabackend.py
  4. 8
      mesonbuild/backend/vs2010backend.py
  5. 2
      mesonbuild/cmake/traceparser.py
  6. 2
      mesonbuild/compilers/cpp.py
  7. 2
      mesonbuild/depfile.py
  8. 2
      mesonbuild/environment.py
  9. 2
      mesonbuild/mintro.py
  10. 2
      mesonbuild/mparser.py
  11. 2
      mesonbuild/rewriter.py

@ -14,7 +14,6 @@ disable=
cell-var-from-loop, cell-var-from-loop,
consider-merging-isinstance, consider-merging-isinstance,
consider-using-f-string, consider-using-f-string,
consider-using-in,
consider-using-max-builtin, consider-using-max-builtin,
consider-using-min-builtin, consider-using-min-builtin,
consider-using-with, consider-using-with,

@ -1550,7 +1550,7 @@ class Backend:
outdirs, install_dir_names, custom_install_dir = t.get_install_dir() outdirs, install_dir_names, custom_install_dir = t.get_install_dir()
# Sanity-check the outputs and install_dirs # Sanity-check the outputs and install_dirs
num_outdirs, num_out = len(outdirs), len(t.get_outputs()) 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' \ 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" \ "Pass 'false' for outputs that should not be installed and 'true' for\n" \
'using the default installation directory for an output.' 'using the default installation directory for an output.'

@ -2331,7 +2331,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
deps=deps, depfile=depfile)) deps=deps, depfile=depfile))
def generate_pch_rule_for(self, langname, compiler): def generate_pch_rule_for(self, langname, compiler):
if langname != 'c' and langname != 'cpp': if langname not in {'c', 'cpp'}:
return return
rule = self.compiler_to_pch_rule_name(compiler) rule = self.compiler_to_pch_rule_name(compiler)
depargs = compiler.get_dependency_gen_args('$out', '$DEPFILE') depargs = compiler.get_dependency_gen_args('$out', '$DEPFILE')

@ -180,13 +180,13 @@ class Vs2010Backend(backends.Backend):
def generate(self): def generate(self):
target_machine = self.interpreter.builtin['target_machine'].cpu_family_method(None, None) 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 # amd64 or x86_64
self.platform = 'x64' self.platform = 'x64'
elif target_machine == 'x86': elif target_machine == 'x86':
# x86 # x86
self.platform = 'Win32' 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) target_cpu = self.interpreter.builtin['target_machine'].cpu_method(None, None)
if target_cpu == 'arm64ec': if target_cpu == 'arm64ec':
self.platform = 'arm64ec' self.platform = 'arm64ec'
@ -198,13 +198,13 @@ class Vs2010Backend(backends.Backend):
raise MesonException('Unsupported Visual Studio platform: ' + target_machine) raise MesonException('Unsupported Visual Studio platform: ' + target_machine)
build_machine = self.interpreter.builtin['build_machine'].cpu_family_method(None, None) 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 # amd64 or x86_64
self.build_platform = 'x64' self.build_platform = 'x64'
elif build_machine == 'x86': elif build_machine == 'x86':
# x86 # x86
self.build_platform = 'Win32' 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) target_cpu = self.interpreter.builtin['build_machine'].cpu_method(None, None)
if target_cpu == 'arm64ec': if target_cpu == 'arm64ec':
self.build_platform = 'arm64ec' self.build_platform = 'arm64ec'

@ -498,7 +498,7 @@ class CMakeTraceParser:
curr = args.pop(0) curr = args.pop(0)
# XXX: APPEND_STRING is specifically *not* supposed to create a # XXX: APPEND_STRING is specifically *not* supposed to create a
# list, is treating them as aliases really okay? # list, is treating them as aliases really okay?
if curr == 'APPEND' or curr == 'APPEND_STRING': if curr in {'APPEND', 'APPEND_STRING'}:
append = True append = True
continue continue

@ -57,7 +57,7 @@ else:
def non_msvc_eh_options(eh: str, args: T.List[str]) -> None: def non_msvc_eh_options(eh: str, args: T.List[str]) -> None:
if eh == 'none': if eh == 'none':
args.append('-fno-exceptions') 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.' + mlog.warning('non-MSVC compilers do not support ' + eh + ' exception handling.' +
'You may want to set eh to \'default\'.') 'You may want to set eh to \'default\'.')

@ -33,7 +33,7 @@ def parse(lines: T.Iterable[str]) -> T.List[T.Tuple[T.List[str], T.List[str]]]:
out += c out += c
escape = None escape = None
continue continue
if c == '\\' or c == '$': if c in {'\\', '$'}:
escape = c escape = c
continue continue
elif c in (' ', '\n'): elif c in (' ', '\n'):

@ -276,7 +276,7 @@ def detect_windows_arch(compilers: CompilersDict) -> str:
# 32-bit and pretend like we're running under WOW64. Else, return the # 32-bit and pretend like we're running under WOW64. Else, return the
# actual Windows architecture that we deduced above. # actual Windows architecture that we deduced above.
for compiler in compilers.values(): 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' return 'x86'
if compiler.id == 'clang-cl' and compiler.target == 'x86': if compiler.id == 'clang-cl' and compiler.target == 'x86':
return 'x86' return 'x86'

@ -323,7 +323,7 @@ def find_buildsystem_files_list(src_dir: str) -> T.List[str]:
filelist = [] # type: T.List[str] filelist = [] # type: T.List[str]
for root, _, files in os.walk(src_dir): for root, _, files in os.walk(src_dir):
for f in files: 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)) filelist.append(os.path.relpath(os.path.join(root, f), src_dir))
return filelist return filelist

@ -175,7 +175,7 @@ class Lexer:
span_end = loc span_end = loc
bytespan = (span_start, span_end) bytespan = (span_start, span_end)
match_text = mo.group() match_text = mo.group()
if tid == 'ignore' or tid == 'comment': if tid in {'ignore', 'comment'}:
break break
elif tid == 'lparen': elif tid == 'lparen':
par_count += 1 par_count += 1

@ -399,7 +399,7 @@ class Rewriter:
def check_list(name: str) -> T.List[BaseNode]: def check_list(name: str) -> T.List[BaseNode]:
result = [] result = []
for i in self.interpreter.targets: for i in self.interpreter.targets:
if name == i['name'] or name == i['id']: if name in {i['name'], i['id']}:
result += [i] result += [i]
return result return result

Loading…
Cancel
Save