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/mesonlib/universal.py | |
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/mesonlib/universal.py')
-rw-r--r-- | mesonbuild/mesonlib/universal.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py index 41bd1f2..c7cb561 100644 --- a/mesonbuild/mesonlib/universal.py +++ b/mesonbuild/mesonlib/universal.py @@ -890,7 +890,7 @@ def version_compare_condition_with_min(condition: str, minimum: str) -> bool: if re.match(r'^\d+.\d+$', condition): condition += '.0' - return T.cast(bool, cmpop(Version(minimum), Version(condition))) + return T.cast('bool', cmpop(Version(minimum), Version(condition))) def search_version(text: str) -> str: # Usually of the type 4.1.4 but compiler output may contain @@ -1336,7 +1336,7 @@ def typeslistify(item: 'T.Union[_T, T.Sequence[_T]]', list of items all of which are of type @types ''' if isinstance(item, types): - item = T.cast(T.List[_T], [item]) + item = T.cast('T.List[_T]', [item]) if not isinstance(item, list): raise MesonException('Item must be a list or one of {!r}, not {!r}'.format(types, type(item))) for i in item: |