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/interpreter | |
| 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/interpreter')
| -rw-r--r-- | mesonbuild/interpreter/compiler.py | 2 | ||||
| -rw-r--r-- | mesonbuild/interpreter/type_checking.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/interpreter/compiler.py b/mesonbuild/interpreter/compiler.py index 70a2d18f0..e595daf7f 100644 --- a/mesonbuild/interpreter/compiler.py +++ b/mesonbuild/interpreter/compiler.py @@ -574,7 +574,7 @@ class CompilerHolder(ObjectHolder['Compiler']): KwargInfo('static', (bool, NoneType), since='0.51.0'), KwargInfo('disabler', bool, default=False, since='0.49.0'), KwargInfo('dirs', ContainerTypeInfo(list, str), listify=True, default=[]), - *[k.evolve(name=f'header_{k.name}') for k in _HEADER_KWS] + *(k.evolve(name=f'header_{k.name}') for k in _HEADER_KWS) ) def find_library_method(self, args: T.Tuple[str], kwargs: 'FindLibraryKW') -> 'dependencies.ExternalLibrary': # TODO add dependencies support? diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py index 46910dd27..0b40611a8 100644 --- a/mesonbuild/interpreter/type_checking.py +++ b/mesonbuild/interpreter/type_checking.py @@ -90,7 +90,7 @@ def _install_mode_convertor(mode: T.Optional[T.List[T.Union[str, bool, int]]]) - emtpy FileMode. """ # this has already been validated by the validator - return FileMode(*[m if isinstance(m, str) else None for m in mode]) + return FileMode(*(m if isinstance(m, str) else None for m in mode)) def _lower_strlist(input: T.List[str]) -> T.List[str]: |
