diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-03-01 23:32:14 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-03-07 19:01:04 -0500 |
commit | a009eacc65ddb447edcfc9fd317ad828d9b3353a (patch) | |
tree | ae1c6388bfa45eb0672bbed1d8f18ebe0b3c2819 /mesonbuild/backend | |
parent | 187dc656f48ba7a86a14a5c8d9f16a3b2b7d8770 (diff) | |
download | meson-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/backend')
-rw-r--r-- | mesonbuild/backend/backends.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index b98eb08..eeb7d62 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -328,7 +328,7 @@ class Backend: # cast, we know what's in coredata anyway. # TODO: if it's possible to annotate get_option or validate_option_value # in the future we might be able to remove the cast here - return T.cast(T.Union[str, int, bool, 'WrapMode'], v) + return T.cast('T.Union[str, int, bool, WrapMode]', v) def get_source_dir_include_args(self, target: build.BuildTarget, compiler: 'Compiler', *, absolute_path: bool = False) -> T.List[str]: curdir = target.get_subdir() @@ -937,7 +937,7 @@ class Backend: commands += compiler.get_no_warn_args() else: # warning_level is a string, but mypy can't determine that - commands += compiler.get_warn_args(T.cast(str, self.get_option_for_target(OptionKey('warning_level'), target))) + commands += compiler.get_warn_args(T.cast('str', self.get_option_for_target(OptionKey('warning_level'), target))) # Add -Werror if werror=true is set in the build options set on the # command-line or default_options inside project(). This only sets the # action to be done for warnings if/when they are emitted, so it's ok |