From 2d349eae8cb6f1f3b61838dca7cc989e9278be28 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 7 Sep 2022 14:59:47 -0700 Subject: 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 :) --- mesonbuild/compilers/java.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mesonbuild/compilers/java.py') diff --git a/mesonbuild/compilers/java.py b/mesonbuild/compilers/java.py index bfd9b1aa3..ebae5091f 100644 --- a/mesonbuild/compilers/java.py +++ b/mesonbuild/compilers/java.py @@ -75,7 +75,7 @@ class JavaCompiler(BasicLinkerIsCompilerMixin, Compiler): def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]: for idx, i in enumerate(parameter_list): - if i in ['-cp', '-classpath', '-sourcepath'] and idx + 1 < len(parameter_list): + if i in {'-cp', '-classpath', '-sourcepath'} and idx + 1 < len(parameter_list): path_list = parameter_list[idx + 1].split(os.pathsep) path_list = [os.path.normpath(os.path.join(build_dir, x)) for x in path_list] parameter_list[idx + 1] = os.pathsep.join(path_list) -- cgit v1.2.3