-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-101100: Fix references in csv docs #114658
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
Conversation
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.
Thank you!
is #101100 the correct issue to reference?
Yep :)
With these changes, nitpicky mode in Sphinx seems happy with csv.rst.
And the CI has failed... But in a good way! It says:
Congratulations! You improved:
Doc/library/csv.rst
Please remove from Doc/tools/.nitignore
Doing this means the CI will also prevent new warnings from appearing in this file.
Doc/library/csv.rst
Outdated
@@ -492,9 +492,9 @@ DictReader objects have the following public attribute: | |||
Writer Objects | |||
-------------- | |||
|
|||
:class:`Writer` objects (:class:`DictWriter` instances and objects returned by | |||
:class:`Writer<writer>` objects (:class:`DictWriter` instances and objects returned by |
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.
We usually add a space here:
:class:`Writer<writer>` objects (:class:`DictWriter` instances and objects returned by | |
:class:`Writer <writer>` objects (:class:`DictWriter` instances and objects returned by |
Although, I don't see a Writer
class with capital W, is it only capitalised because it begins the sentence? If so, I'd either reword so it's not first, or leave it lowercase.
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.
Yes, I left it capitalized. I suspect the original author may have done it that way. I just added a proper reference. The csv
module dates from the days when types (written in C) and classes (written in Python) were not quite the same thing. Type names generally weren't capitalized (I think, hence csv.writer
), while classes were, hence csv.DictWriter
.
Co-authored-by: Hugo van Kemenade <[email protected]>
@hugovk I think I made all the suggested changes... |
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.
Looks good, thanks!
Just want to double check the write
.
@@ -88,7 +88,7 @@ The :mod:`csv` module defines the following functions: | |||
|
|||
Return a writer object responsible for converting the user's data into delimited | |||
strings on the given file-like object. *csvfile* can be any object with a | |||
:func:`write` method. If *csvfile* is a file object, it should be opened with | |||
:meth:`~io.TextIOBase.write` method. If *csvfile* is a file object, it should be opened with |
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.
@serhiy-storchaka Is this the correct one for write
in this case?
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 guess it is.
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.
Good question. I mulled that over a bit before using TextIOBase
, eventually deciding that since CSV files are supposed to be opened as plain text files since Python 3, that was the most reasonable link destination.
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.
You can also explicitly mention that write()
should accept a string argument (not bytes). And the same for the reader.
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.
LGTM.
Perhaps we can rename csvwriter
to writer
, but it is a separate issue, and it may have pitfalls.
@@ -88,7 +88,7 @@ The :mod:`csv` module defines the following functions: | |||
|
|||
Return a writer object responsible for converting the user's data into delimited | |||
strings on the given file-like object. *csvfile* can be any object with a | |||
:func:`write` method. If *csvfile* is a file object, it should be opened with | |||
:meth:`~io.TextIOBase.write` method. If *csvfile* is a file object, it should be opened with |
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 guess it is.
Since there is no type called |
|
In the spirit of incremental changes, shall we merge this as-is (it does what it set out to do: fix reference warnings), and make a new PR for any further changes? |
Thanks @smontanaro for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
Sorry, @smontanaro and @serhiy-storchaka, I could not cleanly backport this to
|
Sorry, @smontanaro and @serhiy-storchaka, I could not cleanly backport this to
|
Co-authored-by: Hugo van Kemenade <[email protected]> (cherry picked from commit 3911b42)
@serhiy-storchaka @hugovk I attempted to create the two pull requests. Please take a look and let me know if I missed something or resolved the |
Not sure what you're referring to. I was just executing the cherry-picker commands the bedevere not have. Did I mess something up? |
I don't know if it was you or The PR branches themselves were fine, though. That is, the error was in the creation of the PRs, not the creation of the backports. |
That's weird. I did run the commands from my 3.12 and 3.11 repos. |
GH-114771 is a backport of this pull request to the 3.12 branch. |
GH-114773 is a backport of this pull request to the 3.11 branch. |
Co-authored-by: Hugo van Kemenade <[email protected]> (cherry picked from commit 3911b42)
Co-authored-by: Hugo van Kemenade <[email protected]> (cherry picked from commit 3911b42)
Co-authored-by: Hugo van Kemenade <[email protected]>
This is my first attempt at this. Hopefully I've done it correctly. I would appreciate checks on my changes and the mechanics (is gh-101100 the correct issue to reference?). Thanks to @hugovk for helping me get started. There are two types of changes herein:
Dialect
documentation reflecting that it really doesn't have any callable methods, and – in particular – lacks avalidate
method. (Validation is implicit when instantiating the class.)With these changes, nitpicky mode in Sphinx seems happy with
csv.rst
.📚 Documentation preview 📚: https://cpython-previews--114658.org.readthedocs.build/