MCPcopy Create free account
hub / github.com/python/mypy / apply_function_signature_hook

Method apply_function_signature_hook

mypy/checkexpr.py:1319–1335  ·  view source on GitHub ↗

Apply a plugin hook that may infer a more precise signature for a function.

(
        self,
        callee: FunctionLike,
        args: list[Expression],
        arg_kinds: list[ArgKind],
        context: Context,
        arg_names: Sequence[str | None] | None,
        signature_hook: Callable[[FunctionSigContext], FunctionLike],
    )

Source from the content-addressed store, hash-verified

1317 return Overloaded(items)
1318
1319 def apply_function_signature_hook(
1320 self,
1321 callee: FunctionLike,
1322 args: list[Expression],
1323 arg_kinds: list[ArgKind],
1324 context: Context,
1325 arg_names: Sequence[str | None] | None,
1326 signature_hook: Callable[[FunctionSigContext], FunctionLike],
1327 ) -> FunctionLike:
1328 """Apply a plugin hook that may infer a more precise signature for a function."""
1329 return self.apply_signature_hook(
1330 callee,
1331 args,
1332 arg_kinds,
1333 arg_names,
1334 (lambda args, sig: signature_hook(FunctionSigContext(args, sig, context, self.chk))),
1335 )
1336
1337 def apply_method_signature_hook(
1338 self,

Callers 1

transform_callee_typeMethod · 0.95

Calls 2

apply_signature_hookMethod · 0.95
FunctionSigContextClass · 0.90

Tested by

no test coverage detected