MCPcopy Index your code
hub / github.com/python/mypy / get_function_sig

Method get_function_sig

mypy/stubgenc.py:69–101  ·  view source on GitHub ↗
(
        self, default_sig: FunctionSig, ctx: FunctionContext
    )

Source from the content-addressed store, hash-verified

67 return ExternalSignatureGenerator(sigs, class_sigs)
68
69 def get_function_sig(
70 self, default_sig: FunctionSig, ctx: FunctionContext
71 ) -> list[FunctionSig] | None:
72 # method:
73 if (
74 ctx.class_info
75 and ctx.name in ("__new__", "__init__")
76 and ctx.name not in self.func_sigs
77 and ctx.class_info.name in self.class_sigs
78 ):
79 return [
80 FunctionSig(
81 name=ctx.name,
82 args=infer_arg_sig_from_anon_docstring(self.class_sigs[ctx.class_info.name]),
83 ret_type=infer_method_ret_type(ctx.name),
84 )
85 ]
86
87 # function:
88 if ctx.name not in self.func_sigs:
89 return None
90
91 inferred = [
92 FunctionSig(
93 name=ctx.name,
94 args=infer_arg_sig_from_anon_docstring(self.func_sigs[ctx.name]),
95 ret_type=None,
96 )
97 ]
98 if ctx.class_info:
99 return self.remove_self_type(inferred, ctx.class_info.self_var)
100 else:
101 return inferred
102
103 def get_property_type(self, default_type: str | None, ctx: FunctionContext) -> str | None:
104 return None

Callers

nothing calls this directly

Calls 4

FunctionSigClass · 0.90
infer_method_ret_typeFunction · 0.90
remove_self_typeMethod · 0.80

Tested by

no test coverage detected