diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-08-04 13:21:27 -0700 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2021-08-04 19:09:08 -0400 |
commit | f4a1da01455bbfdc7e34f8d96638e69f91d4a4bb (patch) | |
tree | 21c1ecbcd5da3b69648c1a45116f76ba0177b8dc /mesonbuild | |
parent | 2307cbd2ac1388b6ad2d4135a6d5519d4272afc9 (diff) | |
download | meson-f4a1da01455bbfdc7e34f8d96638e69f91d4a4bb.zip meson-f4a1da01455bbfdc7e34f8d96638e69f91d4a4bb.tar.gz meson-f4a1da01455bbfdc7e34f8d96638e69f91d4a4bb.tar.bz2 |
interpreterbase/decorators: use a named function for lowering strings
Mypy gets confused by the lambda, so we might as well just use a named
function.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/interpreter/type_checking.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py index d6855c3..6088eef 100644 --- a/mesonbuild/interpreter/type_checking.py +++ b/mesonbuild/interpreter/type_checking.py @@ -77,6 +77,14 @@ def _install_mode_convertor(mode: T.Optional[T.List[T.Union[str, bool, int]]]) - return FileMode(*[m if isinstance(m, str) else None for m in mode]) +def _lower_strlist(input: T.List[str]) -> T.List[str]: + """Lower a list of strings. + + mypy (but not pyright) gets confused about using a lambda as the convertor function + """ + return [i.lower() for i in input] + + NATIVE_KW = KwargInfo( 'native', bool, default=False, @@ -87,7 +95,7 @@ LANGUAGE_KW = KwargInfo( listify=True, required=True, validator=_language_validator, - convertor=lambda x: [i.lower() for i in x]) + convertor=_lower_strlist) INSTALL_MODE_KW: KwargInfo[T.List[T.Union[str, bool, int]]] = KwargInfo( 'install_mode', |