I have a function that receives a class and returns an instance of that class. A simple example:
def instantiate(class_: Type[enum.Enum], param: str) -> enum.Enum:
return class_(param)
The return value is the same as the type of the parameter class_, so if class_ is MyEnum, the return value will be of type MyEnum.
Is there some way to declare that?