diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2022-09-07 14:03:41 -0700 |
|---|---|---|
| committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-11-29 23:26:05 -0500 |
| commit | d5e899c76808d45854a06a4ba2b006da32480165 (patch) | |
| tree | eb2f315230d2448edce06fa1a82666d683b2d6bb /mesonbuild/mcompile.py | |
| parent | a5d547e0d9ccb523f0baab7fd32e782aa075fb42 (diff) | |
| download | meson-d5e899c76808d45854a06a4ba2b006da32480165.tar.gz | |
pylint: enable the bad_builtin checker
This finds uses of deny-listed functions, which defaults to map and
filter. These functions should be replaced by comprehensions in
idiomatic python because:
1. comprehensions are more heavily optimized and are often faster
2. They avoid the need for lambdas in some cases, which make them
faster
3. you can do the equivalent in one statement rather than two, which
is faster
4. They're easier to read
5. if you need a concrete instance (ie, a list) then you don't have
to convert the iterator to a list afterwards
Diffstat (limited to 'mesonbuild/mcompile.py')
| -rw-r--r-- | mesonbuild/mcompile.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/mesonbuild/mcompile.py b/mesonbuild/mcompile.py index 2e6829c2d..27ef46ce0 100644 --- a/mesonbuild/mcompile.py +++ b/mesonbuild/mcompile.py @@ -190,11 +190,9 @@ def get_parsed_args_vs(options: 'argparse.Namespace', builddir: Path) -> T.Tuple if options.targets: intro_data = parse_introspect_data(builddir) - has_run_target = any(map( - lambda t: - get_target_from_intro_data(ParsedTargetName(t), builddir, intro_data)['type'] == 'run', - options.targets - )) + has_run_target = any( + get_target_from_intro_data(ParsedTargetName(t), builddir, intro_data)['type'] == 'run' + for t in options.targets) if has_run_target: # `run` target can't be used the same way as other targets on `vs` backend. |
