Skip to content

Commit 5cc51a7

Browse files
Merge branch 'messages-messages' into final
2 parents fa8f099 + 01f0bc8 commit 5cc51a7

File tree

3 files changed

+517
-279
lines changed

3 files changed

+517
-279
lines changed

mypy/errorcodes.py

+23-21
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ def __str__(self) -> str:
3535
CALL_ARG: Final[ErrorCode] = ErrorCode(
3636
"call-arg", "Check number, names and kinds of arguments in calls", "General"
3737
)
38-
ARG_TYPE: Final = ErrorCode("arg-type", "Check argument types in calls", "General")
38+
ARG_TYPE: Final[ErrorCode] = ErrorCode("arg-type", "Check argument types in calls", "General")
3939
CALL_OVERLOAD: Final = ErrorCode(
4040
"call-overload", "Check that an overload variant matches arguments", "General"
4141
)
4242
VALID_TYPE: Final[ErrorCode] = ErrorCode(
4343
"valid-type", "Check that type (annotation) is valid", "General"
4444
)
45-
VAR_ANNOTATED: Final = ErrorCode(
45+
VAR_ANNOTATED: Final[ErrorCode] = ErrorCode(
4646
"var-annotated", "Require variable annotation if type can't be inferred", "General"
4747
)
48-
OVERRIDE: Final = ErrorCode(
48+
OVERRIDE: Final[ErrorCode] = ErrorCode(
4949
"override", "Check that method override is compatible with base class", "General"
5050
)
5151
RETURN: Final[ErrorCode] = ErrorCode(
@@ -54,28 +54,30 @@ def __str__(self) -> str:
5454
RETURN_VALUE: Final[ErrorCode] = ErrorCode(
5555
"return-value", "Check that return value is compatible with signature", "General"
5656
)
57-
ASSIGNMENT: Final = ErrorCode(
57+
ASSIGNMENT: Final[ErrorCode] = ErrorCode(
5858
"assignment", "Check that assigned value is compatible with target", "General"
5959
)
6060
TYPE_ARG: Final[ErrorCode] = ErrorCode(
6161
"type-arg", "Check that generic type arguments are present", "General"
6262
)
6363
TYPE_VAR: Final = ErrorCode("type-var", "Check that type variable values are valid", "General")
64-
UNION_ATTR: Final = ErrorCode(
64+
UNION_ATTR: Final[ErrorCode] = ErrorCode(
6565
"union-attr", "Check that attribute exists in each item of a union", "General"
6666
)
67-
INDEX: Final = ErrorCode("index", "Check indexing operations", "General")
68-
OPERATOR: Final = ErrorCode("operator", "Check that operator is valid for operands", "General")
69-
LIST_ITEM: Final = ErrorCode(
67+
INDEX: Final[ErrorCode] = ErrorCode("index", "Check indexing operations", "General")
68+
OPERATOR: Final[ErrorCode] = ErrorCode(
69+
"operator", "Check that operator is valid for operands", "General"
70+
)
71+
LIST_ITEM: Final[ErrorCode] = ErrorCode(
7072
"list-item", "Check list items in a list expression [item, ...]", "General"
7173
)
72-
DICT_ITEM: Final = ErrorCode(
74+
DICT_ITEM: Final[ErrorCode] = ErrorCode(
7375
"dict-item", "Check dict items in a dict expression {key: value, ...}", "General"
7476
)
75-
TYPEDDICT_ITEM: Final = ErrorCode(
77+
TYPEDDICT_ITEM: Final[ErrorCode] = ErrorCode(
7678
"typeddict-item", "Check items when constructing TypedDict", "General"
7779
)
78-
HAS_TYPE: Final = ErrorCode(
80+
HAS_TYPE: Final[ErrorCode] = ErrorCode(
7981
"has-type", "Check that type of reference can be determined", "General"
8082
)
8183
IMPORT: Final = ErrorCode(
@@ -84,10 +86,10 @@ def __str__(self) -> str:
8486
NO_REDEF: Final[ErrorCode] = ErrorCode(
8587
"no-redef", "Check that each name is defined once", "General"
8688
)
87-
FUNC_RETURNS_VALUE: Final = ErrorCode(
89+
FUNC_RETURNS_VALUE: Final[ErrorCode] = ErrorCode(
8890
"func-returns-value", "Check that called function returns a value in value context", "General"
8991
)
90-
ABSTRACT: Final = ErrorCode(
92+
ABSTRACT: Final[ErrorCode] = ErrorCode(
9193
"abstract", "Prevent instantiation of classes with abstract attributes", "General"
9294
)
9395
VALID_NEWTYPE: Final[ErrorCode] = ErrorCode(
@@ -99,7 +101,7 @@ def __str__(self) -> str:
99101
STR_BYTES_PY3: Final[ErrorCode] = ErrorCode(
100102
"str-bytes-safe", "Warn about dangerous coercions related to bytes and string types", "General"
101103
)
102-
EXIT_RETURN: Final = ErrorCode(
104+
EXIT_RETURN: Final[ErrorCode] = ErrorCode(
103105
"exit-return", "Warn about too general return type for '__exit__'", "General"
104106
)
105107
LITERAL_REQ: Final = ErrorCode(
@@ -110,29 +112,29 @@ def __str__(self) -> str:
110112
NO_UNTYPED_DEF: Final[ErrorCode] = ErrorCode(
111113
"no-untyped-def", "Check that every function has an annotation", "General"
112114
)
113-
NO_UNTYPED_CALL: Final = ErrorCode(
115+
NO_UNTYPED_CALL: Final[ErrorCode] = ErrorCode(
114116
"no-untyped-call",
115117
"Disallow calling functions without type annotations from annotated functions",
116118
"General",
117119
)
118-
REDUNDANT_CAST: Final = ErrorCode(
120+
REDUNDANT_CAST: Final[ErrorCode] = ErrorCode(
119121
"redundant-cast", "Check that cast changes type of expression", "General"
120122
)
121-
COMPARISON_OVERLAP: Final = ErrorCode(
123+
COMPARISON_OVERLAP: Final[ErrorCode] = ErrorCode(
122124
"comparison-overlap", "Check that types in comparisons and 'in' expressions overlap", "General"
123125
)
124-
NO_ANY_UNIMPORTED: Final = ErrorCode(
126+
NO_ANY_UNIMPORTED: Final[ErrorCode] = ErrorCode(
125127
"no-any-unimported", 'Reject "Any" types from unfollowed imports', "General"
126128
)
127-
NO_ANY_RETURN: Final = ErrorCode(
129+
NO_ANY_RETURN: Final[ErrorCode] = ErrorCode(
128130
"no-any-return",
129131
'Reject returning value with "Any" type if return type is not "Any"',
130132
"General",
131133
)
132-
UNREACHABLE: Final = ErrorCode(
134+
UNREACHABLE: Final[ErrorCode] = ErrorCode(
133135
"unreachable", "Warn about unreachable statements or expressions", "General"
134136
)
135-
REDUNDANT_EXPR: Final = ErrorCode(
137+
REDUNDANT_EXPR: Final[ErrorCode] = ErrorCode(
136138
"redundant-expr", "Warn about redundant expressions", "General", default_enabled=False
137139
)
138140
TRUTHY_BOOL: Final[ErrorCode] = ErrorCode(

0 commit comments

Comments
 (0)