File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040 ]
4141 },
4242 url = "https://github.com/cs50/style50" ,
43- version = "2.10.4 " ,
43+ version = "2.11.0 " ,
4444 include_package_data = True ,
4545)
Original file line number Diff line number Diff line change 11from abc import ABCMeta , abstractmethod
22import errno
33import difflib
4- import fcntl
54import fnmatch
65import html
76import itertools
87import json
98import os
109import re
11- import struct
10+ import shutil
1211import subprocess
1312import sys
1413import tempfile
15- from termios import TIOCGWINSZ
1614
1715import icdiff
1816import magic
2220
2321__all__ = ["Style50" , "StyleCheck" , "Error" ]
2422
25-
26-
27- def get_terminal_size (fallback = (80 , 24 )):
28- """
29- Return tuple containing columns and rows of controlling terminal, trying harder
30- than shutil.get_terminal_size to find a tty before returning fallback.
31-
32- Theoretically, stdout, stderr, and stdin could all be different ttys that could
33- cause us to get the wrong measurements (instead of using the fallback) but the much more
34- common case is that IO is piped.
35- """
36- for stream in [sys .__stdout__ , sys .__stderr__ , sys .__stdin__ ]:
37- try :
38- # Make WINSIZE call to terminal
39- data = fcntl .ioctl (stream .fileno (), TIOCGWINSZ , b"\x00 \x00 \00 \x00 " )
40- except OSError :
41- pass
42- else :
43- # Unpack two shorts from ioctl call
44- lines , columns = struct .unpack ("hh" , data )
45- break
46- else :
47- columns , lines = fallback
48-
49- return columns , lines
50-
51-
52- COLUMNS , LINES = get_terminal_size ()
23+ COLUMNS , LINES = shutil .get_terminal_size (fallback = (80 , 24 ))
5324
5425
5526class Style50 :
You can’t perform that action at this time.
0 commit comments