@@ -51,8 +51,8 @@ def format(self, *args: object, **kwargs: object) -> "ErrorMessage":
51
51
YIELD_VALUE_EXPECTED : Final = ErrorMessage ("Yield value expected" )
52
52
INCOMPATIBLE_TYPES : Final = "Incompatible types"
53
53
INCOMPATIBLE_TYPES_IN_ASSIGNMENT : Final = "Incompatible types in assignment"
54
+ INCOMPATIBLE_TYPES_IN_AWAIT : Final = ErrorMessage ('Incompatible types in "await"' )
54
55
INCOMPATIBLE_REDEFINITION : Final = ErrorMessage ("Incompatible redefinition" )
55
- INCOMPATIBLE_TYPES_IN_AWAIT : Final = 'Incompatible types in "await"'
56
56
INCOMPATIBLE_TYPES_IN_ASYNC_WITH_AENTER : Final = (
57
57
'Incompatible types in "async with" for "__aenter__"'
58
58
)
@@ -61,14 +61,14 @@ def format(self, *args: object, **kwargs: object) -> "ErrorMessage":
61
61
)
62
62
INCOMPATIBLE_TYPES_IN_ASYNC_FOR : Final = 'Incompatible types in "async for"'
63
63
64
- INCOMPATIBLE_TYPES_IN_YIELD : Final = 'Incompatible types in "yield"'
65
- INCOMPATIBLE_TYPES_IN_YIELD_FROM : Final = 'Incompatible types in "yield from"'
64
+ INCOMPATIBLE_TYPES_IN_YIELD : Final = ErrorMessage ( 'Incompatible types in "yield"' )
65
+ INCOMPATIBLE_TYPES_IN_YIELD_FROM : Final = ErrorMessage ( 'Incompatible types in "yield from"' )
66
66
INCOMPATIBLE_TYPES_IN_STR_INTERPOLATION : Final = "Incompatible types in string interpolation"
67
67
MUST_HAVE_NONE_RETURN_TYPE : Final = ErrorMessage ('The return type of "{}" must be None' )
68
- INVALID_TUPLE_INDEX_TYPE : Final = "Invalid tuple index type"
69
- TUPLE_INDEX_OUT_OF_RANGE : Final = "Tuple index out of range"
70
- INVALID_SLICE_INDEX : Final = "Slice index must be an integer or None"
71
- CANNOT_INFER_LAMBDA_TYPE : Final = "Cannot infer type of lambda"
68
+ INVALID_TUPLE_INDEX_TYPE : Final = ErrorMessage ( "Invalid tuple index type" )
69
+ TUPLE_INDEX_OUT_OF_RANGE : Final = ErrorMessage ( "Tuple index out of range" )
70
+ INVALID_SLICE_INDEX : Final = ErrorMessage ( "Slice index must be an integer or None" )
71
+ CANNOT_INFER_LAMBDA_TYPE : Final = ErrorMessage ( "Cannot infer type of lambda" )
72
72
CANNOT_ACCESS_INIT : Final = 'Cannot access "__init__" directly'
73
73
NON_INSTANCE_NEW_TYPE : Final = ErrorMessage ('"__new__" must return a class instance (got {})' )
74
74
INVALID_NEW_TYPE : Final = ErrorMessage ('Incompatible return type for "__new__"' )
@@ -102,14 +102,16 @@ def format(self, *args: object, **kwargs: object) -> "ErrorMessage":
102
102
ARGUMENT_TYPE_EXPECTED : Final = ErrorMessage (
103
103
"Function is missing a type annotation for one or more arguments" , codes .NO_UNTYPED_DEF
104
104
)
105
- KEYWORD_ARGUMENT_REQUIRES_STR_KEY_TYPE : Final = (
105
+ KEYWORD_ARGUMENT_REQUIRES_STR_KEY_TYPE : Final = ErrorMessage (
106
106
'Keyword argument only valid with "str" key type in call to "dict"'
107
107
)
108
108
ALL_MUST_BE_SEQ_STR : Final = ErrorMessage ("Type of __all__ must be {}, not {}" )
109
- INVALID_TYPEDDICT_ARGS : Final = (
109
+ INVALID_TYPEDDICT_ARGS : Final = ErrorMessage (
110
110
"Expected keyword arguments, {...}, or dict(...) in TypedDict constructor"
111
111
)
112
- TYPEDDICT_KEY_MUST_BE_STRING_LITERAL : Final = "Expected TypedDict key to be string literal"
112
+ TYPEDDICT_KEY_MUST_BE_STRING_LITERAL : Final = ErrorMessage (
113
+ "Expected TypedDict key to be string literal"
114
+ )
113
115
MALFORMED_ASSERT : Final = ErrorMessage ("Assertion is always true, perhaps remove parentheses?" )
114
116
DUPLICATE_TYPE_SIGNATURES : Final = "Function has duplicate type signatures"
115
117
DESCRIPTOR_SET_NOT_CALLABLE : Final = ErrorMessage ("{}.__set__ is not callable" )
@@ -160,17 +162,23 @@ def format(self, *args: object, **kwargs: object) -> "ErrorMessage":
160
162
TYPEVAR_UNEXPECTED_ARGUMENT : Final = 'Unexpected argument to "TypeVar()"'
161
163
162
164
# Super
163
- TOO_MANY_ARGS_FOR_SUPER : Final = 'Too many arguments for "super"'
164
- TOO_FEW_ARGS_FOR_SUPER : Final = 'Too few arguments for "super"'
165
- SUPER_WITH_SINGLE_ARG_NOT_SUPPORTED : Final = '"super" with a single argument not supported'
166
- UNSUPPORTED_ARG_1_FOR_SUPER : Final = 'Unsupported argument 1 for "super"'
167
- UNSUPPORTED_ARG_2_FOR_SUPER : Final = 'Unsupported argument 2 for "super"'
168
- SUPER_VARARGS_NOT_SUPPORTED : Final = 'Varargs not supported with "super"'
169
- SUPER_POSITIONAL_ARGS_REQUIRED : Final = '"super" only accepts positional arguments'
170
- SUPER_ARG_2_NOT_INSTANCE_OF_ARG_1 : Final = 'Argument 2 for "super" not an instance of argument 1'
171
- TARGET_CLASS_HAS_NO_BASE_CLASS : Final = "Target class has no base class"
172
- SUPER_OUTSIDE_OF_METHOD_NOT_SUPPORTED : Final = "super() outside of a method is not supported"
173
- SUPER_ENCLOSING_POSITIONAL_ARGS_REQUIRED : Final = (
165
+ TOO_MANY_ARGS_FOR_SUPER : Final = ErrorMessage ('Too many arguments for "super"' )
166
+ TOO_FEW_ARGS_FOR_SUPER : Final = ErrorMessage ('Too few arguments for "super"' , codes .CALL_ARG )
167
+ SUPER_WITH_SINGLE_ARG_NOT_SUPPORTED : Final = ErrorMessage (
168
+ '"super" with a single argument not supported'
169
+ )
170
+ UNSUPPORTED_ARG_1_FOR_SUPER : Final = ErrorMessage ('Unsupported argument 1 for "super"' )
171
+ UNSUPPORTED_ARG_2_FOR_SUPER : Final = ErrorMessage ('Unsupported argument 2 for "super"' )
172
+ SUPER_VARARGS_NOT_SUPPORTED : Final = ErrorMessage ('Varargs not supported with "super"' )
173
+ SUPER_POSITIONAL_ARGS_REQUIRED : Final = ErrorMessage ('"super" only accepts positional arguments' )
174
+ SUPER_ARG_2_NOT_INSTANCE_OF_ARG_1 : Final = ErrorMessage (
175
+ 'Argument 2 for "super" not an instance of argument 1'
176
+ )
177
+ TARGET_CLASS_HAS_NO_BASE_CLASS : Final = ErrorMessage ("Target class has no base class" )
178
+ SUPER_OUTSIDE_OF_METHOD_NOT_SUPPORTED : Final = ErrorMessage (
179
+ "super() outside of a method is not supported"
180
+ )
181
+ SUPER_ENCLOSING_POSITIONAL_ARGS_REQUIRED : Final = ErrorMessage (
174
182
"super() requires one or more positional arguments in enclosing function"
175
183
)
176
184
@@ -210,6 +218,9 @@ def format(self, *args: object, **kwargs: object) -> "ErrorMessage":
210
218
"Only @runtime_checkable protocols can be used with instance and class checks"
211
219
)
212
220
CANNOT_INSTANTIATE_PROTOCOL : Final = ErrorMessage ('Cannot instantiate protocol class "{}"' )
221
+ TOO_MANY_UNION_COMBINATIONS : Final = ErrorMessage (
222
+ "Not all union combinations were tried because there are too many unions"
223
+ )
213
224
214
225
CONTIGUOUS_ITERABLE_EXPECTED : Final = ErrorMessage ("Contiguous iterable with same type expected" )
215
226
ITERABLE_TYPE_EXPECTED : Final = ErrorMessage ("Invalid type '{}' for *expr (iterable expected)" )
0 commit comments