PyDsphinx文档和PopDthump文档

2024-05-23 18:35:54 发布

您现在位置:Python中文网/ 问答频道 /正文

让我们想象一下,我希望看到PyCharm4.5社区版中一个简单方法的docstring弹出窗口(也在5.0中尝试过)。在

我用epytext语法(Epydoc generator自2008年起不受支持,仅适用于Python2)和restructedText语法(Sphinx积极支持的生成器使用它,用于正式的python文档)

epytextone可以完美地在PyCharm文档弹出窗口中工作

PyCharm works with epytext Screenshot

但是structuredText一个根本不显示任何参数!在

PyCharm fails with reStructuredText Screenshot

尝试用PyCharm设置来处理这个问题,阅读PyCharm帮助,搜索PyCharm bugtracker并使用Google都无法帮助我找到PyCharm中这些docstring弹出窗口不能与社区推荐的docstring标记语言一起正常工作的原因。在

因为这个功能需求低?也许,在PyCharm或者其他IDE中,是否有一些有用的替代方法来查看现代文档标记?我还需要能够生成HTML格式的文档页。在

我在这里发现了another topic,与同一个问题有关,但自去年以来仍然没有答案。所以,我想在现代IDE中查看现代文档的愿望有什么问题。在

下面是我的代码示例

def find_links(self, issue, link_type):
    """

    Find all issues linked with C{issue} with C{link_type}.

    @param issue: Issue key
    @type issue: str
    @param link_type: Accepts either Type Name (like 'Child') or Link Description (like 'child of')
    @type link_type: str
    @return: Keys of found issues
    @rtype: list

    """
    result_keys = []
    link_list = self.get_link_list(issue)
    for link in link_list:
        ... # omitted
    return result_keys

def test_sphinx_docs_method(self, issue, link_type):
    """

    Find all issues linked with *issue* with *link_type*.

    :param issue: Issue key
    :type issue: str
    :param link_type: Accepts either Type Name (like 'Child') or Link Description (like 'child of')
    :type link_type: str
    :return: Keys of found issues
    :rtype: list

    """
    result_keys = []
    link_list = self.get_link_list(issue)
    for link in link_list:
        ... # omitted
    return result_keys

Tags: of文档selfreturnparamtypewithlink
2条回答

看起来您正在逐行读取流,而不管数据块是如何传入的(BufferedReader负责将数据重新帧化为行)。但是,没有人保证单个块包含单个json记录。服务器可以根据其内部缓冲区来分块数据

在解析流时,您可以看看Jackson流API。编程模型稍微复杂一点,但它可能适合您的需要。实例 https://www.baeldung.com/jackson-streaming-api或默认的jre实现https://docs.oracle.com/javaee/7/api/javax/json/stream/package-summary.html

您可以使用StringBuilder获得所需的结果

try {
     StringBuilder sb = new StringBuilder();
     while ((line = br.readLine()) != null) {
         sb.append(line);
     }
     LOGGER.info("readLine(): {}", sb.toString());
} catch (IOException e) {
    throw new RuntimeException("Unable to read status event stream", e);
}

相关问题 更多 >