-
-
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
Docstrings examples for string methods #7669
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Solves the incosistent whitespace error
…array into docstring-examples
for more information, see https://pre-commit.ci
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.
Very nice addition!
xarray/core/accessor_str.py
Outdated
Dimensions without coordinates: x | ||
|
||
Using regex: | ||
>>> pat = "jj\\w+" |
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.
Maybe we could come up with a more interesting example.
Maybe add a number after one of the "jj" in the DataArray, and then look for "jj\d"?
But this version is already a good start.
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.
Will do, thank you!
xarray/core/accessor_str.py
Outdated
Dimensions without coordinates: x | ||
|
||
Using regex: | ||
>>> pat = "jj\\w+" |
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.
It seems that the build system does not like the double escaped strings.
No idea how to solve this though, maybe we could use a raw string pat = r"jj\w+"
?
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've tried using the raw string but I had to also escape the backslash pat = r"jj\\w+"
for the warning to disappear.
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, then I think this is a bug of our docstring parser.
The problem is that if we use this example, it will pass the CI pipeline, but it will be actually wrong?
Or how does this render in the webpage?
Maybe we can construct an example without backslashes?
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.
Yeah! I think I can just use [a-z] or [0-9].
…array into docstring-examples
for more information, see https://pre-commit.ci
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've got a few more suggestions, but otherwise this does look good to me.
The failing docs CI is caused by pydata-sphinx-theme=0.13.2
being incompatible with sphinx-book-theme=1.0.0
. I think we can pin pydata-sphinx-theme!=0.13.2
until they fixed that (though maybe that should be done in a new PR).
…array into docstring-examples
for more information, see https://pre-commit.ci
Just saw this comment. I have opened #7703 for this |
The docs build failure is real, from some rst formatting error
|
I'll fix it! |
Thanks @remigathoni great PR! |
* main: Bump codecov/codecov-action from 3.1.2 to 3.1.3 (pydata#7781) Fix whats-new [skip-ci] dev whats-new (pydata#7775) [skip-ci] Release 2023.04.2 (pydata#7774) Fix groupby_bins when labels are specified (pydata#7769) Docstrings examples for string methods (pydata#7669) Add dev whats-new Add benchmark against latest release on main. (pydata#7753)
Adds docstring examples to some string methods (#6793 ).
Please let me know if there are any changes I need to make. Thank you!