Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

wrong rendering of multi-line "Return" section #4

Open
carlodri opened this issue Aug 29, 2018 · 4 comments
Open

wrong rendering of multi-line "Return" section #4

carlodri opened this issue Aug 29, 2018 · 4 comments

Comments

@carlodri
Copy link

My source docstring inside a class method (correct indent of multiple lines):

        Returns:
            ndarray: a 2-D ``int16`` numpy array with dimensions :math:`(n_e, 2)` where
                the rows represent the :math:`(x, y)` coordinates of the :math:`n_e` events
                detected in the frame.

renders badly in this way:

image

whereas if I change it to this (wrong indentation of multiple lines):

        Returns:
            ndarray: a 2-D ``int16`` numpy array with dimensions :math:`(n_e, 2)` where
            the rows represent the :math:`(x, y)` coordinates of the :math:`n_e` events
            detected in the frame.

it renders correctly to:

image

I'm using the sphinx_rtd_theme but a similar issue occurs with the default alabaster theme.

@ExplodingCabbage
Copy link

Not sure whether anything should change in Napoleon, but for whatever it's worth, you can also get the result you want by using this indentation which I don't think is incorrect in any way:

Returns:
    ndarray:
        a 2-D ``int16`` numpy array with dimensions :math:`(n_e, 2)` where
        the rows represent the :math:`(x, y)` coordinates of the :math:`n_e` events
        detected in the frame.

@carlodri
Copy link
Author

thanks @ExplodingCabbage, I will try that! However, as per the examples in the documentation the first syntax I showed should be correct, whereas it doesn't work properly.

@baylessj
Copy link

It looks to me like from this portion of the Google python styleguide: https://google.github.io/styleguide/pyguide.html#doc-function-returns that all of the Returns: code should all be at the same level of indentation, but it seems confusing given that this is not the case for arguments.

I'm not sure if the ideal behavior would be to have the additional level of indentation in return values be accepted or if there should be a note in the docs/a warning thrown when doing this style of indentation. Either way, I also find the current behavior less than ideal.

rsgowman added a commit to firebase/firebase-admin-python that referenced this issue May 12, 2020
rsgowman added a commit to firebase/firebase-admin-python that referenced this issue May 13, 2020
@GiliR4t1qbit
Copy link

Any news on a solution to this issue or a workaround? I'm in the same position. The style guide and examples do not state clearly what should happen, but given the way it is for arguments, I believe @carlodri is right.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants