Fix CI by upgrading AP templates
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 7d156a1..5a13dac 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -13,32 +13,32 @@
- id: double-quote-string-fixer
- id: requirements-txt-fixer
- repo: https://gitlab.com/pycqa/flake8
- rev: 3.7.1
+ rev: 3.7.9
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-autopep8
- rev: v1.4.3
+ rev: v1.5
hooks:
- id: autopep8
- repo: https://github.com/pre-commit/pre-commit
- rev: v1.14.2
+ rev: v2.0.1
hooks:
- id: validate_manifest
- repo: https://github.com/asottile/reorder_python_imports
- rev: v1.3.5
+ rev: v1.9.0
hooks:
- id: reorder-python-imports
language_version: python3
- repo: https://github.com/asottile/pyupgrade
- rev: v1.11.1
+ rev: v1.26.2
hooks:
- id: pyupgrade
- repo: https://github.com/asottile/add-trailing-comma
- rev: v0.7.1
+ rev: v1.5.0
hooks:
- id: add-trailing-comma
- repo: https://github.com/pre-commit/mirrors-mypy
- rev: v0.660
+ rev: v0.761
hooks:
- id: mypy
language_version: python3
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 3156958..1337dc6 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -10,7 +10,7 @@
type: github
endpoint: github
name: asottile/azure-pipeline-templates
- ref: refs/tags/v0.0.8
+ ref: refs/tags/v1.0.0
jobs:
- template: job--pre-commit.yml@asottile
diff --git a/pre_commit_hooks/check_ast.py b/pre_commit_hooks/check_ast.py
index 0df3540..cb33ea0 100644
--- a/pre_commit_hooks/check_ast.py
+++ b/pre_commit_hooks/check_ast.py
@@ -23,14 +23,15 @@
with open(filename, 'rb') as f:
ast.parse(f.read(), filename=filename)
except SyntaxError:
- print('{}: failed parsing with {} {}:'.format(
- filename,
- platform.python_implementation(),
- sys.version.partition(' ')[0],
- ))
- print('\n{}'.format(
- ' ' + traceback.format_exc().replace('\n', '\n '),
- ))
+ print(
+ '{}: failed parsing with {} {}:'.format(
+ filename,
+ platform.python_implementation(),
+ sys.version.partition(' ')[0],
+ ),
+ )
+ tb = ' ' + traceback.format_exc().replace('\n', '\n ')
+ print('\n{}'.format(tb))
retval = 1
return retval
diff --git a/pre_commit_hooks/check_merge_conflict.py b/pre_commit_hooks/check_merge_conflict.py
index 74e4ae1..2a03c3a 100644
--- a/pre_commit_hooks/check_merge_conflict.py
+++ b/pre_commit_hooks/check_merge_conflict.py
@@ -41,9 +41,11 @@
for i, line in enumerate(inputfile):
for pattern in CONFLICT_PATTERNS:
if line.startswith(pattern):
- print(WARNING_MSG.format(
- pattern.decode(), filename, i + 1,
- ))
+ print(
+ WARNING_MSG.format(
+ pattern.decode(), filename, i + 1,
+ ),
+ )
retcode = 1
return retcode
diff --git a/pre_commit_hooks/fix_encoding_pragma.py b/pre_commit_hooks/fix_encoding_pragma.py
index 23fc79f..31bb52c 100644
--- a/pre_commit_hooks/fix_encoding_pragma.py
+++ b/pre_commit_hooks/fix_encoding_pragma.py
@@ -25,9 +25,11 @@
)
-class ExpectedContents(collections.namedtuple(
- 'ExpectedContents', ('shebang', 'rest', 'pragma_status', 'ending'),
-)):
+class ExpectedContents(
+ collections.namedtuple(
+ 'ExpectedContents', ('shebang', 'rest', 'pragma_status', 'ending'),
+ ),
+):
"""
pragma_status:
- True: has exactly the coding pragma expected
@@ -138,9 +140,11 @@
)
retv |= file_ret
if file_ret:
- print(fmt.format(
- pragma=args.pragma.decode(), filename=filename,
- ))
+ print(
+ fmt.format(
+ pragma=args.pragma.decode(), filename=filename,
+ ),
+ )
return retv
diff --git a/pre_commit_hooks/string_fixer.py b/pre_commit_hooks/string_fixer.py
index a41b737..813ef64 100644
--- a/pre_commit_hooks/string_fixer.py
+++ b/pre_commit_hooks/string_fixer.py
@@ -45,9 +45,8 @@
splitcontents = list(contents)
# Iterate in reverse so the offsets are always correct
- tokens = reversed(list(tokenize.generate_tokens(
- io.StringIO(contents).readline,
- )))
+ tokens_l = list(tokenize.generate_tokens(io.StringIO(contents).readline))
+ tokens = reversed(tokens_l)
for token_type, token_text, (srow, scol), (erow, ecol), _ in tokens:
if token_type == tokenize.STRING:
new_text = handle_match(token_text)
diff --git a/pre_commit_hooks/util.py b/pre_commit_hooks/util.py
index d68e769..3b960e3 100644
--- a/pre_commit_hooks/util.py
+++ b/pre_commit_hooks/util.py
@@ -12,9 +12,8 @@
def added_files(): # type: () -> Set[str]
- return set(cmd_output(
- 'git', 'diff', '--staged', '--name-only', '--diff-filter=A',
- ).splitlines())
+ cmd = ('git', 'diff', '--staged', '--name-only', '--diff-filter=A')
+ return set(cmd_output(*cmd).splitlines())
def cmd_output(*cmd, **kwargs): # type: (*str, **Any) -> str
diff --git a/tests/check_builtin_literals_test.py b/tests/check_builtin_literals_test.py
index 19263b7..8e18854 100644
--- a/tests/check_builtin_literals_test.py
+++ b/tests/check_builtin_literals_test.py
@@ -121,9 +121,9 @@
def test_ignore_constructors():
- visitor = Visitor(ignore=(
- 'complex', 'dict', 'float', 'int', 'list', 'str', 'tuple',
- ))
+ visitor = Visitor(
+ ignore=('complex', 'dict', 'float', 'int', 'list', 'str', 'tuple'),
+ )
visitor.visit(ast.parse(BUILTIN_CONSTRUCTORS))
assert visitor.builtin_type_calls == []