Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e98d2e1

Browse files
committed
Use print_function moar.
1 parent 371ec1e commit e98d2e1

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

pre_commit/run.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
from __future__ import print_function
3+
24
import argparse
35
import subprocess
46
import sys
@@ -27,10 +29,13 @@ def _run_single_hook(runner, repository, hook_id, all_files=False, verbose=False
2729

2830
# Print the hook and the dots first in case the hook takes hella long to
2931
# run.
30-
print '{0}{1}'.format(
31-
hook['name'],
32-
'.' * (COLS - len(hook['name']) - PASS_FAIL_LENGTH - 6),
33-
),
32+
print(
33+
'{0}{1}'.format(
34+
hook['name'],
35+
'.' * (COLS - len(hook['name']) - PASS_FAIL_LENGTH - 6),
36+
),
37+
end='',
38+
)
3439

3540
retcode, stdout, stderr = repository.run_hook(
3641
runner.cmd_runner,
@@ -49,12 +54,10 @@ def _run_single_hook(runner, repository, hook_id, all_files=False, verbose=False
4954
pass_fail = 'Passed'
5055

5156

52-
print '{0}{1}{2}'.format(color, pass_fail, NORMAL)
57+
print('{0}{1}{2}'.format(color, pass_fail, NORMAL))
5358

5459
if output and (retcode or verbose):
55-
print
56-
print output
57-
print
60+
print('\n' + output)
5861

5962
return retcode
6063

@@ -87,7 +90,7 @@ def run_single_hook(runner, hook_id, all_files=False, verbose=False):
8790
verbose=verbose,
8891
)
8992
else:
90-
print 'No hook with id {0}'.format(hook_id)
93+
print('No hook with id `{0}`'.format(hook_id))
9194
return 1
9295

9396

0 commit comments

Comments
 (0)