diff options
| author | Eli Schwartz <eschwartz@archlinux.org> | 2021-08-15 11:08:26 -0400 |
|---|---|---|
| committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-10-04 16:29:30 -0400 |
| commit | e8a85fa8a2cdbbcd5dcefd9152be67e4416338ca (patch) | |
| tree | 83ed77c6e7372b73fc7f84cb326fd95808335be8 /mesonbuild/scripts | |
| parent | 2d65472c725f18b343aee00bf91b9ac98c08b95f (diff) | |
| download | meson-e8a85fa8a2cdbbcd5dcefd9152be67e4416338ca.tar.gz | |
various python neatness cleanups
All changes were created by running
"pyupgrade --py3-only"
and committing the results. Although this has been performed in the
past, newer versions of pyupgrade can automatically catch more
opportunities, notably list comprehensions can use generators instead,
in the following cases:
- unpacking into function arguments as function(*generator)
- unpacking into assignments of the form x, y = generator
- as the argument to some builtin functions such as min/max/sorted
Also catch a few creeping cases of new code added using older styles.
Diffstat (limited to 'mesonbuild/scripts')
| -rw-r--r-- | mesonbuild/scripts/clangformat.py | 2 | ||||
| -rw-r--r-- | mesonbuild/scripts/clangtidy.py | 2 | ||||
| -rw-r--r-- | mesonbuild/scripts/depscan.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/scripts/clangformat.py b/mesonbuild/scripts/clangformat.py index 8e61b5591..518d44ced 100644 --- a/mesonbuild/scripts/clangformat.py +++ b/mesonbuild/scripts/clangformat.py @@ -70,7 +70,7 @@ def clangformat(exelist: T.List[str], srcdir: Path, builddir: Path, check: bool) any(fnmatch.fnmatch(strf, i) for i in ignore): continue futures.append(e.submit(run_clang_format, exelist, f, check)) - returncode = max([x.result().returncode for x in futures]) + returncode = max(x.result().returncode for x in futures) return returncode def run(args: T.List[str]) -> int: diff --git a/mesonbuild/scripts/clangtidy.py b/mesonbuild/scripts/clangtidy.py index 8d366c84d..d1732a317 100644 --- a/mesonbuild/scripts/clangtidy.py +++ b/mesonbuild/scripts/clangtidy.py @@ -36,7 +36,7 @@ def manual_clangtidy(srcdir_name: str, builddir_name: str) -> int: if strf.startswith(builddir_name): continue futures.append(e.submit(subprocess.run, ['clang-tidy', '-p', builddir_name, strf])) - returncode = max([x.result().returncode for x in futures]) + returncode = max(x.result().returncode for x in futures) return returncode def clangtidy(srcdir_name: str, builddir_name: str) -> int: diff --git a/mesonbuild/scripts/depscan.py b/mesonbuild/scripts/depscan.py index f2ec0bded..c80a5bc27 100644 --- a/mesonbuild/scripts/depscan.py +++ b/mesonbuild/scripts/depscan.py @@ -197,7 +197,7 @@ class DependencyScanner: def run(args: T.List[str]) -> int: assert len(args) == 3, 'got wrong number of arguments!' pickle_file, outfile, jsonfile = args - with open(jsonfile, 'r', encoding='utf-8') as f: + with open(jsonfile, encoding='utf-8') as f: sources = json.load(f) scanner = DependencyScanner(pickle_file, outfile, sources) return scanner.scan() |
