summaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
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/build.py
parent50f35039e7df321a309ee45db57d37635bf53ce3 (diff)
downloadmeson-2d349eae8cb6f1f3b61838dca7cc989e9278be28.tar.gz
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/build.py')
-rw-r--r--mesonbuild/build.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 426ee26de..0ef512270 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1829,8 +1829,8 @@ class Executable(BuildTarget):
self.suffix = 'abs'
elif ('c' in self.compilers and self.compilers['c'].get_id().startswith('xc16')):
self.suffix = 'elf'
- elif ('c' in self.compilers and self.compilers['c'].get_id() in ('ti', 'c2000') or
- 'cpp' in self.compilers and self.compilers['cpp'].get_id() in ('ti', 'c2000')):
+ elif ('c' in self.compilers and self.compilers['c'].get_id() in {'ti', 'c2000'} or
+ 'cpp' in self.compilers and self.compilers['cpp'].get_id() in {'ti', 'c2000'}):
self.suffix = 'out'
else:
self.suffix = machine.get_exe_suffix()
@@ -2176,10 +2176,10 @@ class SharedLibrary(BuildTarget):
raise InvalidArguments('Shared library darwin_versions: must be X.Y.Z where '
'X, Y, Z are numbers, and Y and Z are optional')
parts = v.split('.')
- if len(parts) in (1, 2, 3) and int(parts[0]) > 65535:
+ if len(parts) in {1, 2, 3} and int(parts[0]) > 65535:
raise InvalidArguments('Shared library darwin_versions: must be X.Y.Z '
'where X is [0, 65535] and Y, Z are optional')
- if len(parts) in (2, 3) and int(parts[1]) > 255:
+ if len(parts) in {2, 3} and int(parts[1]) > 255:
raise InvalidArguments('Shared library darwin_versions: must be X.Y.Z '
'where Y is [0, 255] and Y, Z are optional')
if len(parts) == 3 and int(parts[2]) > 255: