Fix CI by upgrading AP templates
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