aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/scripts
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-09-07 14:59:47 -0700
committerEli Schwartz <eschwartz@archlinux.org>2022-11-30 16:23:29 -0500
commit2d349eae8cb6f1f3b61838dca7cc989e9278be28 (patch)
treebc8d6325543e0df74b16941996f07797a746a2f6 /mesonbuild/scripts
parent50f35039e7df321a309ee45db57d37635bf53ce3 (diff)
downloadmeson-2d349eae8cb6f1f3b61838dca7cc989e9278be28.zip
meson-2d349eae8cb6f1f3b61838dca7cc989e9278be28.tar.gz
meson-2d349eae8cb6f1f3b61838dca7cc989e9278be28.tar.bz2
pylint: enable the set_membership plugin
Which adds the `use-set-for-membership` check. It's generally faster in python to use a set with the `in` keyword, because it's a hash check instead of a linear walk, this is especially true with strings, where it's actually O(n^2), one loop over the container, and an inner loop of the strings (as string comparison works by checking that `a[n] == b[n]`, in a loop). Also, I'm tired of complaining about this in reviews, let the tools do it for me :)
Diffstat (limited to 'mesonbuild/scripts')
-rwxr-xr-xmesonbuild/scripts/cmake_run_ctgt.py4
-rw-r--r--mesonbuild/scripts/symbolextractor.py2
-rw-r--r--mesonbuild/scripts/tags.py2
3 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/scripts/cmake_run_ctgt.py b/mesonbuild/scripts/cmake_run_ctgt.py
index dfb70d1..33e07d6 100755
--- a/mesonbuild/scripts/cmake_run_ctgt.py
+++ b/mesonbuild/scripts/cmake_run_ctgt.py
@@ -49,10 +49,10 @@ def run(argsv: T.List[str]) -> int:
capture_file = ''
for j in i:
- if j in ['>', '>>']:
+ if j in {'>', '>>'}:
stdout = subprocess.PIPE
continue
- elif j in ['&>', '&>>']:
+ elif j in {'&>', '&>>'}:
stdout = subprocess.PIPE
stderr = subprocess.STDOUT
continue
diff --git a/mesonbuild/scripts/symbolextractor.py b/mesonbuild/scripts/symbolextractor.py
index 565b467..393e66f 100644
--- a/mesonbuild/scripts/symbolextractor.py
+++ b/mesonbuild/scripts/symbolextractor.py
@@ -118,7 +118,7 @@ def gnu_syms(libfilename: str, outfilename: str) -> None:
# Store the size of symbols pointing to data objects so we relink
# when those change, which is needed because of copy relocations
# https://github.com/mesonbuild/meson/pull/7132#issuecomment-628353702
- if line_split[1].upper() in ('B', 'G', 'D') and len(line_split) >= 4:
+ if line_split[1].upper() in {'B', 'G', 'D'} and len(line_split) >= 4:
entry += [line_split[3]]
result += [' '.join(entry)]
write_if_changed('\n'.join(result) + '\n', outfilename)
diff --git a/mesonbuild/scripts/tags.py b/mesonbuild/scripts/tags.py
index 9098efb..8f1706d 100644
--- a/mesonbuild/scripts/tags.py
+++ b/mesonbuild/scripts/tags.py
@@ -47,7 +47,7 @@ def run(args: T.List[str]) -> int:
tool_name = args[0]
srcdir_name = args[1]
os.chdir(srcdir_name)
- assert tool_name in ['cscope', 'ctags', 'etags']
+ assert tool_name in {'cscope', 'ctags', 'etags'}
res = globals()[tool_name]()
assert isinstance(res, int)
return res