PyType (@NotNull PyFunction function, @NotNull TypeEvalContext typeEvalContext) { final PyType returnType = typeEvalContext.getReturnType(function); if (function.isAsync() || function.isGenerator()) { return Ref.deref(PyTypingTypeProvider.coroutineOrGeneratorElementType(returnType)); } return returnType; }