Suppose I have a fully type hinted method with only keyword arguments :
class A:
def func(a: int, b: str, c: SomeIntricateTypeHint) -> OutputClass:
...
Now suppose I have a function that takes in variable keyword arguments, and passes them entirely onto that method :
def outer_func(n_repeat: int, **kwargs: ???) -> OtherOutputClass:
a = A()
for _ in range(n_repeat):
a.func(**kwargs)
In doing so, I have lost the benefits of the type hints for func
. How do I type hint kwargs
in outer_func
such that I recover those benefits ?
For extra detail, in my case, I don't personally define func
. It's actually a method from a boto3
client object. As a result I'm looking for a solution that dynamically creates the type hint, rather than having to manually create the TypedDict.