consider-merging-isinstance / R1701ΒΆ
Message emitted:
Consider merging these isinstance calls to isinstance(%s, (%s))
Description:
Used when multiple consecutive isinstance calls can be merged into one.
Problematic code:
from typing import Any
def is_number(value: Any) -> bool:
# +1: [consider-merging-isinstance]
return isinstance(value, int) or isinstance(value, float)
Correct code:
from typing import Any
def is_number(value: Any) -> bool:
return isinstance(value, (int, float))
Created by the refactoring checker.