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

Use general OSError and more Python3 defaults from pyupgrade #19241

Closed
wants to merge 3 commits into from
Closed

Use general OSError and more Python3 defaults from pyupgrade #19241

wants to merge 3 commits into from

Conversation

eumiro
Copy link

@eumiro eumiro commented Jan 5, 2021

PR Summary

Running pyupgrade --py3-plus and ignoring all string updates (percent/format/f) to use defaults introduced in Python3.

PR Checklist

  • [N/A] Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • [N/A] New features are documented, with examples if plot related.
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • [N/A] Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, and welcome to Matplotlib!

Generally 👍 apart from the changes to versioneer.py.

versioneer.py Outdated
@@ -339,7 +339,6 @@

"""

from __future__ import print_function
Copy link
Member

@timhoffm timhoffm Jan 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't change anything in versioneer.py. It's a vendored file from (https://github.com/python-versioneer/python-versioneer) with slight modifications. Additional local changes make it harder to pull in changes from the upstream version.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @timhoffm . I have removed versioneer.py from my PR entirely.

According to PEP 3151, OSError can be used for all system-related exceptions and thus replace IOError, EnvironmentError, socket.error, etc.
Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the raise OSError(' for missing files should probably be FileNotFoundError instead.

@@ -71,7 +71,7 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False):
stderr=(subprocess.PIPE if hide_stderr
else None))
break
except EnvironmentError:
except OSError:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not bother changing this file either as it will be deleted by #18971 .

@jklymak jklymak marked this pull request as draft May 10, 2021 19:42
@eumiro eumiro closed this by deleting the head repository Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants