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

Run pyupgrade across codebase to modernize syntax and patterns #1622

Merged
merged 3 commits into from
Jan 17, 2021
Merged

Run pyupgrade across codebase to modernize syntax and patterns #1622

merged 3 commits into from
Jan 17, 2021

Conversation

jdufresne
Copy link
Contributor

pyupgrade is a tool to automatically upgrade syntax for newer versions
of the Python language.

The project has been Python 3 only since
35544e2, allowing for several cleanups:

  • Remove unnecessary "-- coding: utf-8 --" cookie. Python 3 reads all
    source files as utf-8 by default.

  • Replace IOError/EnvironmentError with OSError. Python 3 unified these
    exceptions. The old names are aliases only.

  • Use the Python 3 shorter super() syntax.

  • Remove "utf8" argument form encode/decode. In Python 3, this value is
    the default.

  • Remove "r" from open() calls. In Python 3, this value is the default.

  • Remove u prefix from Unicode strings. In Python 3, all strings are
    Unicode.

  • Replace io.open() with builtin open(). In Python 3, these functions
    are functionally equivalent.

@birkenfeld
Copy link
Member

Looks good, except that the files in tests/examplefiles should not be changed, they are test input.

pyupgrade is a tool to automatically upgrade syntax for newer versions
of the Python language.

The project has been Python 3 only since
35544e2, allowing for several cleanups:

- Remove unnecessary "-*- coding: utf-8 -*-" cookie. Python 3 reads all
  source files as utf-8 by default.

- Replace IOError/EnvironmentError with OSError. Python 3 unified these
  exceptions. The old names are aliases only.

- Use the Python 3 shorter super() syntax.

- Remove "utf8" argument form encode/decode. In Python 3, this value is
  the default.

- Remove "r" from open() calls. In Python 3, this value is the default.

- Remove u prefix from Unicode strings. In Python 3, all strings are
  Unicode.

- Replace io.open() with builtin open(). In Python 3, these functions
  are functionally equivalent.
@jdufresne
Copy link
Contributor Author

Thanks for catching that. Fixed in the latest revision.

@Anteru Anteru added this to the 2.8 milestone Dec 7, 2020
@Anteru Anteru added the changelog-update Items which need to get mentioned in the changelog label Jan 17, 2021
@Anteru
Copy link
Collaborator

Anteru commented Jan 17, 2021

@birkenfeld Ready to merge assuming you're not hacking on things right now?

@birkenfeld
Copy link
Member

Go ahead!

@Anteru Anteru merged commit debda34 into pygments:master Jan 17, 2021
@jdufresne jdufresne deleted the pyupgrade branch January 17, 2021 17:08
@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label Feb 14, 2021
@bl-ue
Copy link

bl-ue commented Mar 22, 2021

I know this was a while ago, but I'd like to add that there was also a yield condensation effected, here.

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.

4 participants