-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
gh-136858: Adds an example of writing a tarfile using stdin #137510
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
base: main
Are you sure you want to change the base?
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.
I am not sure if this PR adds high value the content. We could drop it.
@@ -104,7 +104,7 @@ Some facts and figures: | |||
| ``'w'`` or | Open for uncompressed writing. | | |||
| ``'w:'`` | | | |||
+------------------+---------------------------------------------+ | |||
| ``'w:gz'`` | Open for gzip compressed writing. | | |||
| ``'w:gz'`` | Open for gzip-compressed writing. | |
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.
Why are you hyphenating these? The following line has bzip2 compressed without hyphens.
How to create and write an archive to stdout using | ||
:data:`sys.stdout.buffer <sys.stdout>` in the *fileobj* parameter | ||
in :meth:`TarFile.add`:: | ||
in :meth:`TarFile.open`:: |
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.
This demonstrates .add
not open.
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.
add
does not have a fileobj
parameter.
@@ -1367,6 +1367,12 @@ How to extract an entire tar archive to the current working directory:: | |||
tar.extractall(filter='data') | |||
tar.close() | |||
|
|||
The same example using the :keyword:`with` statement:: |
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 could replace the example with the with
statement. We don't need an additional example.
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 should drop it as well in the "Writing examples" section.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
It's fine by me if we drop it 👍 |
with
statement.TarFile.add
instead ofTarFile.open
.📚 Documentation preview 📚: https://cpython-previews--137510.org.readthedocs.build/