aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-03-01 23:32:14 -0500
committerEli Schwartz <eschwartz@archlinux.org>2022-03-07 19:01:04 -0500
commita009eacc65ddb447edcfc9fd317ad828d9b3353a (patch)
treeae1c6388bfa45eb0672bbed1d8f18ebe0b3c2819 /mesonbuild/modules
parent187dc656f48ba7a86a14a5c8d9f16a3b2b7d8770 (diff)
downloadmeson-a009eacc65ddb447edcfc9fd317ad828d9b3353a.zip
meson-a009eacc65ddb447edcfc9fd317ad828d9b3353a.tar.gz
meson-a009eacc65ddb447edcfc9fd317ad828d9b3353a.tar.bz2
treewide: string-quote the first argument to T.cast
Using future annotations, type annotations become strings at runtime and don't impact performance. This is not possible to do with T.cast though, because it is a function argument instead of an annotation. Quote the type argument everywhere in order to have the same effect as future annotations. This also allows linters to better detect in some cases that a given import is typing-only.
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/gnome.py4
-rw-r--r--mesonbuild/modules/java.py2
-rw-r--r--mesonbuild/modules/qt.py2
3 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index 486b395..59e84ec 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -1168,7 +1168,7 @@ class GnomeModule(ExtensionModule):
scan_target = self._make_gir_target(
state, girfile, scan_command, generated_files, depends,
# We have to cast here because mypy can't figure this out
- T.cast(T.Dict[str, T.Any], kwargs))
+ T.cast('T.Dict[str, T.Any]', kwargs))
typelib_output = f'{ns}-{nsversion}.typelib'
typelib_cmd = [gicompiler, scan_target, '--output', '@OUTPUT@']
@@ -1177,7 +1177,7 @@ class GnomeModule(ExtensionModule):
for incdir in typelib_includes:
typelib_cmd += ["--includedir=" + incdir]
- typelib_target = self._make_typelib_target(state, typelib_output, typelib_cmd, generated_files, T.cast(T.Dict[str, T.Any], kwargs))
+ typelib_target = self._make_typelib_target(state, typelib_output, typelib_cmd, generated_files, T.cast('T.Dict[str, T.Any]', kwargs))
self._devenv_prepend('GI_TYPELIB_PATH', os.path.join(state.environment.get_build_dir(), state.subdir))
diff --git a/mesonbuild/modules/java.py b/mesonbuild/modules/java.py
index 3806308..ddb14c8 100644
--- a/mesonbuild/modules/java.py
+++ b/mesonbuild/modules/java.py
@@ -88,7 +88,7 @@ class JavaModule(NewExtensionModule):
KwargInfo('package', str, default=None))
def generate_native_headers(self, state: ModuleState, args: T.Tuple[T.List[mesonlib.FileOrString]],
kwargs: T.Dict[str, T.Optional[str]]) -> ModuleReturnValue:
- classes = T.cast(T.List[str], kwargs.get('classes'))
+ classes = T.cast('T.List[str]', kwargs.get('classes'))
package = kwargs.get('package')
headers: T.List[str] = []
diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py
index 37072b4..bf6d30c 100644
--- a/mesonbuild/modules/qt.py
+++ b/mesonbuild/modules/qt.py
@@ -486,7 +486,7 @@ class QtBaseModule(ExtensionModule):
if _sources:
FeatureDeprecated.single_use('qt.preprocess positional sources', '0.59', state.subproject, location=state.current_node)
# List is invariant, os we have to cast...
- sources = T.cast(T.List[T.Union[str, File, build.GeneratedList, build.CustomTarget]],
+ sources = T.cast('T.List[T.Union[str, File, build.GeneratedList, build.CustomTarget]]',
_sources + kwargs['sources'])
for s in sources:
if not isinstance(s, (str, File)):