Skip to content

Commit fea76b9

Browse files
committed
Fix CI by upgrading AP templates
1 parent 31853d6 commit fea76b9

File tree

8 files changed

+39
-34
lines changed

8 files changed

+39
-34
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,32 @@ repos:
1313
- id: double-quote-string-fixer
1414
- id: requirements-txt-fixer
1515
- repo: https://gitlab.com/pycqa/flake8
16-
rev: 3.7.1
16+
rev: 3.7.9
1717
hooks:
1818
- id: flake8
1919
- repo: https://github.com/pre-commit/mirrors-autopep8
20-
rev: v1.4.3
20+
rev: v1.5
2121
hooks:
2222
- id: autopep8
2323
- repo: https://github.com/pre-commit/pre-commit
24-
rev: v1.14.2
24+
rev: v2.0.1
2525
hooks:
2626
- id: validate_manifest
2727
- repo: https://github.com/asottile/reorder_python_imports
28-
rev: v1.3.5
28+
rev: v1.9.0
2929
hooks:
3030
- id: reorder-python-imports
3131
language_version: python3
3232
- repo: https://github.com/asottile/pyupgrade
33-
rev: v1.11.1
33+
rev: v1.26.2
3434
hooks:
3535
- id: pyupgrade
3636
- repo: https://github.com/asottile/add-trailing-comma
37-
rev: v0.7.1
37+
rev: v1.5.0
3838
hooks:
3939
- id: add-trailing-comma
4040
- repo: https://github.com/pre-commit/mirrors-mypy
41-
rev: v0.660
41+
rev: v0.761
4242
hooks:
4343
- id: mypy
4444
language_version: python3

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ resources:
1010
type: github
1111
endpoint: github
1212
name: asottile/azure-pipeline-templates
13-
ref: refs/tags/v0.0.8
13+
ref: refs/tags/v1.0.0
1414

1515
jobs:
1616
- template: job--pre-commit.yml@asottile

pre_commit_hooks/check_ast.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ def main(argv=None): # type: (Optional[Sequence[str]]) -> int
2323
with open(filename, 'rb') as f:
2424
ast.parse(f.read(), filename=filename)
2525
except SyntaxError:
26-
print('{}: failed parsing with {} {}:'.format(
27-
filename,
28-
platform.python_implementation(),
29-
sys.version.partition(' ')[0],
30-
))
31-
print('\n{}'.format(
32-
' ' + traceback.format_exc().replace('\n', '\n '),
33-
))
26+
print(
27+
'{}: failed parsing with {} {}:'.format(
28+
filename,
29+
platform.python_implementation(),
30+
sys.version.partition(' ')[0],
31+
),
32+
)
33+
tb = ' ' + traceback.format_exc().replace('\n', '\n ')
34+
print('\n{}'.format(tb))
3435
retval = 1
3536
return retval
3637

pre_commit_hooks/check_merge_conflict.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ def main(argv=None): # type: (Optional[Sequence[str]]) -> int
4141
for i, line in enumerate(inputfile):
4242
for pattern in CONFLICT_PATTERNS:
4343
if line.startswith(pattern):
44-
print(WARNING_MSG.format(
45-
pattern.decode(), filename, i + 1,
46-
))
44+
print(
45+
WARNING_MSG.format(
46+
pattern.decode(), filename, i + 1,
47+
),
48+
)
4749
retcode = 1
4850

4951
return retcode

pre_commit_hooks/fix_encoding_pragma.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ def has_coding(line): # type: (bytes) -> bool
2525
)
2626

2727

28-
class ExpectedContents(collections.namedtuple(
29-
'ExpectedContents', ('shebang', 'rest', 'pragma_status', 'ending'),
30-
)):
28+
class ExpectedContents(
29+
collections.namedtuple(
30+
'ExpectedContents', ('shebang', 'rest', 'pragma_status', 'ending'),
31+
),
32+
):
3133
"""
3234
pragma_status:
3335
- True: has exactly the coding pragma expected
@@ -138,9 +140,11 @@ def main(argv=None): # type: (Optional[Sequence[str]]) -> int
138140
)
139141
retv |= file_ret
140142
if file_ret:
141-
print(fmt.format(
142-
pragma=args.pragma.decode(), filename=filename,
143-
))
143+
print(
144+
fmt.format(
145+
pragma=args.pragma.decode(), filename=filename,
146+
),
147+
)
144148

145149
return retv
146150

pre_commit_hooks/string_fixer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ def fix_strings(filename): # type: (str) -> int
4545
splitcontents = list(contents)
4646

4747
# Iterate in reverse so the offsets are always correct
48-
tokens = reversed(list(tokenize.generate_tokens(
49-
io.StringIO(contents).readline,
50-
)))
48+
tokens_l = list(tokenize.generate_tokens(io.StringIO(contents).readline))
49+
tokens = reversed(tokens_l)
5150
for token_type, token_text, (srow, scol), (erow, ecol), _ in tokens:
5251
if token_type == tokenize.STRING:
5352
new_text = handle_match(token_text)

pre_commit_hooks/util.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ class CalledProcessError(RuntimeError):
1212

1313

1414
def added_files(): # type: () -> Set[str]
15-
return set(cmd_output(
16-
'git', 'diff', '--staged', '--name-only', '--diff-filter=A',
17-
).splitlines())
15+
cmd = ('git', 'diff', '--staged', '--name-only', '--diff-filter=A')
16+
return set(cmd_output(*cmd).splitlines())
1817

1918

2019
def cmd_output(*cmd, **kwargs): # type: (*str, **Any) -> str

tests/check_builtin_literals_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ def test_dict_no_allow_kwargs_exprs(expression, calls):
121121

122122

123123
def test_ignore_constructors():
124-
visitor = Visitor(ignore=(
125-
'complex', 'dict', 'float', 'int', 'list', 'str', 'tuple',
126-
))
124+
visitor = Visitor(
125+
ignore=('complex', 'dict', 'float', 'int', 'list', 'str', 'tuple'),
126+
)
127127
visitor.visit(ast.parse(BUILTIN_CONSTRUCTORS))
128128
assert visitor.builtin_type_calls == []
129129

0 commit comments

Comments
 (0)