Skip to content
Snippets Groups Projects
user avatar
Matt Harbison authored
These were different classes in py2, but now a handful of error classes are just
an alias of `OSError`, like `IOError`, `EnvironmentError`, `WindowsError`, etc.

This is the result of running a hacked version of `pyupgrade` 3.19.1[1]

    $ hg files -0 'relglob:**.py' | xargs -0 \
        pyupgrade --py38-plus --keep-percent-format --keep-mock --keep-runtime-typing

The hack is because it doesn't have command line switches to disable most
changes, so it makes tons of unrelated changes all at once.  The hack is to

  1) patch `pyupgrade._main._fix_tokens()` to immediately return its content arg
  2) change `pyupgrade._data.register_decorator()` to only register the function
     if it's from the fixer we're interested in:

      if func.__module__ in (
          "pyupgrade._plugins.exceptions",
      ):
          FUNCS[tp].append(func)

      return func

[1] https://github.com/asottile/pyupgrade
24ee91ba
History
Name Last commit Last update
..
__init__.py
demandimportpy3.py
tracing.py