aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/ast
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2020-08-28 18:00:50 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2020-09-08 20:15:55 +0200
commit3489442848c84c05ce0fb8a696d3b5ae0e46daaa (patch)
tree5f30565dd585841cae06726b93d3c41548f2e288 /mesonbuild/ast
parent9c1e72202de8015e16a4ba2ccf8ea50c10f474f7 (diff)
downloadmeson-3489442848c84c05ce0fb8a696d3b5ae0e46daaa.zip
meson-3489442848c84c05ce0fb8a696d3b5ae0e46daaa.tar.gz
meson-3489442848c84c05ce0fb8a696d3b5ae0e46daaa.tar.bz2
typing: completely type ast
Diffstat (limited to 'mesonbuild/ast')
-rw-r--r--mesonbuild/ast/introspection.py6
-rw-r--r--mesonbuild/ast/postprocess.py6
-rw-r--r--mesonbuild/ast/visitor.py2
3 files changed, 7 insertions, 7 deletions
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py
index 6e6927f..73cd422 100644
--- a/mesonbuild/ast/introspection.py
+++ b/mesonbuild/ast/introspection.py
@@ -21,7 +21,7 @@ from .. import compilers, environment, mesonlib, optinterpreter
from .. import coredata as cdata
from ..mesonlib import MachineChoice
from ..interpreterbase import InvalidArguments, TYPE_nvar
-from ..build import Executable, Jar, SharedLibrary, SharedModule, StaticLibrary
+from ..build import BuildTarget, Executable, Jar, SharedLibrary, SharedModule, StaticLibrary
from ..mparser import BaseNode, ArithmeticNode, ArrayNode, ElementaryNode, IdNode, FunctionNode, StringNode
import typing as T
import os
@@ -173,7 +173,7 @@ class IntrospectionInterpreter(AstInterpreter):
'node': node
}]
- def build_target(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs_raw: T.Dict[str, TYPE_nvar], targetclass) -> T.Optional[T.Dict[str, T.Any]]:
+ def build_target(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs_raw: T.Dict[str, TYPE_nvar], targetclass: T.Type[BuildTarget]) -> T.Optional[T.Dict[str, T.Any]]:
args = self.flatten_args(args)
if not args or not isinstance(args[0], str):
return None
@@ -295,7 +295,7 @@ class IntrospectionInterpreter(AstInterpreter):
return None
def is_subproject(self) -> bool:
- return self.subproject != ''
+ return str(self.subproject) != ''
def analyze(self) -> None:
self.load_root_meson_file()
diff --git a/mesonbuild/ast/postprocess.py b/mesonbuild/ast/postprocess.py
index 35fe1d3..6d808be 100644
--- a/mesonbuild/ast/postprocess.py
+++ b/mesonbuild/ast/postprocess.py
@@ -20,7 +20,7 @@ from .. import mparser
import typing as T
class AstIndentationGenerator(AstVisitor):
- def __init__(self):
+ def __init__(self) -> None:
self.level = 0
def visit_default_func(self, node: mparser.BaseNode) -> None:
@@ -76,7 +76,7 @@ class AstIndentationGenerator(AstVisitor):
self.level -= 1
class AstIDGenerator(AstVisitor):
- def __init__(self):
+ def __init__(self) -> None:
self.counter = {} # type: T.Dict[str, int]
def visit_default_func(self, node: mparser.BaseNode) -> None:
@@ -87,7 +87,7 @@ class AstIDGenerator(AstVisitor):
self.counter[name] += 1
class AstConditionLevel(AstVisitor):
- def __init__(self):
+ def __init__(self) -> None:
self.condition_level = 0
def visit_default_func(self, node: mparser.BaseNode) -> None:
diff --git a/mesonbuild/ast/visitor.py b/mesonbuild/ast/visitor.py
index 451020d..0f2265c 100644
--- a/mesonbuild/ast/visitor.py
+++ b/mesonbuild/ast/visitor.py
@@ -18,7 +18,7 @@
from .. import mparser
class AstVisitor:
- def __init__(self):
+ def __init__(self) -> None:
pass
def visit_default_func(self, node: mparser.BaseNode) -> None: