I am creating autogenerated documentation for a python class using sphinx, and at a few points I need to write pseudocode. The offending docstring is below:
def _get_empty_filter_params(self) -> dict:
"""
Get a dict populated with keys needed to initialize the filter if they are not set yet.
This dict must have the following structure:
filter_params = {'Parameter 1': {'Type': <int, float, or str>,
'Value': <value> or None,
'Options': [<option 1>, <option 2>, ... ] or None,
'Min': <min value> or None,
'Max': <max value> or None
},
...
}
:return: the dict that must be filled in to initialize the filter
:rtype: dict
"""
pass
When compiling this, I get the following error:
[...]MetaFilter.py:docstring of utils.MetaFilter.MetaFilter._get_empty_filter_params:9: WARNING: Block quote ends without a blank line; unexpected unindent.
[...]MetaFilter.py:docstring of utils.MetaFilter.MetaFilter._get_empty_filter_params:10: WARNING: Block quote ends without a blank line; unexpected unindent.
Some googling suggested that I could do this as an inline code block, like so:
"""
Get a dict populated with keys needed to initialize the filter if they are not set yet.
This dict must have the following structure:
..code-block:: python
filter_params = {'Parameter 1': {'Type': <int, float, or str>,
'Value': <value> or None,
'Options': [<option 1>, <option 2>, ... ] or None,
'Min': <min value> or None,
'Max': <max value> or None
},
...
}
:return: the dict that must be filled in to initialize the filter
:rtype: dict
"""
but this does not address the error. I am assuming the issue relates to special characters that need to be properly escaped, but I have tried to escape everything that isn’t a basic letter in that block and it does not seem to help. Can anyone shed some light on what is causing the issue?