mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Use print_function moar.
This commit is contained in:
parent
371ec1e051
commit
e98d2e1e79
1 changed files with 12 additions and 9 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -27,10 +29,13 @@ def _run_single_hook(runner, repository, hook_id, all_files=False, verbose=False
|
||||||
|
|
||||||
# Print the hook and the dots first in case the hook takes hella long to
|
# Print the hook and the dots first in case the hook takes hella long to
|
||||||
# run.
|
# run.
|
||||||
print '{0}{1}'.format(
|
print(
|
||||||
hook['name'],
|
'{0}{1}'.format(
|
||||||
'.' * (COLS - len(hook['name']) - PASS_FAIL_LENGTH - 6),
|
hook['name'],
|
||||||
),
|
'.' * (COLS - len(hook['name']) - PASS_FAIL_LENGTH - 6),
|
||||||
|
),
|
||||||
|
end='',
|
||||||
|
)
|
||||||
|
|
||||||
retcode, stdout, stderr = repository.run_hook(
|
retcode, stdout, stderr = repository.run_hook(
|
||||||
runner.cmd_runner,
|
runner.cmd_runner,
|
||||||
|
|
@ -49,12 +54,10 @@ def _run_single_hook(runner, repository, hook_id, all_files=False, verbose=False
|
||||||
pass_fail = 'Passed'
|
pass_fail = 'Passed'
|
||||||
|
|
||||||
|
|
||||||
print '{0}{1}{2}'.format(color, pass_fail, NORMAL)
|
print('{0}{1}{2}'.format(color, pass_fail, NORMAL))
|
||||||
|
|
||||||
if output and (retcode or verbose):
|
if output and (retcode or verbose):
|
||||||
print
|
print('\n' + output)
|
||||||
print output
|
|
||||||
print
|
|
||||||
|
|
||||||
return retcode
|
return retcode
|
||||||
|
|
||||||
|
|
@ -87,7 +90,7 @@ def run_single_hook(runner, hook_id, all_files=False, verbose=False):
|
||||||
verbose=verbose,
|
verbose=verbose,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print 'No hook with id {0}'.format(hook_id)
|
print('No hook with id `{0}`'.format(hook_id))
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue