From 29e9c43d348ca24f1eefd21512fd1392dac7107e Mon Sep 17 00:00:00 2001 From: Abdul Samad Date: Fri, 26 Jun 2026 17:00:48 +0500 Subject: [PATCH] docs: clarify get_method_signature_hook fullname uses call-site class --- mypy/plugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mypy/plugin.py b/mypy/plugin.py index 383b07af87c0d..a44ad57f61821 100644 --- a/mypy/plugin.py +++ b/mypy/plugin.py @@ -647,7 +647,7 @@ def get_method_signature_hook( may infer a better type for the method. The hook is also called for special Python dunder methods except __init__ and __new__ (use get_function_hook to customize class instantiation). This function is called with the method full name using - the class where it was _defined_. For example, in this code: + the class of the object on which the method is called. For example, in this code: from lib import Special @@ -663,7 +663,7 @@ class Derived(Base): x: Special y = x[0] - this method is called with '__main__.Base.method', and then with + this method is called with '__main__.Derived.method', and then with 'lib.Special.__getitem__'. """ return None @@ -672,7 +672,7 @@ def get_method_hook(self, fullname: str) -> Callable[[MethodContext], Type] | No """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). + method full name (using the class of the object on which the method is called). """ return None