mark a couple of typing-only imports as noqa, to appease pyflakes

Since it cannot resolve `import typing as T` in order to figure out that
T.* is doing annotation-worthy stuff.

Since T.cast('Foo') is not actually using Foo except in an annotation
context (due to being a string) it requires extra work to resolve, and
the only thing that would currently work is actually using
'typing.cast'. However, we have decided to not use it except as T...

Since this import is only imported during mypy it's not so bad to noqa
it.
pull/9256/head
Eli Schwartz 3 years ago
parent cbfdfca089
commit 6cc1b8441c
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 4
      mesonbuild/interpreterbase/interpreterbase.py
  2. 4
      mesonbuild/mlog.py

@ -54,7 +54,9 @@ import textwrap
from functools import wraps
if T.TYPE_CHECKING:
from ..interpreter import Interpreter
# T.cast is not handled by flake8 to detect quoted annotation use
# see https://github.com/PyCQA/pyflakes/pull/632
from ..interpreter import Interpreter # noqa
HolderMapType = T.Dict[
T.Union[

@ -22,7 +22,9 @@ from contextlib import contextmanager
from pathlib import Path
if T.TYPE_CHECKING:
from ._typing import StringProtocol, SizedStringProtocol
# T.Union is not handled by flake8 to detect quoted annotation use (StringProtocol)
# see https://github.com/PyCQA/pyflakes/pull/632
from ._typing import StringProtocol, SizedStringProtocol # noqa: F401
"""This is (mostly) a standalone module used to write logging
information about Meson runs. Some output goes to screen,

Loading…
Cancel
Save