Skip to content

Commit

Permalink
Refactor: remove temporary def from `semanal_classprop.check_protoc…
Browse files Browse the repository at this point in the history
…ol_status` (#17486)

There's no need to create and call a temporary function, when we can
just call an existing method: faster and simplier.
  • Loading branch information
sobolevn committed Jul 5, 2024
1 parent 6069718 commit ec00fb8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mypy/semanal_classprop.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,12 @@ def check_protocol_status(info: TypeInfo, errors: Errors) -> None:
if info.is_protocol:
for type in info.bases:
if not type.type.is_protocol and type.type.fullname != "builtins.object":

def report(message: str, severity: str) -> None:
errors.report(info.line, info.column, message, severity=severity)

report("All bases of a protocol must be protocols", "error")
errors.report(
info.line,
info.column,
"All bases of a protocol must be protocols",
severity="error",
)


def calculate_class_vars(info: TypeInfo) -> None:
Expand Down

0 comments on commit ec00fb8

Please sign in to comment.