diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2020-09-09 10:31:52 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-09 10:31:52 -0700 |
| commit | 4c2d0eb9bcedefa3ef06a237a0502afbc581268b (patch) | |
| tree | 1b08ca5fb0c93573409a7a8954e6e1905f8a5b10 /mesonbuild/modules/__init__.py | |
| parent | 8d54b7bda30062569c981b50a85a175565a7c15a (diff) | |
| parent | 057c77f7d08b3372e99065fb3f3cd37f16801a82 (diff) | |
| download | meson-4c2d0eb9bcedefa3ef06a237a0502afbc581268b.tar.gz | |
Merge pull request #7657 from mensinda/moreTyping
typing: Strict type annotations
Diffstat (limited to 'mesonbuild/modules/__init__.py')
| -rw-r--r-- | mesonbuild/modules/__init__.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py index 47be039dc..ff27a112b 100644 --- a/mesonbuild/modules/__init__.py +++ b/mesonbuild/modules/__init__.py @@ -19,14 +19,18 @@ import os from .. import build from ..mesonlib import unholder +import typing as T +if T.TYPE_CHECKING: + from ..interpreter import Interpreter + from ..interpreterbase import TYPE_var class ExtensionModule: - def __init__(self, interpreter): + def __init__(self, interpreter: 'Interpreter') -> None: self.interpreter = interpreter - self.snippets = set() # List of methods that operate only on the interpreter. + self.snippets = set() # type: T.Set[str] # List of methods that operate only on the interpreter. - def is_snippet(self, funcname): + def is_snippet(self, funcname: str) -> bool: return funcname in self.snippets @@ -69,7 +73,7 @@ def is_module_library(fname): class ModuleReturnValue: - def __init__(self, return_value, new_objects): + def __init__(self, return_value: 'TYPE_var', new_objects: T.List['TYPE_var']) -> None: self.return_value = return_value assert(isinstance(new_objects, list)) self.new_objects = new_objects |
