@@ -52,32 +52,28 @@ def __hash__(self) -> int:
52
52
53
53
ATTR_DEFINED : Final = ErrorCode ("attr-defined" , "Check that attribute exists" , "General" )
54
54
NAME_DEFINED : Final = ErrorCode ("name-defined" , "Check that name is defined" , "General" )
55
- CALL_ARG : Final [ ErrorCode ] = ErrorCode (
55
+ CALL_ARG : Final = ErrorCode (
56
56
"call-arg" , "Check number, names and kinds of arguments in calls" , "General"
57
57
)
58
58
ARG_TYPE : Final = ErrorCode ("arg-type" , "Check argument types in calls" , "General" )
59
59
CALL_OVERLOAD : Final = ErrorCode (
60
60
"call-overload" , "Check that an overload variant matches arguments" , "General"
61
61
)
62
- VALID_TYPE : Final [ErrorCode ] = ErrorCode (
63
- "valid-type" , "Check that type (annotation) is valid" , "General"
64
- )
62
+ VALID_TYPE : Final = ErrorCode ("valid-type" , "Check that type (annotation) is valid" , "General" )
65
63
VAR_ANNOTATED : Final = ErrorCode (
66
64
"var-annotated" , "Require variable annotation if type can't be inferred" , "General"
67
65
)
68
66
OVERRIDE : Final = ErrorCode (
69
67
"override" , "Check that method override is compatible with base class" , "General"
70
68
)
71
- RETURN : Final [ErrorCode ] = ErrorCode (
72
- "return" , "Check that function always returns a value" , "General"
73
- )
74
- RETURN_VALUE : Final [ErrorCode ] = ErrorCode (
69
+ RETURN : Final = ErrorCode ("return" , "Check that function always returns a value" , "General" )
70
+ RETURN_VALUE : Final = ErrorCode (
75
71
"return-value" , "Check that return value is compatible with signature" , "General"
76
72
)
77
- ASSIGNMENT : Final [ ErrorCode ] = ErrorCode (
73
+ ASSIGNMENT : Final = ErrorCode (
78
74
"assignment" , "Check that assigned value is compatible with target" , "General"
79
75
)
80
- METHOD_ASSIGN : Final [ ErrorCode ] = ErrorCode (
76
+ METHOD_ASSIGN : Final = ErrorCode (
81
77
"method-assign" ,
82
78
"Check that assignment target is not a method" ,
83
79
"General" ,
@@ -143,9 +139,7 @@ def __hash__(self) -> int:
143
139
UNUSED_COROUTINE : Final = ErrorCode (
144
140
"unused-coroutine" , "Ensure that all coroutines are used" , "General"
145
141
)
146
- # TODO: why do we need the explicit type here? Without it mypyc CI builds fail with
147
- # mypy/message_registry.py:37: error: Cannot determine type of "EMPTY_BODY" [has-type]
148
- EMPTY_BODY : Final [ErrorCode ] = ErrorCode (
142
+ EMPTY_BODY : Final = ErrorCode (
149
143
"empty-body" ,
150
144
"A dedicated error code to opt out return errors for empty/trivial bodies" ,
151
145
"General" ,
@@ -160,7 +154,7 @@ def __hash__(self) -> int:
160
154
"await-not-async" , 'Warn about "await" outside coroutine ("async def")' , "General"
161
155
)
162
156
# These error codes aren't enabled by default.
163
- NO_UNTYPED_DEF : Final [ ErrorCode ] = ErrorCode (
157
+ NO_UNTYPED_DEF : Final = ErrorCode (
164
158
"no-untyped-def" , "Check that every function has an annotation" , "General"
165
159
)
166
160
NO_UNTYPED_CALL : Final = ErrorCode (
@@ -186,13 +180,13 @@ def __hash__(self) -> int:
186
180
UNREACHABLE : Final = ErrorCode (
187
181
"unreachable" , "Warn about unreachable statements or expressions" , "General"
188
182
)
189
- ANNOTATION_UNCHECKED = ErrorCode (
183
+ ANNOTATION_UNCHECKED : Final = ErrorCode (
190
184
"annotation-unchecked" , "Notify about type annotations in unchecked functions" , "General"
191
185
)
192
- TYPEDDICT_READONLY_MUTATED = ErrorCode (
186
+ TYPEDDICT_READONLY_MUTATED : Final = ErrorCode (
193
187
"typeddict-readonly-mutated" , "TypedDict's ReadOnly key is mutated" , "General"
194
188
)
195
- POSSIBLY_UNDEFINED : Final [ ErrorCode ] = ErrorCode (
189
+ POSSIBLY_UNDEFINED : Final = ErrorCode (
196
190
"possibly-undefined" ,
197
191
"Warn about variables that are defined only in some execution paths" ,
198
192
"General" ,
@@ -201,18 +195,18 @@ def __hash__(self) -> int:
201
195
REDUNDANT_EXPR : Final = ErrorCode (
202
196
"redundant-expr" , "Warn about redundant expressions" , "General" , default_enabled = False
203
197
)
204
- TRUTHY_BOOL : Final [ ErrorCode ] = ErrorCode (
198
+ TRUTHY_BOOL : Final = ErrorCode (
205
199
"truthy-bool" ,
206
200
"Warn about expressions that could always evaluate to true in boolean contexts" ,
207
201
"General" ,
208
202
default_enabled = False ,
209
203
)
210
- TRUTHY_FUNCTION : Final [ ErrorCode ] = ErrorCode (
204
+ TRUTHY_FUNCTION : Final = ErrorCode (
211
205
"truthy-function" ,
212
206
"Warn about function that always evaluate to true in boolean contexts" ,
213
207
"General" ,
214
208
)
215
- TRUTHY_ITERABLE : Final [ ErrorCode ] = ErrorCode (
209
+ TRUTHY_ITERABLE : Final = ErrorCode (
216
210
"truthy-iterable" ,
217
211
"Warn about Iterable expressions that could always evaluate to true in boolean contexts" ,
218
212
"General" ,
@@ -238,13 +232,13 @@ def __hash__(self) -> int:
238
232
"General" ,
239
233
default_enabled = False ,
240
234
)
241
- REDUNDANT_SELF_TYPE = ErrorCode (
235
+ REDUNDANT_SELF_TYPE : Final = ErrorCode (
242
236
"redundant-self" ,
243
237
"Warn about redundant Self type annotations on method first argument" ,
244
238
"General" ,
245
239
default_enabled = False ,
246
240
)
247
- USED_BEFORE_DEF : Final [ ErrorCode ] = ErrorCode (
241
+ USED_BEFORE_DEF : Final = ErrorCode (
248
242
"used-before-def" , "Warn about variables that are used before they are defined" , "General"
249
243
)
250
244
UNUSED_IGNORE : Final = ErrorCode (
@@ -262,7 +256,7 @@ def __hash__(self) -> int:
262
256
"General" ,
263
257
default_enabled = False ,
264
258
)
265
- MUTABLE_OVERRIDE : Final [ ErrorCode ] = ErrorCode (
259
+ MUTABLE_OVERRIDE : Final = ErrorCode (
266
260
"mutable-override" ,
267
261
"Reject covariant overrides for mutable attributes" ,
268
262
"General" ,
@@ -274,42 +268,41 @@ def __hash__(self) -> int:
274
268
"General" ,
275
269
default_enabled = False ,
276
270
)
277
- METACLASS : Final [ ErrorCode ] = ErrorCode ("metaclass" , "Ensure that metaclass is valid" , "General" )
271
+ METACLASS : Final = ErrorCode ("metaclass" , "Ensure that metaclass is valid" , "General" )
278
272
279
273
# Syntax errors are often blocking.
280
- SYNTAX : Final [ ErrorCode ] = ErrorCode ("syntax" , "Report syntax errors" , "General" )
274
+ SYNTAX : Final = ErrorCode ("syntax" , "Report syntax errors" , "General" )
281
275
282
276
# This is an internal marker code for a whole-file ignore. It is not intended to
283
277
# be user-visible.
284
278
FILE : Final = ErrorCode ("file" , "Internal marker for a whole file being ignored" , "General" )
285
279
del error_codes [FILE .code ]
286
280
287
281
# This is a catch-all for remaining uncategorized errors.
288
- MISC : Final [ ErrorCode ] = ErrorCode ("misc" , "Miscellaneous other checks" , "General" )
282
+ MISC : Final = ErrorCode ("misc" , "Miscellaneous other checks" , "General" )
289
283
290
- OVERLOAD_CANNOT_MATCH : Final [ ErrorCode ] = ErrorCode (
284
+ OVERLOAD_CANNOT_MATCH : Final = ErrorCode (
291
285
"overload-cannot-match" ,
292
286
"Warn if an @overload signature can never be matched" ,
293
287
"General" ,
294
288
sub_code_of = MISC ,
295
289
)
296
290
297
-
298
- OVERLOAD_OVERLAP : Final [ErrorCode ] = ErrorCode (
291
+ OVERLOAD_OVERLAP : Final = ErrorCode (
299
292
"overload-overlap" ,
300
293
"Warn if multiple @overload variants overlap in unsafe ways" ,
301
294
"General" ,
302
295
sub_code_of = MISC ,
303
296
)
304
297
305
- PROPERTY_DECORATOR = ErrorCode (
298
+ PROPERTY_DECORATOR : Final = ErrorCode (
306
299
"prop-decorator" ,
307
300
"Decorators on top of @property are not supported" ,
308
301
"General" ,
309
302
sub_code_of = MISC ,
310
303
)
311
304
312
- NARROWED_TYPE_NOT_SUBTYPE : Final [ ErrorCode ] = ErrorCode (
305
+ NARROWED_TYPE_NOT_SUBTYPE : Final = ErrorCode (
313
306
"narrowed-type-not-subtype" ,
314
307
"Warn if a TypeIs function's narrowed type is not a subtype of the original type" ,
315
308
"General" ,
0 commit comments