diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-08-30 13:15:09 +0200 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-09-08 20:15:57 +0200 |
commit | 6b1b995b32a867614535ba1d1c80844b273fc053 (patch) | |
tree | f97056fea4a657323ea977d30092485f2b6cf651 | |
parent | 3dbfe8f75a17966917879e2be6037b262d807bac (diff) | |
download | meson-6b1b995b32a867614535ba1d1c80844b273fc053.zip meson-6b1b995b32a867614535ba1d1c80844b273fc053.tar.gz meson-6b1b995b32a867614535ba1d1c80844b273fc053.tar.bz2 |
typing: fully annotate fs module
-rw-r--r-- | mesonbuild/modules/fs.py | 8 | ||||
-rwxr-xr-x | run_mypy.py | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/mesonbuild/modules/fs.py b/mesonbuild/modules/fs.py index d483111..5ba1e38 100644 --- a/mesonbuild/modules/fs.py +++ b/mesonbuild/modules/fs.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) diff --git a/run_mypy.py b/run_mypy.py index c7d44b6..3369b1a 100755 --- a/run_mypy.py +++ b/run_mypy.py @@ -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', |