From 3295621706d47ca6f4731695e9c9acc0ddcc572b Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 3 Nov 2021 10:06:22 -0700 Subject: interpreter: add typed_kwargs to subdir --- mesonbuild/interpreter/kwargs.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'mesonbuild/interpreter/kwargs.py') diff --git a/mesonbuild/interpreter/kwargs.py b/mesonbuild/interpreter/kwargs.py index 00dfdfd..50bc5d1 100644 --- a/mesonbuild/interpreter/kwargs.py +++ b/mesonbuild/interpreter/kwargs.py @@ -6,7 +6,7 @@ import typing as T -from typing_extensions import TypedDict, Literal +from typing_extensions import TypedDict, Literal, Protocol from .. import build from .. import coredata @@ -204,3 +204,18 @@ class Project(TypedDict): default_options: T.List[str] license: T.List[str] subproject_dir: str + + +class _FoundProto(Protocol): + + """Protocol for subdir arguments. + + This allows us to define any objec that has a found(self) -> bool method + """ + + def found(self) -> bool: ... + + +class Subdir(TypedDict): + + if_found: T.List[_FoundProto] -- cgit v1.1