When we have a function that returns an object that is an instance of a class. Are there any way to cast or tell the compiler that this object returned is an instance of MyClass so the warning is avoided?
Or are there any other pythonic way to do it?
def dict_to_class_instance (my_dict, type_class) -> object
# some processing
return type_class(**my_dict_converted)
def caller (my_dict) -> MyClass
process_dict(my_dict, MyClass) # Warning: Expected type 'MyClass', got 'object' instead