interpreterobjects: Add TypedDict annoations for `extract_search_dirs`

This allows for more accurate type checking
pull/9132/head
Dylan Baker 3 years ago
parent 580f316043
commit a1fb3199c8
  1. 2
      mesonbuild/interpreter/interpreterobjects.py
  2. 10
      mesonbuild/interpreter/kwargs.py

@ -62,7 +62,7 @@ def extract_required_kwarg(kwargs: 'kwargs.ExtractRequired',
return disabled, required, feature
def extract_search_dirs(kwargs: T.Dict[str, T.Any]) -> T.List[str]:
def extract_search_dirs(kwargs: 'kwargs.ExtractSearchDirs') -> T.List[str]:
search_dirs_str = mesonlib.stringlistify(kwargs.get('dirs', []))
search_dirs = [Path(d).expanduser() for d in search_dirs_str]
for d in search_dirs:

@ -72,6 +72,16 @@ class ExtractRequired(TypedDict):
required: T.Union[bool, coredata.UserFeatureOption]
class ExtractSearchDirs(TypedDict):
"""Keyword arguments consumed by the `extract_search_dirs` function.
See the not in `ExtractRequired`
"""
dirs: T.List[str]
class FuncGenerator(TypedDict):
"""Keyword rguments for the generator function."""

Loading…
Cancel
Save