typing: fully annotate arglist

pull/7657/head
Daniel Mensinger 4 years ago
parent 1217cf9a3b
commit 3dbfe8f75a
No known key found for this signature in database
GPG Key ID: 54DD94C131E277D4
  1. 6
      mesonbuild/arglist.py
  2. 4
      mesonbuild/compilers/mixins/intel.py
  3. 2
      run_mypy.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:
'''

@ -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 []

@ -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',
]

Loading…
Cancel
Save