File tree Expand file tree Collapse file tree 2 files changed +5
-16
lines changed
Expand file tree Collapse file tree 2 files changed +5
-16
lines changed Original file line number Diff line number Diff line change 11from __future__ import unicode_literals
22
3- import os
4- import subprocess
53import sys
64
5+ from backports .shutil_get_terminal_size import get_terminal_size
6+
77from pre_commit import color
88from pre_commit import five
99
10-
1110# TODO: smell: import side-effects
12- try :
13- if not os .environ .get ('TERM' ): # pragma: no cover (dumb terminal)
14- raise OSError ('Cannot determine width without TERM' )
15- else : # pragma no cover (windows)
16- COLS = int (
17- subprocess .Popen (
18- ('tput' , 'cols' ), stdout = subprocess .PIPE ,
19- ).communicate ()[0 ] or
20- # Default in the case of no terminal
21- 80
22- )
23- except OSError : # pragma: no cover (windows)
24- COLS = 80
11+ # TODO: https://github.com/chrippa/backports.shutil_get_terminal_size/issues/4
12+ COLS = get_terminal_size ().columns or 80
2513
2614
2715def get_hook_message (
Original file line number Diff line number Diff line change 4141 install_requires = [
4242 'argparse' ,
4343 'aspy.yaml' ,
44+ 'backports.shutil_get_terminal_size' ,
4445 'cached-property' ,
4546 'jsonschema' ,
4647 'nodeenv>=0.11.1' ,
You can’t perform that action at this time.
0 commit comments