Ref<PyType> (@NotNull PyCallable callable, @NotNull TypeEvalContext context) { if (callable instanceof PyDocStringOwner) { final StructuredDocString docString = ((PyDocStringOwner)callable).getStructuredDocString(); if (docString != null) { final String typeText = docString.getReturnType(); if (StringUtil.isNotEmpty(typeText)) { final Ref<PyType> typeRef = parseType(callable, typeText, context); if (callable instanceof PyFunction) { return Ref.create(PyTypingTypeProvider.toAsyncIfNeeded((PyFunction)callable, typeRef.get())); } return typeRef; } } } return null; }