Skip to content

Commit dc28922

Browse files
committed
Run pre-commit autoupdate
Committed via https://github.com/asottile/all-repos
1 parent 06d01c8 commit dc28922

File tree

11 files changed

+125
-101
lines changed

11 files changed

+125
-101
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ repos:
1212
- id: requirements-txt-fixer
1313
- id: double-quote-string-fixer
1414
- repo: https://gitlab.com/pycqa/flake8
15-
rev: 3.7.1
15+
rev: 3.7.7
1616
hooks:
1717
- id: flake8
1818
- repo: https://github.com/pre-commit/mirrors-autopep8
1919
rev: v1.4.3
2020
hooks:
2121
- id: autopep8
2222
- repo: https://github.com/pre-commit/pre-commit
23-
rev: v1.14.2
23+
rev: v1.14.4
2424
hooks:
2525
- id: validate_manifest
2626
- repo: https://github.com/asottile/pyupgrade
27-
rev: v1.11.1
27+
rev: v1.12.0
2828
hooks:
2929
- id: pyupgrade
3030
- repo: https://github.com/asottile/reorder_python_imports
31-
rev: v1.3.5
31+
rev: v1.4.0
3232
hooks:
3333
- id: reorder-python-imports
3434
language_version: python3
3535
- repo: https://github.com/asottile/add-trailing-comma
36-
rev: v0.7.1
36+
rev: v1.0.0
3737
hooks:
3838
- id: add-trailing-comma
3939
- repo: meta

pre_commit/commands/autoupdate.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ def _write_new_config_file(path, output):
8484
new_contents = ordered_dump(output, **C.YAML_DUMP_KWARGS)
8585

8686
lines = original_contents.splitlines(True)
87-
rev_line_indices_reversed = list(reversed([
88-
i for i, line in enumerate(lines) if REV_LINE_RE.match(line)
89-
]))
87+
rev_line_indices_reversed = list(
88+
reversed([
89+
i for i, line in enumerate(lines) if REV_LINE_RE.match(line)
90+
]),
91+
)
9092

9193
for line in new_contents.splitlines(True):
9294
if REV_LINE_RE.match(line):
@@ -140,9 +142,11 @@ def autoupdate(config_file, store, tags_only, repos=()):
140142

141143
if new_repo_config['rev'] != repo_config['rev']:
142144
changed = True
143-
output.write_line('updating {} -> {}.'.format(
144-
repo_config['rev'], new_repo_config['rev'],
145-
))
145+
output.write_line(
146+
'updating {} -> {}.'.format(
147+
repo_config['rev'], new_repo_config['rev'],
148+
),
149+
)
146150
output_repos.append(new_repo_config)
147151
else:
148152
output.write_line('already up to date.')

pre_commit/commands/install_uninstall.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ def shebang():
5353
# Homebrew/homebrew-core#35825: be more timid about appropriate `PATH`
5454
path_choices = [p for p in os.defpath.split(os.pathsep) if p]
5555
exe_choices = [
56-
'python{}'.format('.'.join(
57-
str(v) for v in sys.version_info[:i]
58-
))
56+
'python{}'.format('.'.join(str(v) for v in sys.version_info[:i]))
5957
for i in range(3)
6058
]
6159
for path, exe in itertools.product(path_choices, exe_choices):

pre_commit/commands/run.py

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -85,30 +85,36 @@ def _run_single_hook(classifier, hook, args, skips, cols):
8585
)
8686

8787
if hook.id in skips or hook.alias in skips:
88-
output.write(get_hook_message(
89-
_hook_msg_start(hook, args.verbose),
90-
end_msg=SKIPPED,
91-
end_color=color.YELLOW,
92-
use_color=args.color,
93-
cols=cols,
94-
))
88+
output.write(
89+
get_hook_message(
90+
_hook_msg_start(hook, args.verbose),
91+
end_msg=SKIPPED,
92+
end_color=color.YELLOW,
93+
use_color=args.color,
94+
cols=cols,
95+
),
96+
)
9597
return 0
9698
elif not filenames and not hook.always_run:
97-
output.write(get_hook_message(
98-
_hook_msg_start(hook, args.verbose),
99-
postfix=NO_FILES,
100-
end_msg=SKIPPED,
101-
end_color=color.TURQUOISE,
102-
use_color=args.color,
103-
cols=cols,
104-
))
99+
output.write(
100+
get_hook_message(
101+
_hook_msg_start(hook, args.verbose),
102+
postfix=NO_FILES,
103+
end_msg=SKIPPED,
104+
end_color=color.TURQUOISE,
105+
use_color=args.color,
106+
cols=cols,
107+
),
108+
)
105109
return 0
106110

107111
# Print the hook and the dots first in case the hook takes hella long to
108112
# run.
109-
output.write(get_hook_message(
110-
_hook_msg_start(hook, args.verbose), end_len=6, cols=cols,
111-
))
113+
output.write(
114+
get_hook_message(
115+
_hook_msg_start(hook, args.verbose), end_len=6, cols=cols,
116+
),
117+
)
112118
sys.stdout.flush()
113119

114120
diff_before = cmd_output(

pre_commit/git.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,24 @@ def get_conflicted_files():
8484
# If they resolved the merge conflict by choosing a mesh of both sides
8585
# this will also include the conflicted files
8686
tree_hash = cmd_output('git', 'write-tree')[1].strip()
87-
merge_diff_filenames = zsplit(cmd_output(
88-
'git', 'diff', '--name-only', '--no-ext-diff', '-z',
89-
'-m', tree_hash, 'HEAD', 'MERGE_HEAD',
90-
)[1])
87+
merge_diff_filenames = zsplit(
88+
cmd_output(
89+
'git', 'diff', '--name-only', '--no-ext-diff', '-z',
90+
'-m', tree_hash, 'HEAD', 'MERGE_HEAD',
91+
)[1],
92+
)
9193
return set(merge_conflict_filenames) | set(merge_diff_filenames)
9294

9395

9496
def get_staged_files(cwd=None):
95-
return zsplit(cmd_output(
96-
'git', 'diff', '--staged', '--name-only', '--no-ext-diff', '-z',
97-
# Everything except for D
98-
'--diff-filter=ACMRTUXB',
99-
cwd=cwd,
100-
)[1])
97+
return zsplit(
98+
cmd_output(
99+
'git', 'diff', '--staged', '--name-only', '--no-ext-diff', '-z',
100+
# Everything except for D
101+
'--diff-filter=ACMRTUXB',
102+
cwd=cwd,
103+
)[1],
104+
)
101105

102106

103107
def intent_to_add_files():
@@ -119,10 +123,12 @@ def get_all_files():
119123

120124

121125
def get_changed_files(new, old):
122-
return zsplit(cmd_output(
123-
'git', 'diff', '--name-only', '--no-ext-diff', '-z',
124-
'{}...{}'.format(old, new),
125-
)[1])
126+
return zsplit(
127+
cmd_output(
128+
'git', 'diff', '--name-only', '--no-ext-diff', '-z',
129+
'{}...{}'.format(old, new),
130+
)[1],
131+
)
126132

127133

128134
def head_rev(remote):

pre_commit/make_archives.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ def main(argv=None):
5858
parser.add_argument('--dest', default='pre_commit/resources')
5959
args = parser.parse_args(argv)
6060
for archive_name, repo, ref in REPOS:
61-
output.write_line('Making {}.tar.gz for {}@{}'.format(
62-
archive_name, repo, ref,
63-
))
61+
output.write_line(
62+
'Making {}.tar.gz for {}@{}'.format(archive_name, repo, ref),
63+
)
6464
make_archive(archive_name, repo, ref, args.dest)
6565

6666

tests/clientlib_test.py

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,41 +33,47 @@ def test_check_type_tag_failures(value):
3333
@pytest.mark.parametrize(
3434
('config_obj', 'expected'), (
3535
(
36-
{'repos': [{
37-
'repo': 'git@github.com:pre-commit/pre-commit-hooks',
38-
'rev': 'cd74dc150c142c3be70b24eaf0b02cae9d235f37',
39-
'hooks': [{'id': 'pyflakes', 'files': '\\.py$'}],
40-
}]},
36+
{
37+
'repos': [{
38+
'repo': 'git@github.com:pre-commit/pre-commit-hooks',
39+
'rev': 'cd74dc150c142c3be70b24eaf0b02cae9d235f37',
40+
'hooks': [{'id': 'pyflakes', 'files': '\\.py$'}],
41+
}],
42+
},
4143
True,
4244
),
4345
(
44-
{'repos': [{
45-
'repo': 'git@github.com:pre-commit/pre-commit-hooks',
46-
'rev': 'cd74dc150c142c3be70b24eaf0b02cae9d235f37',
47-
'hooks': [
48-
{
49-
'id': 'pyflakes',
50-
'files': '\\.py$',
51-
'args': ['foo', 'bar', 'baz'],
52-
},
53-
],
54-
}]},
46+
{
47+
'repos': [{
48+
'repo': 'git@github.com:pre-commit/pre-commit-hooks',
49+
'rev': 'cd74dc150c142c3be70b24eaf0b02cae9d235f37',
50+
'hooks': [
51+
{
52+
'id': 'pyflakes',
53+
'files': '\\.py$',
54+
'args': ['foo', 'bar', 'baz'],
55+
},
56+
],
57+
}],
58+
},
5559
True,
5660
),
5761
(
58-
{'repos': [{
59-
'repo': 'git@github.com:pre-commit/pre-commit-hooks',
60-
'rev': 'cd74dc150c142c3be70b24eaf0b02cae9d235f37',
61-
'hooks': [
62-
{
63-
'id': 'pyflakes',
64-
'files': '\\.py$',
65-
# Exclude pattern must be a string
66-
'exclude': 0,
67-
'args': ['foo', 'bar', 'baz'],
68-
},
69-
],
70-
}]},
62+
{
63+
'repos': [{
64+
'repo': 'git@github.com:pre-commit/pre-commit-hooks',
65+
'rev': 'cd74dc150c142c3be70b24eaf0b02cae9d235f37',
66+
'hooks': [
67+
{
68+
'id': 'pyflakes',
69+
'files': '\\.py$',
70+
# Exclude pattern must be a string
71+
'exclude': 0,
72+
'args': ['foo', 'bar', 'baz'],
73+
},
74+
],
75+
}],
76+
},
7177
False,
7278
),
7379
),

tests/conftest.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ def no_warnings(recwarn):
3333
message.startswith('Not importing directory ') and
3434
' missing __init__' in message
3535
):
36-
warnings.append('{}:{} {}'.format(
37-
warning.filename,
38-
warning.lineno,
39-
message,
40-
))
36+
warnings.append(
37+
'{}:{} {}'.format(warning.filename, warning.lineno, message),
38+
)
4139
assert not warnings
4240

4341

tests/languages/ruby_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def test_install_rbenv(tempdir_factory):
2222
# Should be able to activate using our script and access rbenv
2323
cmd_output(
2424
'bash', '-c',
25-
'. {} && rbenv --help'.format(pipes.quote(prefix.path(
26-
'rbenv-default', 'bin', 'activate',
27-
))),
25+
'. {} && rbenv --help'.format(
26+
pipes.quote(prefix.path('rbenv-default', 'bin', 'activate')),
27+
),
2828
)
2929

3030

@@ -36,7 +36,7 @@ def test_install_rbenv_with_version(tempdir_factory):
3636
# Should be able to activate and use rbenv install
3737
cmd_output(
3838
'bash', '-c',
39-
'. {} && rbenv install --help'.format(pipes.quote(prefix.path(
40-
'rbenv-1.9.3p547', 'bin', 'activate',
41-
))),
39+
'. {} && rbenv install --help'.format(
40+
pipes.quote(prefix.path('rbenv-1.9.3p547', 'bin', 'activate')),
41+
),
4242
)

tests/parse_shebang_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ def test_find_executable_path_ext(in_tmpdir):
6666
"""Windows exports PATHEXT as a list of extensions to automatically add
6767
to executables when doing PATH searching.
6868
"""
69-
exe_path = os.path.abspath(write_executable(
70-
'/usr/bin/env sh', filename='run.myext',
71-
))
69+
exe_path = os.path.abspath(
70+
write_executable('/usr/bin/env sh', filename='run.myext'),
71+
)
7272
env_path = {'PATH': os.path.dirname(exe_path)}
7373
env_path_ext = dict(env_path, PATHEXT=os.pathsep.join(('.exe', '.myext')))
7474
assert parse_shebang.find_executable('run') is None

0 commit comments

Comments
 (0)