typing: fully annotate fs module

pull/7657/head
Daniel Mensinger 4 years ago
parent 3dbfe8f75a
commit 6b1b995b32
No known key found for this signature in database
GPG Key ID: 54DD94C131E277D4
  1. 8
      mesonbuild/modules/fs.py
  2. 1
      run_mypy.py

@ -24,11 +24,11 @@ from ..interpreterbase import FeatureNew
from ..interpreterbase import stringArgs, noKwargs
if T.TYPE_CHECKING:
from ..interpreter import ModuleState
from ..interpreter import Interpreter, ModuleState
class FSModule(ExtensionModule):
def __init__(self, interpreter):
def __init__(self, interpreter: 'Interpreter') -> None:
super().__init__(interpreter)
self.snippets.add('generate_dub_file')
@ -36,7 +36,7 @@ class FSModule(ExtensionModule):
"""
make an absolute path from a relative path, WITHOUT resolving symlinks
"""
return Path(state.source_root) / state.subdir / Path(arg).expanduser()
return Path(state.source_root) / Path(state.subdir) / Path(arg).expanduser()
def _resolve_dir(self, state: 'ModuleState', arg: str) -> Path:
"""
@ -193,5 +193,5 @@ class FSModule(ExtensionModule):
new = original.stem
return ModuleReturnValue(str(new), [])
def initialize(*args, **kwargs) -> FSModule:
def initialize(*args: T.Any, **kwargs: T.Any) -> FSModule:
return FSModule(*args, **kwargs)

@ -38,6 +38,7 @@ strict_modules = [
'mesonbuild/ast',
'mesonbuild/wrap',
'mesonbuild/scripts',
'mesonbuild/modules/fs.py',
'mesonbuild/dependencies/boost.py',
'mesonbuild/dependencies/hdf5.py',
'mesonbuild/compilers/mixins/intel.py',

Loading…
Cancel
Save