You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
example.py:7:1: SIM108 Use ternary operator `retry = _retry if TYPE_CHECKING else functools.partial(_retry, count=3)` instead of `if`-`else`-block
In that case, type checkers like Mypy would not enable their special handling of if TYPE_CHECKING though, inferring the type of retry as a union type between the two expressions.
The SIM108 rule should ignore this case.
ruff --isolated --select SIM108 example.py
Version: 0.1.0
The text was updated successfully, but these errors were encountered:
When using type checkers like Mypy, it's sometimes necessary to give them different code to inspect. This is done via
if TYPE_CHECKING
blocks, e.g.The rule SIM108 will emit (or
--unsafe-fixes
):In that case, type checkers like Mypy would not enable their special handling of
if TYPE_CHECKING
though, inferring the type ofretry
as a union type between the two expressions.The SIM108 rule should ignore this case.
ruff --isolated --select SIM108 example.py
The text was updated successfully, but these errors were encountered: