diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2022-09-07 15:23:42 -0700 |
|---|---|---|
| committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-10-04 00:33:04 -0400 |
| commit | a72840cd2e27bf18b88cf95ef6a9e5e3ab05427d (patch) | |
| tree | c3e6ce969bd01ae144f14213dd591e022c453019 /mesonbuild/modules | |
| parent | f11ebf20ff51dc1e9d6aa07fea64bc891869e48a (diff) | |
| download | meson-a72840cd2e27bf18b88cf95ef6a9e5e3ab05427d.tar.gz | |
pylint: enable use-a-generator
This catches some optimization problems, mostly in the use of `all()`
and `any()`. Basically writing `any([x == 5 for x in f])` vs `any(x == 5
for x in f)` reduces the performance because the entire concrete list
must first be created, then iterated over, while in the second f is
iterated and checked element by element.
Diffstat (limited to 'mesonbuild/modules')
| -rw-r--r-- | mesonbuild/modules/cmake.py | 2 | ||||
| -rw-r--r-- | mesonbuild/modules/gnome.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/modules/cmake.py b/mesonbuild/modules/cmake.py index a46c39959..ee40b442d 100644 --- a/mesonbuild/modules/cmake.py +++ b/mesonbuild/modules/cmake.py @@ -130,7 +130,7 @@ class CMakeSubproject(ModuleObject): ' message(\'CMake targets:\\n - \' + \'\\n - \'.join(<cmake_subproject>.target_list()))') # Make sure that all keys are present (if not this is a bug) - assert all([x in res for x in ['inc', 'src', 'dep', 'tgt', 'func']]) + assert all(x in res for x in ['inc', 'src', 'dep', 'tgt', 'func']) return res @noKwargs diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 4287b133a..0112ab17c 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -1118,7 +1118,7 @@ class GnomeModule(ExtensionModule): def generate_gir(self, state: 'ModuleState', args: T.Tuple[T.List[T.Union[build.Executable, build.SharedLibrary, build.StaticLibrary]]], kwargs: 'GenerateGir') -> ModuleReturnValue: girtargets = [self._unwrap_gir_target(arg, state) for arg in args[0]] - if len(girtargets) > 1 and any([isinstance(el, build.Executable) for el in girtargets]): + if len(girtargets) > 1 and any(isinstance(el, build.Executable) for el in girtargets): raise MesonException('generate_gir only accepts a single argument when one of the arguments is an executable') gir_dep, giscanner, gicompiler = self._get_gir_dep(state) |
