From ec00fb8db7f5c72faccde55a7f48dc6023c65411 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Fri, 5 Jul 2024 19:03:16 +0300 Subject: [PATCH] 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. --- mypy/semanal_classprop.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mypy/semanal_classprop.py b/mypy/semanal_classprop.py index b5f1b2181761..c5ad34122f6c 100644 --- a/mypy/semanal_classprop.py +++ b/mypy/semanal_classprop.py @@ -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: