diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-01-06 15:27:38 +0100 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-01-08 15:28:17 +0100 |
commit | 09b53c534f74806ebc49bb2fcdfbae0e3b26fb84 (patch) | |
tree | 4466a6005333d6d1ae7d67cbaf24fb63e104df6a /mesonbuild/modules | |
parent | f3199edaf8802e2a59fed2f83e825e09b9d4bd0d (diff) | |
download | meson-09b53c534f74806ebc49bb2fcdfbae0e3b26fb84.zip meson-09b53c534f74806ebc49bb2fcdfbae0e3b26fb84.tar.gz meson-09b53c534f74806ebc49bb2fcdfbae0e3b26fb84.tar.bz2 |
types: import typing as T (fixes #6333)
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r-- | mesonbuild/modules/fs.py | 26 | ||||
-rw-r--r-- | mesonbuild/modules/python.py | 8 |
2 files changed, 17 insertions, 17 deletions
diff --git a/mesonbuild/modules/fs.py b/mesonbuild/modules/fs.py index 7340fb7..523ad2b 100644 --- a/mesonbuild/modules/fs.py +++ b/mesonbuild/modules/fs.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import typing +import typing as T import hashlib from pathlib import Path, PurePath @@ -22,7 +22,7 @@ from . import ModuleReturnValue from ..mesonlib import MesonException from ..interpreterbase import stringArgs, noKwargs -if typing.TYPE_CHECKING: +if T.TYPE_CHECKING: from ..interpreter import ModuleState class FSModule(ExtensionModule): @@ -38,7 +38,7 @@ class FSModule(ExtensionModule): """ return Path(state.source_root) / state.subdir / Path(arg).expanduser() - def _check(self, check: str, state: 'ModuleState', args: typing.Sequence[str]) -> ModuleReturnValue: + def _check(self, check: str, state: 'ModuleState', args: T.Sequence[str]) -> ModuleReturnValue: if len(args) != 1: raise MesonException('fs.{} takes exactly one argument.'.format(check)) test_file = self._resolve_dir(state, args[0]) @@ -46,27 +46,27 @@ class FSModule(ExtensionModule): @stringArgs @noKwargs - def exists(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: + def exists(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue: return self._check('exists', state, args) @stringArgs @noKwargs - def is_symlink(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: + def is_symlink(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue: return self._check('is_symlink', state, args) @stringArgs @noKwargs - def is_file(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: + def is_file(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue: return self._check('is_file', state, args) @stringArgs @noKwargs - def is_dir(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: + def is_dir(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue: return self._check('is_dir', state, args) @stringArgs @noKwargs - def hash(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: + def hash(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue: if len(args) != 2: raise MesonException('method takes exactly two arguments.') file = self._resolve_dir(state, args[0]) @@ -82,7 +82,7 @@ class FSModule(ExtensionModule): @stringArgs @noKwargs - def size(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: + def size(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue: if len(args) != 1: raise MesonException('method takes exactly one argument.') file = self._resolve_dir(state, args[0]) @@ -95,7 +95,7 @@ class FSModule(ExtensionModule): @stringArgs @noKwargs - def is_samepath(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: + def is_samepath(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue: if len(args) != 2: raise MesonException('fs.is_samepath takes exactly two arguments.') file1 = self._resolve_dir(state, args[0]) @@ -111,7 +111,7 @@ class FSModule(ExtensionModule): @stringArgs @noKwargs - def replace_suffix(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: + def replace_suffix(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue: if len(args) != 2: raise MesonException('method takes exactly two arguments.') original = PurePath(args[0]) @@ -120,7 +120,7 @@ class FSModule(ExtensionModule): @stringArgs @noKwargs - def parent(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: + def parent(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue: if len(args) != 1: raise MesonException('method takes exactly one argument.') original = PurePath(args[0]) @@ -129,7 +129,7 @@ class FSModule(ExtensionModule): @stringArgs @noKwargs - def name(self, state: 'ModuleState', args: typing.Sequence[str], kwargs: dict) -> ModuleReturnValue: + def name(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue: if len(args) != 1: raise MesonException('method takes exactly one argument.') original = PurePath(args[0]) diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 07be318..1e2b2ee 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -15,7 +15,7 @@ import os import json import shutil -import typing +import typing as T from pathlib import Path from .. import mesonlib @@ -495,9 +495,9 @@ class PythonModule(ExtensionModule): def find_installation(self, interpreter, state, args, kwargs): feature_check = FeatureNew('Passing "feature" option to find_installation', '0.48.0') disabled, required, feature = extract_required_kwarg(kwargs, state.subproject, feature_check) - want_modules = mesonlib.extract_as_list(kwargs, 'modules') # type: typing.List[str] - found_modules = [] # type: typing.List[str] - missing_modules = [] # type: typing.List[str] + want_modules = mesonlib.extract_as_list(kwargs, 'modules') # type: T.List[str] + found_modules = [] # type: T.List[str] + missing_modules = [] # type: T.List[str] if len(args) > 1: raise InvalidArguments('find_installation takes zero or one positional argument.') |