Skip to content

Commit 0fcc560

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 6af7027 commit 0fcc560

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

mypy/checker.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,9 @@ def check_method_or_accessor_override_for_base(
20242024
if check_override_compatibility:
20252025
# Check compatibility of the override signature
20262026
# (__init__, __new__, __init_subclass__ are special).
2027-
if self.check_method_override_for_base_with_name(defn, name, base, first_baseclass):
2027+
if self.check_method_override_for_base_with_name(
2028+
defn, name, base, first_baseclass
2029+
):
20282030
return None
20292031
if name in operators.inplace_operator_methods:
20302032
# Figure out the name of the corresponding operator method.
@@ -2033,12 +2035,18 @@ def check_method_or_accessor_override_for_base(
20332035
# always introduced safely if a base class defined __add__.
20342036
# TODO can't come up with an example where this is
20352037
# necessary; now it's "just in case"
2036-
if self.check_method_override_for_base_with_name(defn, method, base, first_baseclass):
2038+
if self.check_method_override_for_base_with_name(
2039+
defn, method, base, first_baseclass
2040+
):
20372041
return None
20382042
return found_base_method
20392043

20402044
def check_method_override_for_base_with_name(
2041-
self, defn: FuncDef | OverloadedFuncDef | Decorator, name: str, base: TypeInfo, first_baseclass: bool
2045+
self,
2046+
defn: FuncDef | OverloadedFuncDef | Decorator,
2047+
name: str,
2048+
base: TypeInfo,
2049+
first_baseclass: bool,
20422050
) -> bool:
20432051
"""Check if overriding an attribute `name` of `base` with `defn` is valid.
20442052
@@ -2173,7 +2181,11 @@ def check_method_override_for_base_with_name(
21732181
f" override has type {override_str})"
21742182
)
21752183
self.fail(msg, context)
2176-
elif context.is_explicit_override and first_baseclass and not is_private(context.name):
2184+
elif (
2185+
context.is_explicit_override
2186+
and first_baseclass
2187+
and not is_private(context.name)
2188+
):
21772189
warn = self.fail if self.options.report_deprecated_as_error else self.note
21782190
warn(deprecated, context, code=codes.DEPRECATED)
21792191
elif isinstance(original_type, UnionType) and any(

0 commit comments

Comments
 (0)