-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Clean up python2 style code #7294
Clean up python2 style code #7294
Conversation
861d194
to
2a813c8
Compare
Note that, as mentioned by @ulyssessouza (here), we won't be merging on master,
That is why I thought it would be appropriate to merge on top of 1.26.x, since this is a 1.26.x Goal anyway. |
@alexrecuenco Could you please rebase so that we can include it in the next RC? |
c1dfb0b
to
3ddcc25
Compare
Do you mean to rebase on master? Or on |
3ddcc25
to
ec66c1b
Compare
ec66c1b
to
8f7d7d1
Compare
@alexrecuenco Rebase with from By the way, the removal of python2 was already merged in another PR. |
8f7d7d1
to
db01591
Compare
I don't think I can rename the branch, for that I would need to make a new PR, let me know if you prefer that. Other than that, it should be rebased now. |
The renaming was just for the title of the PR. The branch name has no impact |
1357f25
to
7076d7f
Compare
Closes: docker#6890 Some remarks, - `# coding ... utf-8` statements are not needed - isdigit on strings instead of a try-catch. - Default opening mode is read, so we can do `open()` without the `'r'` everywhere - Removed inheritinng from `object` class, it isn't necessary in python3. - `super(ClassName, self)` can now be replaced with `super()` - Use of itertools and `chain` on a couple places dealing with sets. - Used the operator module instead of lambdas when warranted `itemgetter(0)` instead of `lambda x: x[0]` `attrgetter('name')` instead of `lambda x: x.name` - `sorted` returns a list, so no need to use `list(sorted(...))` - Removed `dict()` using dictionary comprehensions whenever possible - Attempted to remove python3.2 support Signed-off-by: alexrecuenco <alejandrogonzalezrecuenco@gmail.com>
Removed unused versions, (we only support python3.4 onwards) Signed-off-by: alexrecuenco <alejandrogonzalezrecuenco@gmail.com>
7076d7f
to
46624ce
Compare
Thank you, I added your suggestion and rebased again on |
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!
This branch works on top of the PR by @venthur rebasing the branch on top of
1.26.x
pyupgrade
to the pre-commit hooks to allow an easier transition for developers used to python2.NOTNOTE: The only change to code-style when transferring to python3 I am not sure if people would agree is the change fromlambda c: c.name
to the more modern use of the operator module withattrgetter('name')
Closes: #6890
Resolves #6890
Signed-off-by: alexrecuenco alejandrogonzalezrecuenco@gmail.com