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

[pre-commit.ci] pre-commit autoupdate #248

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.4
rev: v3.19.1
hooks:
- id: pyupgrade
args: ["--py36-plus"]

- repo: https://github.com/psf/black
rev: 20.8b1
rev: 25.1.0
hooks:
- id: black
args: ["--target-version", "py36"]

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.4
- repo: https://github.com/PyCQA/flake8
rev: 7.2.0
hooks:
- id: flake8
additional_dependencies: [flake8-2020]

- repo: https://github.com/pycqa/isort
rev: 5.7.0
rev: 6.0.1
hooks:
- id: isort

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.7.0
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: mixed-line-ending

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.2.1
rev: v4.0.0-alpha.8
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]

- repo: https://github.com/myint/autoflake
rev: v1.4
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args:
Expand Down
2 changes: 1 addition & 1 deletion modernize/fixes/fix_itertools_imports_six.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse) """
"""Fixer for imports of itertools.(imap|ifilter|izip|ifilterfalse)"""

from __future__ import generator_stop

Expand Down
15 changes: 8 additions & 7 deletions modernize/fixes/fix_itertools_six.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
""" Fixer for itertools.(imap|ifilter|izip) -->
(six.moves.map|six.moves.filter|six.moves.zip) and
itertools.ifilterfalse --> six.moves.filterfalse (bugs 2360-2363)
imports from itertools are fixed in fix_itertools_imports_six.py
If itertools is imported as something else (ie: import itertools as it;
it.izip(spam, eggs)) method calls will not get fixed.
"""
"""Fixer for itertools.(imap|ifilter|izip) -->
(six.moves.map|six.moves.filter|six.moves.zip) and
itertools.ifilterfalse --> six.moves.filterfalse (bugs 2360-2363)
imports from itertools are fixed in fix_itertools_imports_six.py
If itertools is imported as something else (ie: import itertools as it;
it.izip(spam, eggs)) method calls will not get fixed.
"""

# This is a derived work of Lib/lib2to3/fixes/fix_itertools_import.py. That file
# is under the copyright of the Python Software Foundation and licensed
# under the Python Software Foundation License 2.
Expand Down
21 changes: 11 additions & 10 deletions modernize/fixes/fix_metaclass.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
"""Fixer for __metaclass__ = X -> (six.with_metaclass(X)) methods.

The various forms of classdef (inherits nothing, inherits once, inherits
many) don't parse the same in the CST, so we look at ALL classes for
a __metaclass__ and if we find one normalize the inherits to all be
an arglist.
The various forms of classdef (inherits nothing, inherits once, inherits
many) don't parse the same in the CST, so we look at ALL classes for
a __metaclass__ and if we find one normalize the inherits to all be
an arglist.

For one-liner classes ('class X: pass') there is no indent/dedent so
we normalize those into having a suite.
For one-liner classes ('class X: pass') there is no indent/dedent so
we normalize those into having a suite.

Moving the __metaclass__ into the classdef can also cause the class
body to be empty so there is some special casing for that as well.
Moving the __metaclass__ into the classdef can also cause the class
body to be empty so there is some special casing for that as well.

This fixer also tries very hard to keep original indenting and spacing
in all those corner cases.
This fixer also tries very hard to keep original indenting and spacing
in all those corner cases.
"""

# This is a derived work of Lib/lib2to3/fixes/fix_metaclass.py. That file
# is under the copyright of the Python Software Foundation and licensed
# under the Python Software Foundation License 2.
Expand Down
1 change: 1 addition & 0 deletions modernize/fixes/fix_raise.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
any client code would have to be changed as well, we don't automate
this.
"""

# Author: Collin Winter, Armin Ronacher
from __future__ import generator_stop

Expand Down
1 change: 1 addition & 0 deletions modernize/fixes/fix_raise_six.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
raise E, V, T -> six.reraise(E, V, T)

"""

# Author : Markus Unterwaditzer
from __future__ import generator_stop

Expand Down
5 changes: 3 additions & 2 deletions modernize/fixes/fix_urllib_six.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""Fix changes imports of urllib which are now incompatible.
This is a copy of Lib/lib2to3/fixes/fix_urllib.py, but modified to point to the
six.moves locations for new libraries instead of the Python 3 locations.
This is a copy of Lib/lib2to3/fixes/fix_urllib.py, but modified to point to the
six.moves locations for new libraries instead of the Python 3 locations.
"""

# This is a derived work of Lib/lib2to3/fixes/fix_urllib.py. That file
# is under the copyright of the Python Software Foundation and licensed
# under the Python Software Foundation License 2.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_fix_imports_six.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import unittest

try:
from six.moves import tkinter
import tkinter
except ImportError:
tkinter = None

Expand Down
4 changes: 2 additions & 2 deletions tests/test_future_behaviour.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _check_on_input(file_content, extra_flags=[]):
try:
tmpdirname = tempfile.mkdtemp()
test_input_name = os.path.join(tmpdirname, "input.py")
with open(test_input_name, "wt") as input:
with open(test_input_name, "w") as input:
input.write(file_content)
modernize_main(extra_flags + ["-w", test_input_name])
_check_for_multiple_futures(test_input_name, file_content)
Expand Down Expand Up @@ -94,7 +94,7 @@ def test_two_files_on_single_run():
os.path.join(tmpdirname, f"input_{idx}.py") for idx in range(0, 3)
]
for input_name in input_names:
with open(input_name, "wt") as input:
with open(input_name, "w") as input:
input.write(TWO_PRINTS_CONTENT)
modernize_main(["-w"] + input_names)
for input_name in input_names:
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def check_on_input(
tmpdirname = tempfile.mkdtemp()
try:
test_input_name = os.path.join(tmpdirname, "input.py")
with open(test_input_name, "wt") as input_file:
with open(test_input_name, "w") as input_file:
input_file.write(input_content)

def _check(this_input_content, which_check, check_return_code=True):
Expand Down
Loading