Skip to content

Commit

Permalink
options: use a TypedDict for kwargs to ArgumentParser.add_argument
Browse files Browse the repository at this point in the history
This cleans up some more typing issues.
  • Loading branch information
dcbaker authored and eli-schwartz committed Sep 6, 2024
1 parent 69f1679 commit 53e1148
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mesonbuild/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@
)
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.
Expand Down Expand Up @@ -567,7 +577,7 @@ def prefixed_default(self, name: 'OptionKey', prefix: str = '') -> T.Any:
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()
Expand Down

0 comments on commit 53e1148

Please sign in to comment.