aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/modtest.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/modules/modtest.py')
-rw-r--r--mesonbuild/modules/modtest.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/mesonbuild/modules/modtest.py b/mesonbuild/modules/modtest.py
index dd2e2ff..e36899f 100644
--- a/mesonbuild/modules/modtest.py
+++ b/mesonbuild/modules/modtest.py
@@ -12,19 +12,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
+import typing as T
+
from . import ExtensionModule
-from ..interpreterbase import noKwargs
+from ..interpreterbase import noKwargs, noPosargs
+
+if T.TYPE_CHECKING:
+ from . import ModuleState
+ from ..interpreter.interpreter import Interpreter
+ from ..interpreterbase.baseobjects import TYPE_kwargs, TYPE_var
+
class TestModule(ExtensionModule):
- def __init__(self, interpreter):
+ def __init__(self, interpreter: Interpreter) -> None:
super().__init__(interpreter)
self.methods.update({
'print_hello': self.print_hello,
})
@noKwargs
- def print_hello(self, state, args, kwargs):
+ @noPosargs
+ def print_hello(self, state: ModuleState, args: T.List[TYPE_var], kwargs: TYPE_kwargs) -> None:
print('Hello from a Meson module')
-def initialize(*args, **kwargs):
- return TestModule(*args, **kwargs)
+
+def initialize(interp: Interpreter) -> TestModule:
+ return TestModule(interp)