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 a class attribute.
Method get​_base​_class​_hook Update class definition for given base classes.
Method get​_class​_decorator​_hook 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): (source)

Undocumented

Parameters
target:strUndocumented
def get_function_hook(self, fullname): (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'.

Parameters
fullname:strUndocumented
Returns
Optional[Callable[[FunctionContext], Type]]Undocumented
def get_method_hook(self, fullname): (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).

Parameters
fullname:strUndocumented
Returns
Optional[Callable[[MethodContext], Type]]Undocumented
def log(self, ctx): (source)

Undocumented

Parameters
ctx:Union[FunctionContext, MethodContext]Undocumented
Returns
TypeUndocumented
mystery_hits: List[Callsite] = (source)

Undocumented

target = (source)

Undocumented