-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blacken the doctest code in docstrings #3857
Conversation
pd.Timestamp(2001, 2, 1)]], | ||
dims=['time']) | ||
>>> da.sel(time='2001-01-01') | ||
>>> da = xr.DataArray( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had thought the standard was a blank line after each result; is that a general standard or was I holding that incorrectly?
(no need to do it this round though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same impression, but the docs say otherwise:
Expected output cannot contain an all-whitespace line, since such a line is taken to signal the end of expected output. If expected output does contain a blank line, put
<BLANKLINE>
in your doctest example each place a blank line is expected.
I think that means that we only need the newline if we want to continue with normal text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. IIUC we can still have blank lines, but it becomes a preference rather than enforced.
FWIW I do find they make it much easier to read the examples!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good. Let's do that in a new PR, though.
Looks great! Congrats on such a good tool! |
Thanks @keewis |
* upstream/master: add spacing in the versions section of the issue report (pydata#3876) map_blocks: allow user function to add new unindexed dimension. (pydata#3817) Delete associated indexes when deleting coordinate variables. (pydata#3840) remove macos build while waiting for libwebp fix (pydata#3875) Fix html repr on non-str keys (pydata#3870) Allow ellipsis to be used in stack (pydata#3826) Improve where docstring (pydata#3836) Add DataArray.pad, Dataset.pad, Variable.pad (pydata#3596) Fix some warnings (pydata#3864) Feature/weighted (pydata#2922) Fix recombination in groupby when changing size along the grouped dimension (pydata#3807) Blacken the doctest code in docstrings (pydata#3857) Fix multi-index with categorical values. (pydata#3860) Fix interp bug when indexer shares coordinates with array (pydata#3758) Fix alignment with join="override" when some dims are unindexed (pydata#3839)
With a bit of preparation this is the result of running black-doctest on the repository. The tool itself is experimental but I didn't find any issues after manually reviewing the changes. The exact call was:
python -m blackdoc .
I'm not too sure what line length we use for docstrings (I used the default of
88
for this run), but if we'd like a different number we can just rerun the tool.python -m pytest --doctest-modules xarray/core
still fails but from what I saw these failures are not due to changes in this PR.isort -rc . && black . && mypy . && flake8
whats-new.rst
for all changes andapi.rst
for new API