Skip to content

Commit bffa52f

Browse files
committed
Whitespace normalization (get rid of tabs).
1 parent af7a302 commit bffa52f

File tree

6 files changed

+98
-100
lines changed

6 files changed

+98
-100
lines changed

Lib/curses/ascii.py

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
"""Constants and membership tests for ASCII characters"""
22

3-
NUL = 0x00 # ^@
4-
SOH = 0x01 # ^A
5-
STX = 0x02 # ^B
6-
ETX = 0x03 # ^C
7-
EOT = 0x04 # ^D
8-
ENQ = 0x05 # ^E
9-
ACK = 0x06 # ^F
10-
BEL = 0x07 # ^G
11-
BS = 0x08 # ^H
12-
TAB = 0x09 # ^I
13-
HT = 0x09 # ^I
14-
LF = 0x0a # ^J
15-
NL = 0x0a # ^J
16-
VT = 0x0b # ^K
17-
FF = 0x0c # ^L
18-
CR = 0x0d # ^M
19-
SO = 0x0e # ^N
20-
SI = 0x0f # ^O
21-
DLE = 0x10 # ^P
22-
DC1 = 0x11 # ^Q
23-
DC2 = 0x12 # ^R
24-
DC3 = 0x13 # ^S
25-
DC4 = 0x14 # ^T
26-
NAK = 0x15 # ^U
27-
SYN = 0x16 # ^V
28-
ETB = 0x17 # ^W
29-
CAN = 0x18 # ^X
30-
EM = 0x19 # ^Y
31-
SUB = 0x1a # ^Z
32-
ESC = 0x1b # ^[
33-
FS = 0x1c # ^\
34-
GS = 0x1d # ^]
35-
RS = 0x1e # ^^
36-
US = 0x1f # ^_
37-
SP = 0x20 # space
38-
DEL = 0x7f # delete
3+
NUL = 0x00 # ^@
4+
SOH = 0x01 # ^A
5+
STX = 0x02 # ^B
6+
ETX = 0x03 # ^C
7+
EOT = 0x04 # ^D
8+
ENQ = 0x05 # ^E
9+
ACK = 0x06 # ^F
10+
BEL = 0x07 # ^G
11+
BS = 0x08 # ^H
12+
TAB = 0x09 # ^I
13+
HT = 0x09 # ^I
14+
LF = 0x0a # ^J
15+
NL = 0x0a # ^J
16+
VT = 0x0b # ^K
17+
FF = 0x0c # ^L
18+
CR = 0x0d # ^M
19+
SO = 0x0e # ^N
20+
SI = 0x0f # ^O
21+
DLE = 0x10 # ^P
22+
DC1 = 0x11 # ^Q
23+
DC2 = 0x12 # ^R
24+
DC3 = 0x13 # ^S
25+
DC4 = 0x14 # ^T
26+
NAK = 0x15 # ^U
27+
SYN = 0x16 # ^V
28+
ETB = 0x17 # ^W
29+
CAN = 0x18 # ^X
30+
EM = 0x19 # ^Y
31+
SUB = 0x1a # ^Z
32+
ESC = 0x1b # ^[
33+
FS = 0x1c # ^\
34+
GS = 0x1d # ^]
35+
RS = 0x1e # ^^
36+
US = 0x1f # ^_
37+
SP = 0x20 # space
38+
DEL = 0x7f # delete
3939

4040
controlnames = [
4141
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
@@ -53,7 +53,7 @@ def _ctoi(c):
5353

5454
def isalnum(c): return isalpha(c) or isdigit(c)
5555
def isalpha(c): return isupper(c) or islower(c)
56-
def isascii(c): return _ctoi(c) <= 127 # ?
56+
def isascii(c): return _ctoi(c) <= 127 # ?
5757
def isblank(c): return _ctoi(c) in (8,32)
5858
def iscntrl(c): return _ctoi(c) <= 31
5959
def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57
@@ -97,4 +97,3 @@ def unctrl(c):
9797
if bits & 0x80:
9898
return "!" + rep
9999
return rep
100-

Lib/curses/textpad.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def do_command(self, ch):
7171
self.win.addch(ch)
7272
except curses.error:
7373
pass
74-
elif ch == ascii.SOH: # ^a
74+
elif ch == ascii.SOH: # ^a
7575
self.win.move(y, 0)
7676
elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS,curses.KEY_BACKSPACE):
7777
if x > 0:
@@ -84,48 +84,48 @@ def do_command(self, ch):
8484
self.win.move(y-1, self.maxx)
8585
if ch in (ascii.BS, curses.KEY_BACKSPACE):
8686
self.win.delch()
87-
elif ch == ascii.EOT: # ^d
87+
elif ch == ascii.EOT: # ^d
8888
self.win.delch()
89-
elif ch == ascii.ENQ: # ^e
89+
elif ch == ascii.ENQ: # ^e
9090
if self.stripspaces:
9191
self.win.move(y, self._end_of_line(y))
9292
else:
9393
self.win.move(y, self.maxx)
94-
elif ch in (ascii.ACK, curses.KEY_RIGHT): # ^f
94+
elif ch in (ascii.ACK, curses.KEY_RIGHT): # ^f
9595
if x < self.maxx:
9696
self.win.move(y, x+1)
9797
elif y == self.maxy:
9898
pass
9999
else:
100100
self.win.move(y+1, 0)
101-
elif ch == ascii.BEL: # ^g
101+
elif ch == ascii.BEL: # ^g
102102
return 0
103-
elif ch == ascii.NL: # ^j
103+
elif ch == ascii.NL: # ^j
104104
if self.maxy == 0:
105105
return 0
106106
elif y < self.maxy:
107107
self.win.move(y+1, 0)
108-
elif ch == ascii.VT: # ^k
108+
elif ch == ascii.VT: # ^k
109109
if x == 0 and self._end_of_line(y) == 0:
110110
self.win.deleteln()
111111
else:
112112
self.win.clrtoeol()
113-
elif ch == ascii.FF: # ^l
113+
elif ch == ascii.FF: # ^l
114114
self.win.refresh()
115-
elif ch in (ascii.SO, curses.KEY_DOWN): # ^n
115+
elif ch in (ascii.SO, curses.KEY_DOWN): # ^n
116116
if y < self.maxy:
117117
self.win.move(y+1, x)
118118
if x > self._end_of_line(y+1):
119119
self.win.move(y+1, self._end_of_line(y+1))
120-
elif ch == ascii.SI: # ^o
120+
elif ch == ascii.SI: # ^o
121121
self.win.insertln()
122-
elif ch in (ascii.DLE, curses.KEY_UP): # ^p
122+
elif ch in (ascii.DLE, curses.KEY_UP): # ^p
123123
if y > 0:
124124
self.win.move(y-1, x)
125125
if x > self._end_of_line(y-1):
126126
self.win.move(y-1, self._end_of_line(y-1))
127127
return 1
128-
128+
129129
def gather(self):
130130
"Collect and return the contents of the window."
131131
result = ""

Lib/curses/wrapper.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ def wrapper(func, *rest):
1616
as its first argument, followed by any other arguments passed to
1717
wrapper().
1818
"""
19-
19+
2020
res = None
2121
try:
22-
# Initialize curses
22+
# Initialize curses
2323
stdscr=curses.initscr()
24-
25-
# Turn off echoing of keys, and enter cbreak mode,
26-
# where no buffering is performed on keyboard input
24+
25+
# Turn off echoing of keys, and enter cbreak mode,
26+
# where no buffering is performed on keyboard input
2727
curses.noecho()
2828
curses.cbreak()
2929

30-
# In keypad mode, escape sequences for special keys
31-
# (like the cursor keys) will be interpreted and
32-
# a special value like curses.KEY_LEFT will be returned
30+
# In keypad mode, escape sequences for special keys
31+
# (like the cursor keys) will be interpreted and
32+
# a special value like curses.KEY_LEFT will be returned
3333
stdscr.keypad(1)
3434

3535
# Start color, too. Harmless if the terminal doesn't have
@@ -43,21 +43,21 @@ def wrapper(func, *rest):
4343

4444
res = apply(func, (stdscr,) + rest)
4545
except:
46-
# In the event of an error, restore the terminal
47-
# to a sane state.
46+
# In the event of an error, restore the terminal
47+
# to a sane state.
4848
stdscr.keypad(0)
4949
curses.echo()
5050
curses.nocbreak()
5151
curses.endwin()
52-
52+
5353
# Pass the exception upwards
5454
(exc_type, exc_value, exc_traceback) = sys.exc_info()
5555
raise exc_type, exc_value, exc_traceback
5656
else:
57-
# Set everything back to normal
57+
# Set everything back to normal
5858
stdscr.keypad(0)
5959
curses.echo()
6060
curses.nocbreak()
61-
curses.endwin() # Terminate curses
61+
curses.endwin() # Terminate curses
6262

6363
return res

0 commit comments

Comments
 (0)