class documentation

ErrorLog with convenience functions.

Method ambiguous_annotation Log an ambiguous annotation.
Method annotation_type_mismatch Invalid combination of annotation and assignment.
Method any_return_type Logs a [bad-return-type] error.
Method assert_type Check that a variable type matches its expected value.
Method assigning_to_final Attempting to reassign a variable annotated with Final.
Method attribute_error Undocumented
Method bad_concrete_type Undocumented
Method bad_final_decorator Undocumented
Method bad_function_defaults Undocumented
Method bad_return_type Logs a [bad-return-type] error.
Method bad_slots Undocumented
Method bad_unpacking Undocumented
Method bad_yield_annotation Undocumented
Method base_class_error Undocumented
Method container_type_mismatch Invalid combination of annotation and mutation.
Method duplicate_keyword Undocumented
Method ignored_abstractmethod Undocumented
Method ignored_metaclass Undocumented
Method ignored_type_comment Undocumented
Method import_error Undocumented
Method incomplete_match Undocumented
Method invalid_annotation Undocumented
Method invalid_directive Undocumented
Method invalid_ellipses Undocumented
Method invalid_final_type Undocumented
Method invalid_function_call Log an invalid function call.
Method invalid_function_definition Undocumented
Method invalid_function_type_comment Undocumented
Method invalid_namedtuple_arg Undocumented
Method invalid_signature_mutation Undocumented
Method invalid_super_call Undocumented
Method invalid_typevar Undocumented
Method late_directive Undocumented
Method match_posargs_count Undocumented
Method missing_parameter A function call is missing parameters.
Method mro_error Undocumented
Method name_error Undocumented
Method not_callable Calling an object that isn't callable.
Method not_indexable Undocumented
Method not_instantiable Instantiating an abstract class.
Method not_supported_yet Undocumented
Method not_writable Undocumented
Method overriding_final_attribute Undocumented
Method overriding_final_method Undocumented
Method overriding_signature_mismatch Signature mismatch between overridden and overriding class methods.
Method paramspec_error Undocumented
Method pyi_error Undocumented
Method python_compiler_error Undocumented
Method recursion_error Undocumented
Method redundant_function_type_comment Undocumented
Method redundant_match Undocumented
Method reveal_type Undocumented
Method subclassing_final_class Undocumented
Method typed_dict_error Accessing a nonexistent key in a typed dict.
Method unbound_type_param Undocumented
Method unsupported_operands Undocumented
Method wrong_annotation_parameter_count Log an error for an annotation with the wrong number of parameters.
Method wrong_arg_count Undocumented
Method wrong_arg_types Log [wrong-arg-types].
Method wrong_keyword_args A function was called with extra keywords.
Method _attribute_error Log an attribute error.
Method _get_binary_operation Return (op, left, right) if the function should be treated as a binop.
Method _invalid_annotation Log the invalid annotation.
Method _invalid_parameters Log an invalid parameters error.
Method _iter_actual Yield the prefix, name and type information for actual parameters.
Method _iter_expected Yield the prefix, name and type information for expected parameters.
Method _iter_sig Iterate through a function.Signature object. Focus on a bad parameter.
Method _join_printed_types Pretty-print the union of the printed types.
Method _module_attr Undocumented
Method _normalize_signature If applicable, converts from `f(self: A, ...)` to `A.f(self, ...)`.
Method _overriding_final Undocumented
Method _prepare_errorlog_details Prepare printable annotation matching errors.
Method _print_args Pretty-print a list of arguments. Focus on a bad parameter.
Method _print_as_actual_type Undocumented
Method _print_as_expected_type Print abstract value t as a pytd type.
Method _print_as_function_def Undocumented
Method _print_as_generic_type Undocumented
Method _print_as_return_types Print the actual and expected values for a return type.
Method _print_error_details Undocumented
Method _print_noniterable_str_error Pretty-print the matcher.NonIterableStrError instance.
Method _print_params_helper Undocumented
Method _print_protocol_error Pretty-print the protocol error.
Method _print_typed_dict_error Pretty-print the matcher.TypedDictError instance.
Method _pytd_print Print the name of the pytd type.
Method _show_variable Show variable as 'name: typ' or 'pyval: typ' if available.
Method _unsupported_operands Unsupported operands.
Method _wrong_arg_types A function was called with the wrong parameter types.

Inherited from ErrorLogBase:

Method __getitem__ Undocumented
Method __init__ Undocumented
Method __iter__ Undocumented
Method __len__ Undocumented
Method __str__ Undocumented
Method checkpoint Record errors without adding them to the errorlog.
Method copy_from Undocumented
Method error Undocumented
Method has_error Return true iff an Error with SEVERITY_ERROR is present.
Method is_valid_error_name Return True iff name was defined in an @error_name() decorator.
Method print_to_csv_file Print the errorlog to a csv file.
Method print_to_file Undocumented
Method print_to_stderr Undocumented
Method set_error_filter Set the error filter.
Method unique_sorted_errors Gets the unique errors in this log, sorted on filename and lineno.
Method warn Undocumented
Method _add Undocumented
Method _sorted_errors Undocumented
Instance Variable _errors Undocumented
Instance Variable _filter Undocumented
def ambiguous_annotation(self, stack, options: Optional[Union[str, Iterable[abstract.BaseValue]]], name=None): (source)

Log an ambiguous annotation.

@_error_name('annotation-type-mismatch')
def annotation_type_mismatch(self, stack, annot, binding, name, error_details, details=None, *, typed_dict=None): (source)

Invalid combination of annotation and assignment.

@_error_name('bad-return-type')
def any_return_type(self, stack): (source)

Logs a [bad-return-type] error.

@_error_name('assert-type')
def assert_type(self, stack, node, var, typ=None): (source)

Check that a variable type matches its expected value.

@_error_name('final-error')
def assigning_to_final(self, stack, name, local): (source)

Attempting to reassign a variable annotated with Final.

def attribute_error(self, stack, binding, attr_name): (source)

Undocumented

@_error_name('bad-concrete-type')
def bad_concrete_type(self, stack, node, bad, details=None): (source)

Undocumented

@_error_name('final-error')
def bad_final_decorator(self, stack, obj, details=None): (source)

Undocumented

@_error_name('bad-function-defaults')
def bad_function_defaults(self, stack, func_name): (source)

Undocumented

@_error_name('bad-return-type')
def bad_return_type(self, stack, node, bad): (source)

Logs a [bad-return-type] error.

@_error_name('bad-slots')
def bad_slots(self, stack, msg): (source)

Undocumented

@_error_name('bad-unpacking')
def bad_unpacking(self, stack, num_vals, num_vars): (source)

Undocumented

@_error_name('bad-yield-annotation')
def bad_yield_annotation(self, stack, name, annot, is_async): (source)

Undocumented

@_error_name('base-class-error')
def base_class_error(self, stack, base_var, details=None): (source)

Undocumented

@_error_name('container-type-mismatch')
def container_type_mismatch(self, stack, obj, mutations, name): (source)

Invalid combination of annotation and mutation. Args: stack: the frame stack obj: the container instance being mutated mutations: a dict of {parameter name: (annotated types, new types)} name: the variable name (or None)

@_error_name('duplicate-keyword-argument')
def duplicate_keyword(self, stack, name, bad_call, duplicate): (source)

Undocumented

@_error_name('ignored-abstractmethod')
def ignored_abstractmethod(self, stack, cls_name, method_name): (source)

Undocumented

@_error_name('ignored-metaclass')
def ignored_metaclass(self, stack, cls, metaclass): (source)

Undocumented

@_error_name('ignored-type-comment')
def ignored_type_comment(self, filename, lineno, comment): (source)

Undocumented

@_error_name('import-error')
def import_error(self, stack, module_name): (source)

Undocumented

@_error_name('incomplete-match')
def incomplete_match(self, stack, line, cases, details=None): (source)

Undocumented

def invalid_annotation(self, stack, annot: Optional[Union[str, abstract.BaseValue]], details=None, name=None): (source)

Undocumented

@_error_name('invalid-directive')
def invalid_directive(self, filename, lineno, message): (source)

Undocumented

def invalid_ellipses(self, stack, indices, container_name): (source)

Undocumented

@_error_name('final-error')
def invalid_final_type(self, stack, details=None): (source)

Undocumented

def invalid_function_call(self, stack, error): (source)

Log an invalid function call.

@_error_name('invalid-function-definition')
def invalid_function_definition(self, stack, msg, details=None): (source)

Undocumented

@_error_name('invalid-function-type-comment')
def invalid_function_type_comment(self, stack, comment, details=None): (source)

Undocumented

@_error_name('invalid-namedtuple-arg')
def invalid_namedtuple_arg(self, stack, badname=None, err_msg=None): (source)

Undocumented

@_error_name('invalid-signature-mutation')
def invalid_signature_mutation(self, stack, func_name, sig): (source)

Undocumented

@_error_name('invalid-super-call')
def invalid_super_call(self, stack, message, details=None): (source)

Undocumented

@_error_name('invalid-typevar')
def invalid_typevar(self, stack, comment, bad_call=None): (source)

Undocumented

@_error_name('late-directive')
def late_directive(self, filename, lineno, name): (source)

Undocumented

@_error_name('match-error')
def match_posargs_count(self, stack, cls, posargs, match_args, details=None): (source)

Undocumented

@_error_name('missing-parameter')
def missing_parameter(self, stack, name, bad_call, missing_parameter): (source)

A function call is missing parameters.

@_error_name('mro-error')
def mro_error(self, stack, name, mro_seqs, details=None): (source)

Undocumented

@_error_name('name-error')
def name_error(self, stack, name, details=None): (source)

Undocumented

@_error_name('not-callable')
def not_callable(self, stack, func, details=None): (source)

Calling an object that isn't callable.

@_error_name('not-indexable')
def not_indexable(self, stack, name, generic_warning=False): (source)

Undocumented

@_error_name('not-instantiable')
def not_instantiable(self, stack, cls): (source)

Instantiating an abstract class.

@_error_name('not-supported-yet')
def not_supported_yet(self, stack, feature, details=None): (source)

Undocumented

@_error_name('not-writable')
def not_writable(self, stack, obj, attr_name): (source)

Undocumented

def overriding_final_attribute(self, stack, cls, base, name, details=None): (source)

Undocumented

def overriding_final_method(self, stack, cls, base, name, details=None): (source)

Undocumented

@_error_name('signature-mismatch')
def overriding_signature_mismatch(self, stack, base_signature, class_signature, details=None): (source)

Signature mismatch between overridden and overriding class methods.

@_error_name('paramspec-error')
def paramspec_error(self, stack, details=None): (source)

Undocumented

@_error_name('pyi-error')
def pyi_error(self, stack, name, error): (source)

Undocumented

@_error_name('python-compiler-error')
def python_compiler_error(self, filename, lineno, message): (source)

Undocumented

@_error_name('recursion-error')
def recursion_error(self, stack, name): (source)

Undocumented

@_error_name('redundant-function-type-comment')
def redundant_function_type_comment(self, filename, lineno): (source)

Undocumented

@_error_name('redundant-match')
def redundant_match(self, stack, case, details=None): (source)

Undocumented

@_error_name('reveal-type')
def reveal_type(self, stack, node, var): (source)

Undocumented

@_error_name('final-error')
def subclassing_final_class(self, stack, base_var, details=None): (source)

Undocumented

@_error_name('typed-dict-error')
def typed_dict_error(self, stack, obj, name): (source)

Accessing a nonexistent key in a typed dict. Args: stack: the frame stack obj: the typed dict instance name: the key name

@_error_name('unbound-type-param')
def unbound_type_param(self, stack, obj, attr_name, type_param_name): (source)

Undocumented

def unsupported_operands(self, stack, operator, var1, var2): (source)

Undocumented

def wrong_annotation_parameter_count(self, stack, annot: abstract.BaseValue, params: Sequence[abstract.BaseValue], expected_count: int, template: Optional[Iterable[str]] = None): (source)

Log an error for an annotation with the wrong number of parameters.

@_error_name('wrong-arg-count')
def wrong_arg_count(self, stack, name, bad_call): (source)

Undocumented

def wrong_arg_types(self, stack, name, bad_call): (source)

Log [wrong-arg-types].

@_error_name('wrong-keyword-args')
def wrong_keyword_args(self, stack, name, bad_call, extra_keywords): (source)

A function was called with extra keywords.

@_error_name('attribute-error')
def _attribute_error(self, stack, binding, attr_name): (source)

Log an attribute error.

def _get_binary_operation(self, function_name, bad_call): (source)

Return (op, left, right) if the function should be treated as a binop.

@_error_name('invalid-annotation')
def _invalid_annotation(self, stack, annot_string, details, name): (source)

Log the invalid annotation.

def _invalid_parameters(self, stack, message, bad_call): (source)

Log an invalid parameters error.

def _iter_actual(self, sig, passed_args, bad_param, literal): (source)

Yield the prefix, name and type information for actual parameters.

def _iter_expected(self, sig, bad_param): (source)

Yield the prefix, name and type information for expected parameters.

def _iter_sig(self, sig): (source)

Iterate through a function.Signature object. Focus on a bad parameter.

def _join_printed_types(self, types): (source)

Pretty-print the union of the printed types.

@_error_name('module-attr')
def _module_attr(self, stack, binding, attr_name): (source)

Undocumented

def _normalize_signature(self, signature): (source)

If applicable, converts from `f(self: A, ...)` to `A.f(self, ...)`.

@_error_name('final-error')
def _overriding_final(self, stack, cls, base, name, *, is_method, details): (source)

Undocumented

def _prepare_errorlog_details(self, bad): (source)

Prepare printable annotation matching errors.

def _print_args(self, arg_iter, bad_param): (source)

Pretty-print a list of arguments. Focus on a bad parameter.

def _print_as_actual_type(self, t, literal=False): (source)

Undocumented

def _print_as_expected_type(self, t: abstract.BaseValue, instance=None): (source)

Print abstract value t as a pytd type.

def _print_as_function_def(self, fn: abstract.Function) -> str: (source)

Undocumented

def _print_as_generic_type(self, t): (source)

Undocumented

def _print_as_return_types(self, node, bad): (source)

Print the actual and expected values for a return type.

def _print_error_details(self, error_details): (source)

Undocumented

def _print_noniterable_str_error(self, error): (source)

Pretty-print the matcher.NonIterableStrError instance.

def _print_params_helper(self, param_or_params): (source)

Undocumented

def _print_protocol_error(self, error: matcher.ProtocolError) -> str: (source)

Pretty-print the protocol error.

def _print_typed_dict_error(self, error): (source)

Pretty-print the matcher.TypedDictError instance.

def _pytd_print(self, pytd_type): (source)

Print the name of the pytd type.

def _show_variable(self, var): (source)

Show variable as 'name: typ' or 'pyval: typ' if available.

@_error_name('unsupported-operands')
def _unsupported_operands(self, stack, operator, *operands, details=None): (source)

Unsupported operands.

@_error_name('wrong-arg-types')
def _wrong_arg_types(self, stack, name, bad_call): (source)

A function was called with the wrong parameter types.