In the following code, flake8 say F821 undefined name 'B'
.
But for mypy, type hint for f
is neccesary.
How to ignore such warnings by flake8?
def f(b: B) -> None:
pass
class B():
pass
This example can be solved trivially: change the order of declarations. But sometimes I cannot change the orders in realistic cases . Such misleading warnings are noisy for me.
My env: Python 3.6 + flake8 3.6.0 + mypy 0.641 + flake8-mypy 17.8.0
B
to'B'
works for me..... – Footstall