summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2024-08-28 10:34:09 -0700
committerEli Schwartz <eschwartz93@gmail.com>2024-09-06 16:04:02 -0400
commit53e11488d9ce01b14c2b280d66c3efeda1c60abc (patch)
tree5973f537996785373130a163ca0212217270f68a
parent69f1679dbd32ae09237f7e2c8f76d3b6aa516378 (diff)
downloadmeson-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.py12
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()