bpo-32695: Add docs and tests for compresslevel and preset in tarfile#5397
Closed
bbayles wants to merge 11 commits into
Closed
bpo-32695: Add docs and tests for compresslevel and preset in tarfile#5397bbayles wants to merge 11 commits into
bbayles wants to merge 11 commits into
Conversation
bbayles
commented
Jan 28, 2018
vadmium
reviewed
Jan 29, 2018
|
Hi, is there anything I can help with to get this pull request move forward? :) I recently encounter the same It will be really nice if the document mentions that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've changed almost all of this - this PR now adds tests for
compresslevel(these were lacking before) and documentspreset(this was undocumented before).This PR fixestarfile.open()when using thew:xzmode and acompresslevelparameter.TarFile.xzopen()seems to want to do whatTarFile.gzopen()andTarFile.bzopen()do (see here), but it uses the keywordpresetinstead ofcompresslevel.This means the preset never gets passed tolzma.LZMAFile(), thecompresslevelkeyword is thus picked up by**kwargsand passed toTarFile.__init__(), which doesn't recognize it.In this PR I change the signature ofTarFile.xzopen()to match its neighbors. I also changeTarFile.taropen()and document thatcompresslevelis meaningless when not using one of thew:<some compression>modes. (compresslevelis already ignored when using a read mode; you can dotarfile.open('/tmp/dummy.tar.gz', 'r:gz', compresslevel='kittens')and not get an exception).I also add tests forcompresslevelwith the various modes; these were lacking previously.https://bugs.python.org/issue32695