Skip to content

Commit 09f220a

Browse files
committed
Enable ruff SIM101 duplicate isinstance check
1 parent 8104d01 commit 09f220a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

mypy/stubtest.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,8 +1534,15 @@ def is_probably_private(name: str) -> bool:
15341534

15351535
def is_probably_a_function(runtime: Any) -> bool:
15361536
return (
1537-
isinstance(runtime, (types.FunctionType, types.BuiltinFunctionType))
1538-
or isinstance(runtime, (types.MethodType, types.BuiltinMethodType))
1537+
isinstance(
1538+
runtime,
1539+
(
1540+
types.FunctionType,
1541+
types.BuiltinFunctionType,
1542+
types.MethodType,
1543+
types.BuiltinMethodType,
1544+
),
1545+
)
15391546
or (inspect.ismethoddescriptor(runtime) and callable(runtime))
15401547
or (isinstance(runtime, types.MethodWrapperType) and callable(runtime))
15411548
)

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ select = [
142142
"PGH004", # blanket noqa comments
143143
"UP", # pyupgrade
144144
"C4", # flake8-comprehensions
145+
"SIM101", # merge duplicate isinstance calls
145146
"SIM201", "SIM202", "SIM222", "SIM223", # flake8-simplify
146147
"FURB188", # use str.remove(pre|suf)fix
147148
"ISC001", # implicitly concatenated string

0 commit comments

Comments
 (0)