Skip to content
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

Pyupgrade 3.6: Update syntax with Python 3.6+ features #23275

Closed
wants to merge 0 commits into from

Conversation

EwoutH
Copy link
Contributor

@EwoutH EwoutH commented Dec 20, 2021

Updated Python code with Python 3.6+ features:

  • utf-8 encoding is now the default (PEP 3120, Python 3.0+)
  • Replace list comprehensions by Generator Expressions (PEP 289, Python 2.4+)
  • Replace yield loop by yield from (PEP 380, Python 3.3+)
  • Replace the IOError alias by OSError (PEP 3151, Python 3.3+)
  • Remove the default subclass (object) when defining a class
  • Define sets with curly braces {} instead of set()
  • Remove "r" parameter from open function, which is default

Used pyupgrade 2.29.1 with --py36-plus as starting point for this PR.

@EwoutH EwoutH force-pushed the pyupgrade-36 branch 2 times, most recently from 93eea23 to 8d5513e Compare December 23, 2021 14:14
@EwoutH
Copy link
Contributor Author

EwoutH commented Dec 23, 2021

Thanks for the suggestions, I implemented them, squashed the commits, rebased and signed it.

@adeebshihadeh
Copy link
Contributor

Can you fix the failing tests?

@EwoutH
Copy link
Contributor Author

EwoutH commented Dec 24, 2021

I think replacing the list() by [] as @GregorKikelj suggested didn't play well with the lambda, so I reverted it. I did this a bit to quick, and accidentally reset the whole branch. Luckily git reflow is a thing and I recovered it. I couldn't get this PR reopened though, so it's now #23305.

(note to self: be really careful touching git reset --hard)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants