It is possible to get signature of a function in python with inspect.signature.
from typing import overload
import inspect
class Foo:
@overload
def foo(x: int, y: float): ...
@overload
def foo(y: float): ...
def foo(a, b=None):
if b is None:
x, y = 1, a
else:
x, y = a, b
return y / x
print(inspect.signature(Foo.foo)) # (a, b=None)
Is there any way to also see signatures of all overloads of such function?
In this example, I want to get a list [inspect.Signature(x: int, y: float), inspect.Signature(y: float)] or something close to it.