Skip to content

Commit ec00fb8

Browse files
authored
Refactor: remove temporary def from semanal_classprop.check_protocol_status (#17486)
There's no need to create and call a temporary function, when we can just call an existing method: faster and simplier.
1 parent 6069718 commit ec00fb8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

mypy/semanal_classprop.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,12 @@ def check_protocol_status(info: TypeInfo, errors: Errors) -> None:
122122
if info.is_protocol:
123123
for type in info.bases:
124124
if not type.type.is_protocol and type.type.fullname != "builtins.object":
125-
126-
def report(message: str, severity: str) -> None:
127-
errors.report(info.line, info.column, message, severity=severity)
128-
129-
report("All bases of a protocol must be protocols", "error")
125+
errors.report(
126+
info.line,
127+
info.column,
128+
"All bases of a protocol must be protocols",
129+
severity="error",
130+
)
130131

131132

132133
def calculate_class_vars(info: TypeInfo) -> None:

0 commit comments

Comments
 (0)