class documentation

class SuggestionPlugin(Plugin): (source)

View In Hierarchy

Plugin that records all calls to a given target.

Method __init__ Undocumented
Method get_function_hook Adjust the return type of a function call.
Method get_method_hook Adjust return type of a method call.
Method log Undocumented
Instance Variable mystery_hits Undocumented
Instance Variable target Undocumented

Inherited from Plugin:

Method get_additional_deps Customize dependencies for a module.
Method get_attribute_hook Adjust type of an instance attribute.
Method get_base_class_hook Update class definition for given base classes.
Method get_class_attribute_hook Adjust type of a class attribute.
Method get_class_decorator_hook Update class definition for given class decorators.
Method get_class_decorator_hook_2 Update class definition for given class decorators.
Method get_customize_class_mro_hook Customize MRO for given classes.
Method get_dynamic_class_hook Semantically analyze a dynamic class definition.
Method get_function_signature_hook Adjust the signature of a function.
Method get_metaclass_hook Update class definition for given declared metaclasses.
Method get_method_signature_hook Adjust the signature of a method.
Method get_type_analyze_hook Customize behaviour of the type analyzer for given full names.
Method lookup_fully_qualified Lookup a symbol by its full name (including module).
Method report_config_data Get representation of configuration data for a module.
Method set_modules Undocumented
Instance Variable options Undocumented
Instance Variable python_version Undocumented
Instance Variable _modules Undocumented
def __init__(self, target: str): (source)

Undocumented

def get_function_hook(self, fullname: str) -> Callable[[FunctionContext], Type]|None: (source)

Adjust the return type of a function call. This method is called after type checking a call. Plugin may adjust the return type inferred by mypy, and/or emit some error messages. Note, this hook is also called for class instantiation calls, so that in this example: from lib import Class, do_stuff do_stuff(42) Class() This method will be called with 'lib.do_stuff' and then with 'lib.Class'.

def get_method_hook(self, fullname: str) -> Callable[[MethodContext], Type]|None: (source)

Adjust return type of a method call. This is the same as get_function_hook(), but is called with the method full name (again, using the class where the method is defined).

Undocumented

mystery_hits: list[Callsite] = (source)

Undocumented

Undocumented