options: use a TypedDict for kwargs to ArgumentParser.add_argument

This cleans up some more typing issues.
pull/12882/head
Dylan Baker 3 months ago committed by Eli Schwartz
parent 69f1679dbd
commit 53e11488d9
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 12
      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()

Loading…
Cancel
Save