From d05a0fbf335b23814ede488c668f43c97fd4f06c Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 4 Nov 2021 10:53:17 -0700 Subject: interpreter: use typed_* args for the summary function This also includes a few type annotation cleans for the Summary object. Getting the positional arguments exactly right is impossible, as this is really a function with two different signatures: ``` summary(value: dictionary): void summary(key: string, value: any): void ``` We can get close enough in the typed_pos_args by enforcing that there are two parameters, one required and one optional, and that the first must be either a dictionary or a string. --- mesonbuild/interpreter/kwargs.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mesonbuild/interpreter/kwargs.py') diff --git a/mesonbuild/interpreter/kwargs.py b/mesonbuild/interpreter/kwargs.py index 50bc5d1..4777d8a 100644 --- a/mesonbuild/interpreter/kwargs.py +++ b/mesonbuild/interpreter/kwargs.py @@ -219,3 +219,10 @@ class _FoundProto(Protocol): class Subdir(TypedDict): if_found: T.List[_FoundProto] + + +class Summary(TypedDict): + + section: str + bool_yn: bool + list_sep: T.Optional[str] -- cgit v1.1