Edit parameters and typehints for a class method

27 Views Asked by At

I have a class:

class Foo:
    def __init__(self, *args, *kwargs):
        pass

As you see, this code will display args & kwargs for typehints. But, I want to inspect method and change it's arguments and typehints using inspect.Signature, and I have a dict with all field names and their typehints:

{param: Optional[str] # as an example}

So, how do I change those parameter names & their typehints?

0

There are 0 best solutions below