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

Method check_function_signature

mypy/semanal.py:1708–1718  ·  view source on GitHub ↗
(self, fdef: FuncItem)

Source from the content-addressed store, hash-verified

1706 break
1707
1708 def check_function_signature(self, fdef: FuncItem) -> None:
1709 sig = fdef.type
1710 assert isinstance(sig, CallableType)
1711 if len(sig.arg_types) < len(fdef.arguments):
1712 self.fail("Type signature has too few arguments", fdef)
1713 # Add dummy Any arguments to prevent crashes later.
1714 num_extra_anys = len(fdef.arguments) - len(sig.arg_types)
1715 extra_anys = [AnyType(TypeOfAny.from_error)] * num_extra_anys
1716 sig.arg_types.extend(extra_anys)
1717 elif len(sig.arg_types) > len(fdef.arguments):
1718 self.fail("Type signature has too many arguments", fdef, blocker=True)
1719
1720 def visit_decorator(self, dec: Decorator) -> None:
1721 self.statement = dec

Callers 1

analyze_func_defMethod · 0.95

Calls 5

failMethod · 0.95
AnyTypeClass · 0.90
isinstanceFunction · 0.85
lenFunction · 0.85
extendMethod · 0.80

Tested by

no test coverage detected