String (@NotNull List<String> flags, @NotNull Module module, @NotNull DocStringFormat format, @NotNull String docstring) { String result = null; try { result = ApplicationUtil.runWithCheckCanceled( () -> PythonRuntimeService.getInstance().formatDocstring(module, format, docstring, flags), // It's supposed to be run inside a non-blocking read action and, thus, have an associated progress indicator EmptyProgressIndicator.notNullize(ProgressManager.getInstance().getProgressIndicator()) ); } catch (ProcessCanceledException e) { throw e; } catch (Exception e) { LOG.warn(e); } if (result != null) { return result; } else if (!flags.contains(FORMATTER_FRAGMENTS_FLAG)) { return DocStringUtil.parseDocStringContent(format, docstring).getDescription(); } return ""; }