diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2024-08-28 10:34:09 -0700 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2024-09-06 16:04:02 -0400 |
| commit | 53e11488d9ce01b14c2b280d66c3efeda1c60abc (patch) | |
| tree | 5973f537996785373130a163ca0212217270f68a | |
| parent | 69f1679dbd32ae09237f7e2c8f76d3b6aa516378 (diff) | |
| download | meson-53e11488d9ce01b14c2b280d66c3efeda1c60abc.tar.gz | |
options: use a TypedDict for kwargs to ArgumentParser.add_argument
This cleans up some more typing issues.
| -rw-r--r-- | mesonbuild/options.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/mesonbuild/options.py b/mesonbuild/options.py index e3fe98ef9..9f65cc6b7 100644 --- a/mesonbuild/options.py +++ b/mesonbuild/options.py @@ -27,6 +27,16 @@ from .mesonlib import ( ) from . import mlog +if T.TYPE_CHECKING: + from typing_extensions import TypedDict + + class ArgparseKWs(TypedDict, total=False): + + action: str + dest: str + default: str + choices: T.List + DEFAULT_YIELDING = False # Can't bind this near the class method it seems, sadly. @@ -567,7 +577,7 @@ class BuiltinOption(T.Generic[_T, _U]): return self.default def add_to_argparse(self, name: str, parser: argparse.ArgumentParser, help_suffix: str) -> None: - kwargs = OrderedDict() + kwargs: ArgparseKWs = {} c = self._argparse_choices() b = self._argparse_action() |
