有问题的文档代码位于方法的开头:
"""
Gtk.EventBox::button-release-event signal handler.
:param widget: The clicked widget (The Gtk.EventBox).
:param event: Gdk.EventButton object with information regarding
the event.
:param user_data: The Gtk.LinkButton that should be opened when
the Gtk.EventBox is clicked.
:return: None
"""
警告是:
C:/msys64/home/hope/python+gtk/test/main.py:docstring of main.Builder.advertisem
ent_clicked:4: WARNING: Unexpected indentation.
C:/msys64/home/hope/python+gtk/test/main.py:docstring of main.Builder.advertisem
ent_clicked:5: WARNING: Block quote ends without a blank line; unexpected uninde
nt.
可以采取哪些措施来消除这些警告及其原因?
最佳答案
只需在方法的摘要描述之后,参数描述之前添加一个空行:
"""
Gtk.EventBox::button-release-event signal handler.
:param widget: The clicked widget (The Gtk.EventBox).
:param event: Gdk.EventButton object with information regarding
the event.
:param user_data: The Gtk.LinkButton that should be opened when
the Gtk.EventBox is clicked.
:return: None
"""
Here你可以找到这个建议:
If you get a Sphinx build error that says “Unexpected indentation,” it is probably because Sphinx is expecting a blank line, such as after a literal text block. Your line may have wrapped and confused Sphinx. In this case, try pulling the text up to the previous line even if it extends out past the margin of your window. Or, you could press Enter to go to the next line, but be sure to indent the text on the new line.
关于python-2.7 - 生成代码文档时如何排除意外缩进警告的原因?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45880348/