我试图使我的文档字符串易于阅读,并且在使用Intersphinx和Napoleon时遇到困难。我有这样的课程:
from long_import_path_one.long_import_path_two import Bar
from long_import_path_one.long_import_path_three import Baz
from long_import_path_one.long_import_path_four import Qux
from long_import_path_five.long_import_path_six import FooBar
class FooWithHorribleDocstrings(object):
"""
Data flows out through the :py:class:`long_import_path_one.long_import_path_two.Bar`
which owns a collection of :py:class:`long_import_path_one.long_import_path_three.Baz`
objects that read from a :py:class:`long_import_path_one.long_import_path_four.Qux`
and post to the backend using the :py:class:`long_import_path_five.long_import_path_six.FooBar`
"""
class FooWithCleanDocstrings(object):
"""
Data flows out through the ``Bar`` which owns a collection of ``Baz`` objects
that read from a ``Qux`` and post to the backend using the ``FooBar``
"""
如果我已经导入了模块,我需要完全限定的名称似乎有点可笑,但是我还没有找到一种方法来使它起作用。有什么建议吗?