Skip to content

Commit 92d6ea2

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 7a63c15 commit 92d6ea2

File tree

1 file changed

+81
-32
lines changed

1 file changed

+81
-32
lines changed

mypy/messages.py

Lines changed: 81 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,84 @@
1616
import re
1717
from contextlib import contextmanager
1818
from textwrap import dedent
19-
from typing import (Any, Callable, Collection, Final, Iterable, Iterator, List,
20-
Sequence, cast)
19+
from typing import Any, Callable, Collection, Final, Iterable, Iterator, List, Sequence, cast
2120

2221
import mypy.typeops
23-
from mypy import errorcodes as codes
24-
from mypy import message_registry
22+
from mypy import errorcodes as codes, message_registry
2523
from mypy.erasetype import erase_type
2624
from mypy.errorcodes import ErrorCode
2725
from mypy.errors import ErrorInfo, Errors, ErrorWatcher
28-
from mypy.nodes import (ARG_NAMED, ARG_NAMED_OPT, ARG_OPT, ARG_POS, ARG_STAR,
29-
ARG_STAR2, CONTRAVARIANT, COVARIANT,
30-
SYMBOL_FUNCBASE_TYPES, ArgKind, CallExpr, ClassDef,
31-
Context, Expression, FuncDef, IndexExpr, MypyFile,
32-
NameExpr, ReturnStmt, StrExpr, SymbolNode, SymbolTable,
33-
TypeInfo, Var, reverse_builtin_aliases)
26+
from mypy.nodes import (
27+
ARG_NAMED,
28+
ARG_NAMED_OPT,
29+
ARG_OPT,
30+
ARG_POS,
31+
ARG_STAR,
32+
ARG_STAR2,
33+
CONTRAVARIANT,
34+
COVARIANT,
35+
SYMBOL_FUNCBASE_TYPES,
36+
ArgKind,
37+
CallExpr,
38+
ClassDef,
39+
Context,
40+
Expression,
41+
FuncDef,
42+
IndexExpr,
43+
MypyFile,
44+
NameExpr,
45+
ReturnStmt,
46+
StrExpr,
47+
SymbolNode,
48+
SymbolTable,
49+
TypeInfo,
50+
Var,
51+
reverse_builtin_aliases,
52+
)
3453
from mypy.operators import op_methods, op_methods_to_symbols
3554
from mypy.options import Options
36-
from mypy.subtypes import (IS_CLASS_OR_STATIC, IS_CLASSVAR, IS_SETTABLE,
37-
IS_VAR, find_member, get_member_flags, is_same_type,
38-
is_subtype)
55+
from mypy.subtypes import (
56+
IS_CLASS_OR_STATIC,
57+
IS_CLASSVAR,
58+
IS_SETTABLE,
59+
IS_VAR,
60+
find_member,
61+
get_member_flags,
62+
is_same_type,
63+
is_subtype,
64+
)
3965
from mypy.typeops import separate_union_literals
40-
from mypy.types import (AnyType, CallableType, DeletedType, FunctionLike,
41-
Instance, LiteralType, NoneType, Overloaded,
42-
Parameters, ParamSpecType, PartialType, ProperType,
43-
TupleType, Type, TypeAliasType, TypedDictType,
44-
TypeOfAny, TypeStrVisitor, TypeType, TypeVarLikeType,
45-
TypeVarTupleType, TypeVarType, UnboundType,
46-
UninhabitedType, UnionType, UnpackType,
47-
flatten_nested_unions, get_proper_type,
48-
get_proper_types)
66+
from mypy.types import (
67+
AnyType,
68+
CallableType,
69+
DeletedType,
70+
FunctionLike,
71+
Instance,
72+
LiteralType,
73+
NoneType,
74+
Overloaded,
75+
Parameters,
76+
ParamSpecType,
77+
PartialType,
78+
ProperType,
79+
TupleType,
80+
Type,
81+
TypeAliasType,
82+
TypedDictType,
83+
TypeOfAny,
84+
TypeStrVisitor,
85+
TypeType,
86+
TypeVarLikeType,
87+
TypeVarTupleType,
88+
TypeVarType,
89+
UnboundType,
90+
UninhabitedType,
91+
UnionType,
92+
UnpackType,
93+
flatten_nested_unions,
94+
get_proper_type,
95+
get_proper_types,
96+
)
4997
from mypy.typetraverser import TypeTraverserVisitor
5098
from mypy.util import plural_s, unmangle
5199

@@ -1990,9 +2038,14 @@ def report_non_method_protocol(
19902038
def note_call(
19912039
self, subtype: Type, call: Type, context: Context, *, code: ErrorCode | None
19922040
) -> None:
1993-
self.note('"{}.__call__" has type {}'.format(
1994-
format_type_bare(subtype, self.options), format_type(call, self.options, verbosity=1)
1995-
),context, code=code)
2041+
self.note(
2042+
'"{}.__call__" has type {}'.format(
2043+
format_type_bare(subtype, self.options),
2044+
format_type(call, self.options, verbosity=1),
2045+
),
2046+
context,
2047+
code=code,
2048+
)
19962049

19972050
def unreachable_statement(self, context: Context) -> None:
19982051
self.fail("Statement is unreachable", context, code=codes.UNREACHABLE)
@@ -2104,14 +2157,10 @@ def report_protocol_problems(
21042157
if subtype.extra_attrs and subtype.extra_attrs.mod_name:
21052158
is_module = True
21062159

2107-
#show signature of call for supertype
2108-
call = find_member("__call__",supertype,supertype)
2160+
# show signature of call for supertype
2161+
call = find_member("__call__", supertype, supertype)
21092162
if call:
2110-
self.note_call(
2111-
supertype,call,context,code=code
2112-
)
2113-
2114-
2163+
self.note_call(supertype, call, context, code=code)
21152164

21162165
# Report missing members
21172166
missing = get_missing_protocol_members(subtype, supertype, skip=skip)

0 commit comments

Comments
 (0)