Pyright does not respect a valid # type: ignore
comment when a function arguments are on multiple lines.
#4358
Answered
by
erictraut
simon-liebehenschel
asked this question in
Q&A
-
Code exampleHere is a very simplified code because I am talking not about type hints, but about how Pyright parses @limit_gen
async def my_function(*, foo, bar):
...
# A decorator adds a `limit` parameter, and to suppress Mypy warnings during a function call I use `# type: ignore[call-arg]`
async for _ in my_function( # type: ignore[call-arg]
foo=bar,
spam=eggs,
limit=42,
):
... Mypy resultNo errors because Mypy discovers a Pyright resultA warning, unless I will copy the comment to a specific argument line: my_function( # type: ignore[call-arg]
foo=bar,
spam=eggs,
limit=limit # type: ignore[call-arg]
) QuestionIs this a Pyright bug or a feature? |
Beta Was this translation helpful? Give feedback.
Answered by
erictraut
Dec 19, 2022
Replies: 1 comment 2 replies
-
A |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
simon-liebehenschel
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A
# type: ignore
comment affects only the line that it is on. This is by design.