DocStringFormat (@NotNull VirtualFile file, @NotNull Module module) { final PsiFile psiFile = PsiManager.getInstance(module.getProject()).findFile(file); if (psiFile instanceof PyFile) { final DocStringFormat perFileFormat = PyDocumentationSettings.getFormatFromDocformatAttribute(psiFile); if (perFileFormat != null) { return perFileFormat; } // Why toplevel docstring owners only final PyDocStringOwner[] children = PsiTreeUtil.getChildrenOfType(psiFile, PyDocStringOwner.class); if (children != null) { for (PyDocStringOwner owner : children) { final PyStringLiteralExpression docStringExpression = owner.getDocStringExpression(); if (docStringExpression != null) { final DocStringFormat guessed = DocStringUtil.guessDocStringFormat(docStringExpression.getStringValue()); if (guessed != PyDocumentationSettings.DEFAULT_DOC_STRING_FORMAT) { return guessed; } } } } } return PyDocumentationSettings.DEFAULT_DOC_STRING_FORMAT; }