class documentation

class MessageBuilder: (source)

View In Hierarchy

Helper class for reporting type checker error messages with parameters.

The methods of this class need to be provided with the context within a file; the errors member manages the wider context.

IDEA: Support a 'verbose mode' that includes full information about types
in error messages and that may otherwise produce more detailed error messages.
Method __init__ Undocumented
Method add​_errors Add errors in messages to this builder.
Method add​_fixture​_note Undocumented
Method argument​_incompatible​_with​_supertype Undocumented
Method bad​_proto​_variance Undocumented
Method base​_class​_definitions​_incompatible Undocumented
Method cannot​_determine​_type Undocumented
Method cannot​_determine​_type​_in​_base Undocumented
Method cannot​_instantiate​_abstract​_class Undocumented
Method cannot​_use​_function​_with​_type Undocumented
Method cant​_assign​_to​_classvar Undocumented
Method cant​_assign​_to​_final Warn about a prohibited assignment to a final attribute.
Method cant​_assign​_to​_method Undocumented
Method cant​_override​_final Undocumented
Method clean​_copy Undocumented
Method comparison​_method​_example​_msg Undocumented
Method concrete​_only​_assign Undocumented
Method concrete​_only​_call Undocumented
Method copy Undocumented
Method could​_not​_infer​_type​_arguments Undocumented
Method dangerous​_comparison Undocumented
Method deleted​_as​_lvalue Report an error about using an deleted type as an lvalue.
Method deleted​_as​_rvalue Report an error about using an deleted type as an rvalue.
Method disable​_errors Undocumented
Method disallowed​_any​_type Undocumented
Method does​_not​_return​_value Report an error about use of an unusable type.
Method duplicate​_argument​_value Undocumented
Method explicit​_any Undocumented
Method fail Report an error message (unless disabled).
Method final​_cant​_override​_writable Undocumented
Method final​_without​_value Undocumented
Method first​_argument​_for​_super​_must​_be​_type Undocumented
Method format​_long​_tuple​_type Format very long tuple type using an ellipsis notation
Method forward​_operator​_not​_callable Undocumented
Method generate​_incompatible​_tuple​_error Generate error message for individual incompatible tuple pairs
Method has​_no​_attr Report a missing or non-accessible member.
Method impossible​_intersection Undocumented
Method incompatible​_argument Report an error about an incompatible argument type.
Method incompatible​_argument​_note Undocumented
Method incompatible​_conditional​_function​_def Undocumented
Method incompatible​_operator​_assignment Undocumented
Method incompatible​_self​_argument Undocumented
Method incompatible​_type​_application Undocumented
Method incompatible​_typevar​_value Undocumented
Method incorrect​_​_exit​_​_return Undocumented
Method incorrectly​_returning​_any Undocumented
Method invalid​_index​_type Undocumented
Method invalid​_keyword​_var​_arg Undocumented
Method invalid​_signature Undocumented
Method invalid​_signature​_for​_special​_method Undocumented
Method invalid​_var​_arg Undocumented
Method is​_errors Undocumented
Method key​_not​_in​_mapping Undocumented
Method maybe​_note​_about​_special​_args Undocumented
Method missing​_named​_argument Undocumented
Method most​_recent​_context Return a dummy context matching the most recent generated error in current file.
Method need​_annotation​_for​_var Undocumented
Method no​_formal​_self Undocumented
Method no​_variant​_matches​_arguments Undocumented
Method not​_callable Undocumented
Method note Report a note (unless disabled).
Method note​_call Undocumented
Method note​_multiline Report as many notes as lines in the message (unless disabled).
Method operator​_method​_signatures​_overlap Undocumented
Method overload​_inconsistently​_applies​_decorator Undocumented
Method overload​_signature​_incompatible​_with​_supertype Undocumented
Method overloaded​_signature​_will​_never​_match Undocumented
Method overloaded​_signatures​_arg​_specific Undocumented
Method overloaded​_signatures​_overlap Undocumented
Method overloaded​_signatures​_ret​_specific Undocumented
Method overloaded​_signatures​_typevar​_specific Undocumented
Method override​_target Undocumented
Method pretty​_callable​_or​_overload Undocumented
Method pretty​_overload Undocumented
Method print​_more Undocumented
Method protocol​_members​_cant​_be​_final Undocumented
Method read​_only​_property Undocumented
Method redundant​_cast Undocumented
Method redundant​_condition​_in​_assert Undocumented
Method redundant​_condition​_in​_comprehension Undocumented
Method redundant​_condition​_in​_if Undocumented
Method redundant​_expr Undocumented
Method redundant​_left​_operand Indicates that the left operand of a boolean expression is redundant: it does not change the truth value of the entire condition as a whole. 'op_name' should either be the string "and" or the string "or".
Method report Report an error or note (unless disabled).
Method report​_non​_method​_protocol Undocumented
Method report​_protocol​_problems Report possible protocol conflicts between 'subtype' and 'supertype'.
Method requires​_int​_or​_char Undocumented
Method requires​_int​_or​_single​_byte Undocumented
Method return​_type​_incompatible​_with​_supertype Undocumented
Method reveal​_locals Undocumented
Method reveal​_type Undocumented
Method signature​_incompatible​_with​_supertype Undocumented
Method signatures​_incompatible Undocumented
Method string​_interpolation​_mixing​_key​_and​_non​_keys Undocumented
Method string​_interpolation​_with​_star​_and​_key Undocumented
Method too​_few​_arguments Undocumented
Method too​_few​_string​_formatting​_arguments Undocumented
Method too​_many​_arguments Undocumented
Method too​_many​_arguments​_from​_typed​_dict Undocumented
Method too​_many​_positional​_arguments Undocumented
Method too​_many​_string​_formatting​_arguments Undocumented
Method try​_report​_long​_tuple​_assignment​_error Try to generate meaningful error message for very long tuple assignment
Method type​_arguments​_not​_allowed Undocumented
Method type​_not​_iterable Undocumented
Method typed​_function​_untyped​_decorator Undocumented
Method typeddict​_context​_ambiguous Undocumented
Method typeddict​_key​_cannot​_be​_deleted Undocumented
Method typeddict​_key​_must​_be​_string​_literal Undocumented
Method typeddict​_key​_not​_found Undocumented
Method typeddict​_setdefault​_arguments​_inconsistent Undocumented
Method undefined​_in​_superclass Undocumented
Method underscore​_function​_call Undocumented
Method unexpected​_keyword​_argument Undocumented
Method unexpected​_typeddict​_keys Undocumented
Method unimported​_type​_becomes​_any Undocumented
Method unpacking​_strings​_disallowed Undocumented
Method unreachable​_right​_operand Indicates that the right operand of a boolean expression is redundant: it does not change the truth value of the entire condition as a whole. 'op_name' should either be the string "and" or the string "or".
Method unreachable​_statement Undocumented
Method unsupported​_left​_operand Undocumented
Method unsupported​_operand​_types Report unsupported operand types for a binary operation.
Method unsupported​_placeholder Undocumented
Method unsupported​_type​_type Undocumented
Method untyped​_decorated​_function Undocumented
Method untyped​_function​_call Undocumented
Method warn​_both​_operands​_are​_from​_unions Undocumented
Method warn​_operand​_was​_from​_union Undocumented
Method wrong​_number​_values​_to​_unpack Undocumented
Method yield​_from​_invalid​_operand​_type Undocumented
Instance Variable disable​_count Undocumented
Instance Variable disable​_type​_names Undocumented
Instance Variable errors Undocumented
Instance Variable modules Undocumented
def __init__(self, errors, modules): (source)

Undocumented

Parameters
errors:ErrorsUndocumented
modules:Dict[str, MypyFile]Undocumented
def add_errors(self, messages): (source)
Add errors in messages to this builder.
Parameters
messages:MessageBuilderUndocumented
def add_fixture_note(self, fullname, ctx): (source)

Undocumented

Parameters
fullname:strUndocumented
ctx:ContextUndocumented
def argument_incompatible_with_supertype(self, arg_num, name, type_name, name_in_supertype, arg_type_in_supertype, supertype, context): (source)

Undocumented

Parameters
arg​_num:intUndocumented
name:strUndocumented
type​_name:Optional[str]Undocumented
name​_in​_supertype:strUndocumented
arg​_type​_in​_supertype:TypeUndocumented
supertype:strUndocumented
context:ContextUndocumented
def bad_proto_variance(self, actual, tvar_name, expected, context): (source)

Undocumented

Parameters
actual:intUndocumented
tvar​_name:strUndocumented
expected:intUndocumented
context:ContextUndocumented
def base_class_definitions_incompatible(self, name, base1, base2, context): (source)

Undocumented

Parameters
name:strUndocumented
base1:TypeInfoUndocumented
base2:TypeInfoUndocumented
context:ContextUndocumented
def cannot_determine_type(self, name, context): (source)

Undocumented

Parameters
name:strUndocumented
context:ContextUndocumented
def cannot_determine_type_in_base(self, name, base, context): (source)

Undocumented

Parameters
name:strUndocumented
base:strUndocumented
context:ContextUndocumented
def cannot_instantiate_abstract_class(self, class_name, abstract_attributes, context): (source)

Undocumented

Parameters
class​_name:strUndocumented
abstract​_attributes:List[str]Undocumented
context:ContextUndocumented
def cannot_use_function_with_type(self, method_name, type_name, context): (source)

Undocumented

Parameters
method​_name:strUndocumented
type​_name:strUndocumented
context:ContextUndocumented
def cant_assign_to_classvar(self, name, context): (source)

Undocumented

Parameters
name:strUndocumented
context:ContextUndocumented
def cant_assign_to_final(self, name, attr_assign, ctx): (source)

Warn about a prohibited assignment to a final attribute.

Pass attr_assign=True if the assignment assigns to an attribute.

Parameters
name:strUndocumented
attr​_assign:boolUndocumented
ctx:ContextUndocumented
def cant_assign_to_method(self, context): (source)

Undocumented

Parameters
context:ContextUndocumented
def cant_override_final(self, name, base_name, ctx): (source)

Undocumented

Parameters
name:strUndocumented
base​_name:strUndocumented
ctx:ContextUndocumented
def clean_copy(self): (source)

Undocumented

Returns
MessageBuilderUndocumented
def comparison_method_example_msg(self, class_name): (source)

Undocumented

Parameters
class​_name:strUndocumented
Returns
strUndocumented
def concrete_only_assign(self, typ, context): (source)

Undocumented

Parameters
typ:TypeUndocumented
context:ContextUndocumented
def concrete_only_call(self, typ, context): (source)

Undocumented

Parameters
typ:TypeUndocumented
context:ContextUndocumented
def copy(self): (source)

Undocumented

Returns
MessageBuilderUndocumented
def could_not_infer_type_arguments(self, callee_type, n, context): (source)

Undocumented

Parameters
callee​_type:CallableTypeUndocumented
n:intUndocumented
context:ContextUndocumented
def dangerous_comparison(self, left, right, kind, ctx): (source)

Undocumented

Parameters
left:TypeUndocumented
right:TypeUndocumented
kind:strUndocumented
ctx:ContextUndocumented
def deleted_as_lvalue(self, typ, context): (source)

Report an error about using an deleted type as an lvalue.

Currently, this only occurs when trying to assign to an exception variable outside the local except: blocks.

Parameters
typ:DeletedTypeUndocumented
context:ContextUndocumented
def deleted_as_rvalue(self, typ, context): (source)
Report an error about using an deleted type as an rvalue.
Parameters
typ:DeletedTypeUndocumented
context:ContextUndocumented
@contextmanager
def disable_errors(self): (source)

Undocumented

Returns
Iterator[None]Undocumented
def disallowed_any_type(self, typ, context): (source)

Undocumented

Parameters
typ:TypeUndocumented
context:ContextUndocumented
def does_not_return_value(self, callee_type, context): (source)
Report an error about use of an unusable type.
Parameters
callee​_type:Optional[Type]Undocumented
context:ContextUndocumented
def duplicate_argument_value(self, callee, index, context): (source)

Undocumented

Parameters
callee:CallableTypeUndocumented
index:intUndocumented
context:ContextUndocumented
def explicit_any(self, ctx): (source)

Undocumented

Parameters
ctx:ContextUndocumented
def fail(self, msg, context, *, code=None, file=None, origin=None, allow_dups=False): (source)
Report an error message (unless disabled).
Parameters
msg:strUndocumented
context:Optional[Context]Undocumented
code:Optional[ErrorCode]Undocumented
file:Optional[str]Undocumented
origin:Optional[Context]Undocumented
allow​_dups:boolUndocumented
def final_cant_override_writable(self, name, ctx): (source)

Undocumented

Parameters
name:strUndocumented
ctx:ContextUndocumented
def final_without_value(self, ctx): (source)

Undocumented

Parameters
ctx:ContextUndocumented
def first_argument_for_super_must_be_type(self, actual, context): (source)

Undocumented

Parameters
actual:TypeUndocumented
context:ContextUndocumented
def format_long_tuple_type(self, typ): (source)
Format very long tuple type using an ellipsis notation
Parameters
typ:TupleTypeUndocumented
Returns
strUndocumented
def forward_operator_not_callable(self, forward_method, context): (source)

Undocumented

Parameters
forward​_method:strUndocumented
context:ContextUndocumented
def generate_incompatible_tuple_error(self, lhs_types, rhs_types, context, msg=message_registry.INCOMPATIBLE_TYPES, code=None): (source)
Generate error message for individual incompatible tuple pairs
Parameters
lhs​_types:List[Type]Undocumented
rhs​_types:List[Type]Undocumented
context:ContextUndocumented
msg:strUndocumented
code:Optional[ErrorCode]Undocumented
def has_no_attr(self, original_type, typ, member, context, module_symbol_table=None): (source)

Report a missing or non-accessible member.

original_type is the top-level type on which the error occurred. typ is the actual type that is missing the member. These can be different, e.g., in a union, original_type will be the union and typ will be the specific item in the union that does not have the member attribute.

'module_symbol_table' is passed to this function if the type for which we are trying to get a member was originally a module. The SymbolTable allows us to look up and suggests attributes of the module since they are not directly available on original_type

If member corresponds to an operator, use the corresponding operator name in the messages. Return type Any.

Parameters
original​_type:TypeUndocumented
typ:TypeUndocumented
member:strUndocumented
context:ContextUndocumented
module​_symbol​_table:Optional[SymbolTable]Undocumented
Returns
TypeUndocumented
def impossible_intersection(self, formatted_base_class_list, reason, context): (source)

Undocumented

Parameters
formatted​_base​_class​_list:strUndocumented
reason:strUndocumented
context:ContextUndocumented
def incompatible_argument(self, n, m, callee, arg_type, arg_kind, object_type, context, outer_context): (source)

Report an error about an incompatible argument type.

The argument type is arg_type, argument number is n and the callee type is 'callee'. If the callee represents a method that corresponds to an operator, use the corresponding operator name in the messages.

Return the error code that used for the argument (multiple error codes are possible).

Parameters
n:intUndocumented
m:intUndocumented
callee:CallableTypeUndocumented
arg​_type:TypeUndocumented
arg​_kind:ArgKindUndocumented
object​_type:Optional[Type]Undocumented
context:ContextUndocumented
outer​_context:ContextUndocumented
Returns
Optional[ErrorCode]Undocumented
def incompatible_argument_note(self, original_caller_type, callee_type, context, code): (source)

Undocumented

Parameters
original​_caller​_type:ProperTypeUndocumented
callee​_type:ProperTypeUndocumented
context:ContextUndocumented
code:Optional[ErrorCode]Undocumented
def incompatible_conditional_function_def(self, defn): (source)

Undocumented

Parameters
defn:FuncDefUndocumented
def incompatible_operator_assignment(self, op, context): (source)

Undocumented

Parameters
op:strUndocumented
context:ContextUndocumented
def incompatible_self_argument(self, name, arg, sig, is_classmethod, context): (source)

Undocumented

Parameters
name:strUndocumented
arg:TypeUndocumented
sig:CallableTypeUndocumented
is​_classmethod:boolUndocumented
context:ContextUndocumented
def incompatible_type_application(self, expected_arg_count, actual_arg_count, context): (source)

Undocumented

Parameters
expected​_arg​_count:intUndocumented
actual​_arg​_count:intUndocumented
context:ContextUndocumented
def incompatible_typevar_value(self, callee, typ, typevar_name, context): (source)

Undocumented

Parameters
callee:CallableTypeUndocumented
typ:TypeUndocumented
typevar​_name:strUndocumented
context:ContextUndocumented
def incorrect__exit__return(self, context): (source)

Undocumented

Parameters
context:ContextUndocumented
def incorrectly_returning_any(self, typ, context): (source)

Undocumented

Parameters
typ:TypeUndocumented
context:ContextUndocumented
def invalid_index_type(self, index_type, expected_type, base_str, context, *, code): (source)

Undocumented

Parameters
index​_type:TypeUndocumented
expected​_type:TypeUndocumented
base​_str:strUndocumented
context:ContextUndocumented
code:ErrorCodeUndocumented
def invalid_keyword_var_arg(self, typ, is_mapping, context): (source)

Undocumented

Parameters
typ:TypeUndocumented
is​_mapping:boolUndocumented
context:ContextUndocumented
def invalid_signature(self, func_type, context): (source)

Undocumented

Parameters
func​_type:TypeUndocumented
context:ContextUndocumented
def invalid_signature_for_special_method(self, func_type, context, method_name): (source)

Undocumented

Parameters
func​_type:TypeUndocumented
context:ContextUndocumented
method​_name:strUndocumented
def invalid_var_arg(self, typ, context): (source)

Undocumented

Parameters
typ:TypeUndocumented
context:ContextUndocumented
def is_errors(self): (source)

Undocumented

Returns
boolUndocumented
def key_not_in_mapping(self, key, context): (source)

Undocumented

Parameters
key:strUndocumented
context:ContextUndocumented
def maybe_note_about_special_args(self, callee, context): (source)

Undocumented

Parameters
callee:CallableTypeUndocumented
context:ContextUndocumented
def missing_named_argument(self, callee, context, name): (source)

Undocumented

Parameters
callee:CallableTypeUndocumented
context:ContextUndocumented
name:strUndocumented
def most_recent_context(self): (source)
Return a dummy context matching the most recent generated error in current file.
Returns
ContextUndocumented
def need_annotation_for_var(self, node, context, python_version=None): (source)

Undocumented

Parameters
node:SymbolNodeUndocumented
context:ContextUndocumented
python​_version:Optional[Tuple[int, int]]Undocumented
def no_formal_self(self, name, item, context): (source)

Undocumented

Parameters
name:strUndocumented
item:CallableTypeUndocumented
context:ContextUndocumented
def no_variant_matches_arguments(self, overload, arg_types, context, *, code=None): (source)

Undocumented

Parameters
overload:OverloadedUndocumented
arg​_types:List[Type]Undocumented
context:ContextUndocumented
code:Optional[ErrorCode]Undocumented
def not_callable(self, typ, context): (source)

Undocumented

Parameters
typ:TypeUndocumented
context:ContextUndocumented
Returns
TypeUndocumented
def note(self, msg, context, file=None, origin=None, offset=0, allow_dups=False, *, code=None): (source)
Report a note (unless disabled).
Parameters
msg:strUndocumented
context:ContextUndocumented
file:Optional[str]Undocumented
origin:Optional[Context]Undocumented
offset:intUndocumented
allow​_dups:boolUndocumented
code:Optional[ErrorCode]Undocumented
def note_call(self, subtype, call, context, *, code): (source)

Undocumented

Parameters
subtype:TypeUndocumented
call:TypeUndocumented
context:ContextUndocumented
code:Optional[ErrorCode]Undocumented
def note_multiline(self, messages, context, file=None, origin=None, offset=0, allow_dups=False, code=None): (source)
Report as many notes as lines in the message (unless disabled).
Parameters
messages:strUndocumented
context:ContextUndocumented
file:Optional[str]Undocumented
origin:Optional[Context]Undocumented
offset:intUndocumented
allow​_dups:boolUndocumented
code:Optional[ErrorCode]Undocumented
def operator_method_signatures_overlap(self, reverse_class, reverse_method, forward_class, forward_method, context): (source)

Undocumented

Parameters
reverse​_class:TypeInfoUndocumented
reverse​_method:strUndocumented
forward​_class:TypeUndocumented
forward​_method:strUndocumented
context:ContextUndocumented
def overload_inconsistently_applies_decorator(self, decorator, context): (source)

Undocumented

Parameters
decorator:strUndocumented
context:ContextUndocumented
def overload_signature_incompatible_with_supertype(self, name, name_in_super, supertype, overload, context): (source)

Undocumented

Parameters
name:strUndocumented
name​_in​_super:strUndocumented
supertype:strUndocumented
overload:OverloadedUndocumented
context:ContextUndocumented
def overloaded_signature_will_never_match(self, index1, index2, context): (source)

Undocumented

Parameters
index1:intUndocumented
index2:intUndocumented
context:ContextUndocumented
def overloaded_signatures_arg_specific(self, index, context): (source)

Undocumented

Parameters
index:intUndocumented
context:ContextUndocumented
def overloaded_signatures_overlap(self, index1, index2, context): (source)

Undocumented

Parameters
index1:intUndocumented
index2:intUndocumented
context:ContextUndocumented
def overloaded_signatures_ret_specific(self, index, context): (source)

Undocumented

Parameters
index:intUndocumented
context:ContextUndocumented
def overloaded_signatures_typevar_specific(self, index, context): (source)

Undocumented

Parameters
index:intUndocumented
context:ContextUndocumented
def override_target(self, name, name_in_super, supertype): (source)

Undocumented

Parameters
name:strUndocumented
name​_in​_super:strUndocumented
supertype:strUndocumented
Returns
strUndocumented
def pretty_callable_or_overload(self, tp, context, *, offset=0, add_class_or_static_decorator=False, allow_dups=False, code=None): (source)

Undocumented

Parameters
tp:Union[CallableType, Overloaded]Undocumented
context:ContextUndocumented
offset:intUndocumented
add​_class​_or​_static​_decorator:boolUndocumented
allow​_dups:boolUndocumented
code:Optional[ErrorCode]Undocumented
def pretty_overload(self, tp, context, offset, *, add_class_or_static_decorator=False, allow_dups=False, code=None): (source)

Undocumented

Parameters
tp:OverloadedUndocumented
context:ContextUndocumented
offset:intUndocumented
add​_class​_or​_static​_decorator:boolUndocumented
allow​_dups:boolUndocumented
code:Optional[ErrorCode]Undocumented
def print_more(self, conflicts, context, offset, max_items, *, code=None): (source)

Undocumented

Parameters
conflicts:Sequence[Any]Undocumented
context:ContextUndocumented
offset:intUndocumented
max​_items:intUndocumented
code:Optional[ErrorCode]Undocumented
def protocol_members_cant_be_final(self, ctx): (source)

Undocumented

Parameters
ctx:ContextUndocumented
def read_only_property(self, name, type, context): (source)

Undocumented

Parameters
name:strUndocumented
type:TypeInfoUndocumented
context:ContextUndocumented
def redundant_cast(self, typ, context): (source)

Undocumented

Parameters
typ:TypeUndocumented
context:ContextUndocumented
def redundant_condition_in_assert(self, truthiness, context): (source)

Undocumented

Parameters
truthiness:boolUndocumented
context:ContextUndocumented
def redundant_condition_in_comprehension(self, truthiness, context): (source)

Undocumented

Parameters
truthiness:boolUndocumented
context:ContextUndocumented
def redundant_condition_in_if(self, truthiness, context): (source)

Undocumented

Parameters
truthiness:boolUndocumented
context:ContextUndocumented
def redundant_expr(self, description, truthiness, context): (source)

Undocumented

Parameters
description:strUndocumented
truthiness:boolUndocumented
context:ContextUndocumented
def redundant_left_operand(self, op_name, context): (source)
Indicates that the left operand of a boolean expression is redundant: it does not change the truth value of the entire condition as a whole. 'op_name' should either be the string "and" or the string "or".
Parameters
op​_name:strUndocumented
context:ContextUndocumented
def report(self, msg, context, severity, *, code=None, file=None, origin=None, offset=0, allow_dups=False): (source)
Report an error or note (unless disabled).
Parameters
msg:strUndocumented
context:Optional[Context]Undocumented
severity:strUndocumented
code:Optional[ErrorCode]Undocumented
file:Optional[str]Undocumented
origin:Optional[Context]Undocumented
offset:intUndocumented
allow​_dups:boolUndocumented
def report_non_method_protocol(self, tp, members, context): (source)

Undocumented

Parameters
tp:TypeInfoUndocumented
members:List[str]Undocumented
context:ContextUndocumented
def report_protocol_problems(self, subtype, supertype, context, *, code): (source)

Report possible protocol conflicts between 'subtype' and 'supertype'.

This includes missing members, incompatible types, and incompatible attribute flags, such as settable vs read-only or class variable vs instance variable.

Parameters
subtype:Union[Instance, TupleType, TypedDictType]Undocumented
supertype:InstanceUndocumented
context:ContextUndocumented
code:Optional[ErrorCode]Undocumented
def requires_int_or_char(self, context, format_call=False): (source)

Undocumented

Parameters
context:ContextUndocumented
format​_call:boolUndocumented
def requires_int_or_single_byte(self, context, format_call=False): (source)

Undocumented

Parameters
context:ContextUndocumented
format​_call:boolUndocumented
def return_type_incompatible_with_supertype(self, name, name_in_supertype, supertype, original, override, context): (source)

Undocumented

Parameters
name:strUndocumented
name​_in​_supertype:strUndocumented
supertype:strUndocumented
original:TypeUndocumented
override:TypeUndocumented
context:ContextUndocumented
def reveal_locals(self, type_map, context): (source)

Undocumented

Parameters
type​_map:Dict[str, Optional[Type]]Undocumented
context:ContextUndocumented
def reveal_type(self, typ, context): (source)

Undocumented

Parameters
typ:TypeUndocumented
context:ContextUndocumented
def signature_incompatible_with_supertype(self, name, name_in_super, supertype, context, original=None, override=None): (source)

Undocumented

Parameters
name:strUndocumented
name​_in​_super:strUndocumented
supertype:strUndocumented
context:ContextUndocumented
original:Optional[FunctionLike]Undocumented
override:Optional[FunctionLike]Undocumented
def signatures_incompatible(self, method, other_method, context): (source)

Undocumented

Parameters
method:strUndocumented
other​_method:strUndocumented
context:ContextUndocumented
def string_interpolation_mixing_key_and_non_keys(self, context): (source)

Undocumented

Parameters
context:ContextUndocumented
def string_interpolation_with_star_and_key(self, context): (source)

Undocumented

Parameters
context:ContextUndocumented
def too_few_arguments(self, callee, context, argument_names): (source)

Undocumented

Parameters
callee:CallableTypeUndocumented
context:ContextUndocumented
argument​_names:Optional[Sequence[Optional[str]]]Undocumented
def too_few_string_formatting_arguments(self, context): (source)

Undocumented

Parameters
context:ContextUndocumented
def too_many_arguments(self, callee, context): (source)

Undocumented

Parameters
callee:CallableTypeUndocumented
context:ContextUndocumented
def too_many_arguments_from_typed_dict(self, callee, arg_type, context): (source)

Undocumented

Parameters
callee:CallableTypeUndocumented
arg​_type:TypedDictTypeUndocumented
context:ContextUndocumented
def too_many_positional_arguments(self, callee, context): (source)

Undocumented

Parameters
callee:CallableTypeUndocumented
context:ContextUndocumented
def too_many_string_formatting_arguments(self, context): (source)

Undocumented

Parameters
context:ContextUndocumented
def try_report_long_tuple_assignment_error(self, subtype, supertype, context, msg=message_registry.INCOMPATIBLE_TYPES, subtype_label=None, supertype_label=None, code=None): (source)

Try to generate meaningful error message for very long tuple assignment

Returns a bool: True when generating long tuple assignment error, False when no such error reported

Parameters
subtype:ProperTypeUndocumented
supertype:ProperTypeUndocumented
context:ContextUndocumented
msg:strUndocumented
subtype​_label:Optional[str]Undocumented
supertype​_label:Optional[str]Undocumented
code:Optional[ErrorCode]Undocumented
Returns
boolUndocumented
def type_arguments_not_allowed(self, context): (source)

Undocumented

Parameters
context:ContextUndocumented
def type_not_iterable(self, type, context): (source)

Undocumented

Parameters
type:TypeUndocumented
context:ContextUndocumented
def typed_function_untyped_decorator(self, func_name, context): (source)

Undocumented

Parameters
func​_name:strUndocumented
context:ContextUndocumented
def typeddict_context_ambiguous(self, types, context): (source)

Undocumented

Parameters
types:List[TypedDictType]Undocumented
context:ContextUndocumented
def typeddict_key_cannot_be_deleted(self, typ, item_name, context): (source)

Undocumented

Parameters
typ:TypedDictTypeUndocumented
item​_name:strUndocumented
context:ContextUndocumented
def typeddict_key_must_be_string_literal(self, typ, context): (source)

Undocumented

Parameters
typ:TypedDictTypeUndocumented
context:ContextUndocumented
def typeddict_key_not_found(self, typ, item_name, context): (source)

Undocumented

Parameters
typ:TypedDictTypeUndocumented
item​_name:strUndocumented
context:ContextUndocumented
def typeddict_setdefault_arguments_inconsistent(self, default, expected, context): (source)

Undocumented

Parameters
default:TypeUndocumented
expected:TypeUndocumented
context:ContextUndocumented
def undefined_in_superclass(self, member, context): (source)

Undocumented

Parameters
member:strUndocumented
context:ContextUndocumented
def underscore_function_call(self, context): (source)

Undocumented

Parameters
context:ContextUndocumented
def unexpected_keyword_argument(self, callee, name, arg_type, context): (source)

Undocumented

Parameters
callee:CallableTypeUndocumented
name:strUndocumented
arg​_type:TypeUndocumented
context:ContextUndocumented
def unexpected_typeddict_keys(self, typ, expected_keys, actual_keys, context): (source)

Undocumented

Parameters
typ:TypedDictTypeUndocumented
expected​_keys:List[str]Undocumented
actual​_keys:List[str]Undocumented
context:ContextUndocumented
def unimported_type_becomes_any(self, prefix, typ, ctx): (source)

Undocumented

Parameters
prefix:strUndocumented
typ:TypeUndocumented
ctx:ContextUndocumented
def unpacking_strings_disallowed(self, context): (source)

Undocumented

Parameters
context:ContextUndocumented
def unreachable_right_operand(self, op_name, context): (source)
Indicates that the right operand of a boolean expression is redundant: it does not change the truth value of the entire condition as a whole. 'op_name' should either be the string "and" or the string "or".
Parameters
op​_name:strUndocumented
context:ContextUndocumented
def unreachable_statement(self, context): (source)

Undocumented

Parameters
context:ContextUndocumented
def unsupported_left_operand(self, op, typ, context): (source)

Undocumented

Parameters
op:strUndocumented
typ:TypeUndocumented
context:ContextUndocumented
def unsupported_operand_types(self, op, left_type, right_type, context, *, code=codes.OPERATOR): (source)

Report unsupported operand types for a binary operation.

Types can be Type objects or strings.

Parameters
op:strUndocumented
left​_type:AnyUndocumented
right​_type:AnyUndocumented
context:ContextUndocumented
code:ErrorCodeUndocumented
def unsupported_placeholder(self, placeholder, context): (source)

Undocumented

Parameters
placeholder:strUndocumented
context:ContextUndocumented
def unsupported_type_type(self, item, context): (source)

Undocumented

Parameters
item:TypeUndocumented
context:ContextUndocumented
def untyped_decorated_function(self, typ, context): (source)

Undocumented

Parameters
typ:TypeUndocumented
context:ContextUndocumented
def untyped_function_call(self, callee, context): (source)

Undocumented

Parameters
callee:CallableTypeUndocumented
context:ContextUndocumented
Returns
TypeUndocumented
def warn_both_operands_are_from_unions(self, context): (source)

Undocumented

Parameters
context:ContextUndocumented
def warn_operand_was_from_union(self, side, original, context): (source)

Undocumented

Parameters
side:strUndocumented
original:TypeUndocumented
context:ContextUndocumented
def wrong_number_values_to_unpack(self, provided, expected, context): (source)

Undocumented

Parameters
provided:intUndocumented
expected:intUndocumented
context:ContextUndocumented
def yield_from_invalid_operand_type(self, expr, context): (source)

Undocumented

Parameters
expr:TypeUndocumented
context:ContextUndocumented
Returns
TypeUndocumented
disable_count: int = (source)

Undocumented

disable_type_names: int = (source)

Undocumented

errors = (source)

Undocumented

modules = (source)

Undocumented