The documentation code with the problem is at the beginning of a method:
"""
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
"""
The warnings are:
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.
What can be done to remove these warnings and their cause(s)?
“IndentationError: unexpected indent” is raised when you indent a line of code too many times. To solve this error, make sure all of your code uses consistent indentation and that there are no unnecessary indents.
This error occurs when a statement is unnecessarily indented or its indentation does not match the indentation of former statements in the same block. Python not only insists on indentation, it insists on consistent indentation .
The cause of Indentation Error in Python Since python makes use of procedural language, if you miss out on adding tabs or spaces between your lines of code, then you will most likely experience this error.
Just add a blank line after the summary description of the method, before the description of the parameters:
"""
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 you can find this advice:
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.
Maybe this will help somebody who stumbles upon this question - in my case I was getting a bunch of warnings that were because I was using Google style docstrings. Just add "sphinx.ext.napoleon" to the extensions
list in conf.py and the warnings should go away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With