Skip to content

Commit 250e171

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 49ee7a8 commit 250e171

File tree

4 files changed

+11
-19
lines changed

4 files changed

+11
-19
lines changed

mypy/checker.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4680,9 +4680,8 @@ def visit_operator_assignment_stmt(self, s: OperatorAssignmentStmt) -> None:
46804680
if inplace:
46814681
# There is __ifoo__, treat as x = x.__ifoo__(y)
46824682
rvalue_type, method_type = self.expr_checker.check_op(method, lvalue_type, s.rvalue, s)
4683-
if (
4684-
isinstance(inst := get_proper_type(lvalue_type), Instance)
4685-
and isinstance(defn := inst.type.get_method(method), OverloadedFuncDef)
4683+
if isinstance(inst := get_proper_type(lvalue_type), Instance) and isinstance(
4684+
defn := inst.type.get_method(method), OverloadedFuncDef
46864685
):
46874686
for item in defn.items:
46884687
if (
@@ -7547,9 +7546,8 @@ def check_deprecated(self, typ: SymbolNode | None, context: Context) -> None:
75477546
"""Warn if deprecated and not directly imported with a `from` statement."""
75487547
if isinstance(typ, Decorator):
75497548
typ = typ.func
7550-
if (
7551-
isinstance(typ, (FuncDef, OverloadedFuncDef, TypeInfo))
7552-
and (typ.deprecated is not None)
7549+
if isinstance(typ, (FuncDef, OverloadedFuncDef, TypeInfo)) and (
7550+
typ.deprecated is not None
75537551
):
75547552
for imp in self.tree.imports:
75557553
if isinstance(imp, ImportFrom) and any(typ.name == n[0] for n in imp.names):
@@ -7561,9 +7559,8 @@ def warn_deprecated(self, typ: SymbolNode | None, context: Context) -> None:
75617559
"""Warn if deprecated."""
75627560
if isinstance(typ, Decorator):
75637561
typ = typ.func
7564-
if (
7565-
isinstance(typ, (FuncDef, OverloadedFuncDef, TypeInfo))
7566-
and ((deprecated := typ.deprecated) is not None)
7562+
if isinstance(typ, (FuncDef, OverloadedFuncDef, TypeInfo)) and (
7563+
(deprecated := typ.deprecated) is not None
75677564
):
75687565
warn = self.msg.fail if self.options.report_deprecated_as_error else self.msg.note
75697566
warn(deprecated, context, code=codes.DEPRECATED)

mypy/checkexpr.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4005,9 +4005,8 @@ def lookup_definer(typ: Instance, attr_name: str) -> str | None:
40054005
errors.append(local_errors.filtered_errors())
40064006
results.append(result)
40074007
else:
4008-
if (
4009-
isinstance(obj, Instance)
4010-
and isinstance(defn := obj.type.get_method(name), OverloadedFuncDef)
4008+
if isinstance(obj, Instance) and isinstance(
4009+
defn := obj.type.get_method(name), OverloadedFuncDef
40114010
):
40124011
for item in defn.items:
40134012
if (

mypy/semanal.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,9 +1265,8 @@ def process_deprecated_overload(self, defn: OverloadedFuncDef) -> None:
12651265
if defn.is_property:
12661266
return
12671267

1268-
if (
1269-
isinstance(impl := defn.impl, Decorator)
1270-
and ((deprecated := impl.func.deprecated) is not None)
1268+
if isinstance(impl := defn.impl, Decorator) and (
1269+
(deprecated := impl.func.deprecated) is not None
12711270
):
12721271
defn.deprecated = deprecated
12731272
for item in defn.items:

mypy/types.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2332,10 +2332,7 @@ def __eq__(self, other: object) -> bool:
23322332
return self.items == other.items
23332333

23342334
def serialize(self) -> JsonDict:
2335-
return {
2336-
".class": "Overloaded",
2337-
"items": [t.serialize() for t in self.items],
2338-
}
2335+
return {".class": "Overloaded", "items": [t.serialize() for t in self.items]}
23392336

23402337
@classmethod
23412338
def deserialize(cls, data: JsonDict) -> Overloaded:

0 commit comments

Comments
 (0)