简体   繁体   English

为什么Sphinx无法记录我的课程?

[英]Why does Sphinx not document my class?

I have a module with 4 classes 我有一个4类的模块

class B(object):
    """Docstring for B."""
    pass

class C(B):
    """Docstring for C."""
    pass

class D(B):
    """Docstring for D."""
    pass

class A(object):
    """Docstring for A."""
    c = C()
    d = D()

Only class A is made accessible in the API, together with its attributes c and d (instances of C and D) API中仅可访问类A及其属性c和d(C和D的实例)

The Sphinx generated documentation only shows classes A, C and D Sphinx生成的文档仅显示A,C和D类

Is that expected behaviour? 那是预期的行为吗?

There was nothing wrong with Sphinx. Sphinx没有错。 The problem was that I had a line of code between the "class" line and the docstring. 问题是我在“类”行和文档字符串之间有一行代码。 Now that that I have removed that it works perfectly - embarrassed 现在,我删除了它,它可以正常工作-感到尴尬

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM