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.
Description
Describe what this change achieves.
This package only supports Python 3, however it still uses the six compatibility library to support Python 2 and 3.
This PR removes the dependency, and replaces the six calls with direct Python 3 code.
This makes the install a bit quicker, smaller, and the code a bit faster by using the standard library instead of a package.
Issues Resolved
List any issues this PR will resolve, e.g. Closes [...].
None known.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.
I did this using the https://github.com/asottile/pyupgrade tool that upgrades Python syntax.
We could run it on all the files, and upgrade to Python 3.8+ syntax (
--py38-plus
), but I wanted to keep the diff small, so I only ran it on files using six, and did the lowest syntax upgrade (--py3-plus
):rg six -l | xargs pyupgrade --py3-plus
(I do recommend running it on the whole codebase and for 3.8+, perhaps in another PR. For example
pyupgrade **/*.py --py38-plus
upgrades 84 further files.)This PR also removes creation of universal wheels, that's only needed when supporting Python 2, and corrects the Black target version.