aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2020-08-30 13:11:24 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2020-09-08 20:15:57 +0200
commit3dbfe8f75a17966917879e2be6037b262d807bac (patch)
treea8c2b52799337efb245dd0a72221726714c53465
parent1217cf9a3bf7a49b68539ea1649ad5d8289ca5d1 (diff)
downloadmeson-3dbfe8f75a17966917879e2be6037b262d807bac.zip
meson-3dbfe8f75a17966917879e2be6037b262d807bac.tar.gz
meson-3dbfe8f75a17966917879e2be6037b262d807bac.tar.bz2
typing: fully annotate arglist
-rw-r--r--mesonbuild/arglist.py6
-rw-r--r--mesonbuild/compilers/mixins/intel.py4
-rwxr-xr-xrun_mypy.py2
3 files changed, 7 insertions, 5 deletions
diff --git a/mesonbuild/arglist.py b/mesonbuild/arglist.py
index 4ab7d09..b7fa749 100644
--- a/mesonbuild/arglist.py
+++ b/mesonbuild/arglist.py
@@ -164,7 +164,7 @@ class CompilerArgs(collections.abc.MutableSequence):
def __getitem__(self, index: slice) -> T.MutableSequence[str]: # noqa: F811
pass
- def __getitem__(self, index): # noqa: F811
+ def __getitem__(self, index): # type: ignore # noqa: F811
self.flush_pre_post()
return self._container[index]
@@ -176,7 +176,7 @@ class CompilerArgs(collections.abc.MutableSequence):
def __setitem__(self, index: slice, value: T.Iterable[str]) -> None: # noqa: F811
pass
- def __setitem__(self, index, value) -> None: # noqa: F811
+ def __setitem__(self, index, value) -> None: # type: ignore # noqa: F811
self.flush_pre_post()
self._container[index] = value
@@ -242,7 +242,7 @@ class CompilerArgs(collections.abc.MutableSequence):
new = self.copy()
else:
new = self
- return self.compiler.unix_args_to_native(new._container)
+ return T.cast(T.List[str], self.compiler.unix_args_to_native(new._container))
def append_direct(self, arg: str) -> None:
'''
diff --git a/mesonbuild/compilers/mixins/intel.py b/mesonbuild/compilers/mixins/intel.py
index fbbfdc5..eb4b10d 100644
--- a/mesonbuild/compilers/mixins/intel.py
+++ b/mesonbuild/compilers/mixins/intel.py
@@ -69,7 +69,7 @@ class IntelGnuLikeCompiler(GnuLikeCompiler):
's': ['-Os'],
}
- def __init__(self):
+ def __init__(self) -> None:
super().__init__()
# As of 19.0.0 ICC doesn't have sanitizer, color, or lto support.
#
@@ -152,7 +152,7 @@ class IntelVisualStudioLikeCompiler(VisualStudioLikeCompiler):
super().__init__(target)
self.id = 'intel-cl'
- def compile(self, code, *, extra_args: T.Optional[T.List[str]] = None, **kwargs) -> T.Iterator['subprocess.Popen']:
+ def compile(self, code: str, *, extra_args: T.Optional[T.List[str]] = None, **kwargs) -> T.Iterator['subprocess.Popen']:
# This covers a case that .get('foo', []) doesn't, that extra_args is
if kwargs.get('mode', 'compile') != 'link':
extra_args = extra_args.copy() if extra_args is not None else []
diff --git a/run_mypy.py b/run_mypy.py
index 71b6727..c7d44b6 100755
--- a/run_mypy.py
+++ b/run_mypy.py
@@ -40,6 +40,8 @@ strict_modules = [
'mesonbuild/scripts',
'mesonbuild/dependencies/boost.py',
'mesonbuild/dependencies/hdf5.py',
+ 'mesonbuild/compilers/mixins/intel.py',
+ 'mesonbuild/arglist.py',
'run_mypy.py',
'tools',
]