mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Whitespace normalization (get rid of tabs).
This commit is contained in:
parent
af7a302c78
commit
bffa52f07f
6 changed files with 98 additions and 100 deletions
|
@ -1,41 +1,41 @@
|
||||||
"""Constants and membership tests for ASCII characters"""
|
"""Constants and membership tests for ASCII characters"""
|
||||||
|
|
||||||
NUL = 0x00 # ^@
|
NUL = 0x00 # ^@
|
||||||
SOH = 0x01 # ^A
|
SOH = 0x01 # ^A
|
||||||
STX = 0x02 # ^B
|
STX = 0x02 # ^B
|
||||||
ETX = 0x03 # ^C
|
ETX = 0x03 # ^C
|
||||||
EOT = 0x04 # ^D
|
EOT = 0x04 # ^D
|
||||||
ENQ = 0x05 # ^E
|
ENQ = 0x05 # ^E
|
||||||
ACK = 0x06 # ^F
|
ACK = 0x06 # ^F
|
||||||
BEL = 0x07 # ^G
|
BEL = 0x07 # ^G
|
||||||
BS = 0x08 # ^H
|
BS = 0x08 # ^H
|
||||||
TAB = 0x09 # ^I
|
TAB = 0x09 # ^I
|
||||||
HT = 0x09 # ^I
|
HT = 0x09 # ^I
|
||||||
LF = 0x0a # ^J
|
LF = 0x0a # ^J
|
||||||
NL = 0x0a # ^J
|
NL = 0x0a # ^J
|
||||||
VT = 0x0b # ^K
|
VT = 0x0b # ^K
|
||||||
FF = 0x0c # ^L
|
FF = 0x0c # ^L
|
||||||
CR = 0x0d # ^M
|
CR = 0x0d # ^M
|
||||||
SO = 0x0e # ^N
|
SO = 0x0e # ^N
|
||||||
SI = 0x0f # ^O
|
SI = 0x0f # ^O
|
||||||
DLE = 0x10 # ^P
|
DLE = 0x10 # ^P
|
||||||
DC1 = 0x11 # ^Q
|
DC1 = 0x11 # ^Q
|
||||||
DC2 = 0x12 # ^R
|
DC2 = 0x12 # ^R
|
||||||
DC3 = 0x13 # ^S
|
DC3 = 0x13 # ^S
|
||||||
DC4 = 0x14 # ^T
|
DC4 = 0x14 # ^T
|
||||||
NAK = 0x15 # ^U
|
NAK = 0x15 # ^U
|
||||||
SYN = 0x16 # ^V
|
SYN = 0x16 # ^V
|
||||||
ETB = 0x17 # ^W
|
ETB = 0x17 # ^W
|
||||||
CAN = 0x18 # ^X
|
CAN = 0x18 # ^X
|
||||||
EM = 0x19 # ^Y
|
EM = 0x19 # ^Y
|
||||||
SUB = 0x1a # ^Z
|
SUB = 0x1a # ^Z
|
||||||
ESC = 0x1b # ^[
|
ESC = 0x1b # ^[
|
||||||
FS = 0x1c # ^\
|
FS = 0x1c # ^\
|
||||||
GS = 0x1d # ^]
|
GS = 0x1d # ^]
|
||||||
RS = 0x1e # ^^
|
RS = 0x1e # ^^
|
||||||
US = 0x1f # ^_
|
US = 0x1f # ^_
|
||||||
SP = 0x20 # space
|
SP = 0x20 # space
|
||||||
DEL = 0x7f # delete
|
DEL = 0x7f # delete
|
||||||
|
|
||||||
controlnames = [
|
controlnames = [
|
||||||
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
|
"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
|
||||||
|
@ -53,7 +53,7 @@ def _ctoi(c):
|
||||||
|
|
||||||
def isalnum(c): return isalpha(c) or isdigit(c)
|
def isalnum(c): return isalpha(c) or isdigit(c)
|
||||||
def isalpha(c): return isupper(c) or islower(c)
|
def isalpha(c): return isupper(c) or islower(c)
|
||||||
def isascii(c): return _ctoi(c) <= 127 # ?
|
def isascii(c): return _ctoi(c) <= 127 # ?
|
||||||
def isblank(c): return _ctoi(c) in (8,32)
|
def isblank(c): return _ctoi(c) in (8,32)
|
||||||
def iscntrl(c): return _ctoi(c) <= 31
|
def iscntrl(c): return _ctoi(c) <= 31
|
||||||
def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57
|
def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57
|
||||||
|
@ -97,4 +97,3 @@ def unctrl(c):
|
||||||
if bits & 0x80:
|
if bits & 0x80:
|
||||||
return "!" + rep
|
return "!" + rep
|
||||||
return rep
|
return rep
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class Textbox:
|
||||||
self.win.addch(ch)
|
self.win.addch(ch)
|
||||||
except curses.error:
|
except curses.error:
|
||||||
pass
|
pass
|
||||||
elif ch == ascii.SOH: # ^a
|
elif ch == ascii.SOH: # ^a
|
||||||
self.win.move(y, 0)
|
self.win.move(y, 0)
|
||||||
elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS,curses.KEY_BACKSPACE):
|
elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS,curses.KEY_BACKSPACE):
|
||||||
if x > 0:
|
if x > 0:
|
||||||
|
@ -84,42 +84,42 @@ class Textbox:
|
||||||
self.win.move(y-1, self.maxx)
|
self.win.move(y-1, self.maxx)
|
||||||
if ch in (ascii.BS, curses.KEY_BACKSPACE):
|
if ch in (ascii.BS, curses.KEY_BACKSPACE):
|
||||||
self.win.delch()
|
self.win.delch()
|
||||||
elif ch == ascii.EOT: # ^d
|
elif ch == ascii.EOT: # ^d
|
||||||
self.win.delch()
|
self.win.delch()
|
||||||
elif ch == ascii.ENQ: # ^e
|
elif ch == ascii.ENQ: # ^e
|
||||||
if self.stripspaces:
|
if self.stripspaces:
|
||||||
self.win.move(y, self._end_of_line(y))
|
self.win.move(y, self._end_of_line(y))
|
||||||
else:
|
else:
|
||||||
self.win.move(y, self.maxx)
|
self.win.move(y, self.maxx)
|
||||||
elif ch in (ascii.ACK, curses.KEY_RIGHT): # ^f
|
elif ch in (ascii.ACK, curses.KEY_RIGHT): # ^f
|
||||||
if x < self.maxx:
|
if x < self.maxx:
|
||||||
self.win.move(y, x+1)
|
self.win.move(y, x+1)
|
||||||
elif y == self.maxy:
|
elif y == self.maxy:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.win.move(y+1, 0)
|
self.win.move(y+1, 0)
|
||||||
elif ch == ascii.BEL: # ^g
|
elif ch == ascii.BEL: # ^g
|
||||||
return 0
|
return 0
|
||||||
elif ch == ascii.NL: # ^j
|
elif ch == ascii.NL: # ^j
|
||||||
if self.maxy == 0:
|
if self.maxy == 0:
|
||||||
return 0
|
return 0
|
||||||
elif y < self.maxy:
|
elif y < self.maxy:
|
||||||
self.win.move(y+1, 0)
|
self.win.move(y+1, 0)
|
||||||
elif ch == ascii.VT: # ^k
|
elif ch == ascii.VT: # ^k
|
||||||
if x == 0 and self._end_of_line(y) == 0:
|
if x == 0 and self._end_of_line(y) == 0:
|
||||||
self.win.deleteln()
|
self.win.deleteln()
|
||||||
else:
|
else:
|
||||||
self.win.clrtoeol()
|
self.win.clrtoeol()
|
||||||
elif ch == ascii.FF: # ^l
|
elif ch == ascii.FF: # ^l
|
||||||
self.win.refresh()
|
self.win.refresh()
|
||||||
elif ch in (ascii.SO, curses.KEY_DOWN): # ^n
|
elif ch in (ascii.SO, curses.KEY_DOWN): # ^n
|
||||||
if y < self.maxy:
|
if y < self.maxy:
|
||||||
self.win.move(y+1, x)
|
self.win.move(y+1, x)
|
||||||
if x > self._end_of_line(y+1):
|
if x > self._end_of_line(y+1):
|
||||||
self.win.move(y+1, self._end_of_line(y+1))
|
self.win.move(y+1, self._end_of_line(y+1))
|
||||||
elif ch == ascii.SI: # ^o
|
elif ch == ascii.SI: # ^o
|
||||||
self.win.insertln()
|
self.win.insertln()
|
||||||
elif ch in (ascii.DLE, curses.KEY_UP): # ^p
|
elif ch in (ascii.DLE, curses.KEY_UP): # ^p
|
||||||
if y > 0:
|
if y > 0:
|
||||||
self.win.move(y-1, x)
|
self.win.move(y-1, x)
|
||||||
if x > self._end_of_line(y-1):
|
if x > self._end_of_line(y-1):
|
||||||
|
|
|
@ -19,17 +19,17 @@ def wrapper(func, *rest):
|
||||||
|
|
||||||
res = None
|
res = None
|
||||||
try:
|
try:
|
||||||
# Initialize curses
|
# Initialize curses
|
||||||
stdscr=curses.initscr()
|
stdscr=curses.initscr()
|
||||||
|
|
||||||
# Turn off echoing of keys, and enter cbreak mode,
|
# Turn off echoing of keys, and enter cbreak mode,
|
||||||
# where no buffering is performed on keyboard input
|
# where no buffering is performed on keyboard input
|
||||||
curses.noecho()
|
curses.noecho()
|
||||||
curses.cbreak()
|
curses.cbreak()
|
||||||
|
|
||||||
# In keypad mode, escape sequences for special keys
|
# In keypad mode, escape sequences for special keys
|
||||||
# (like the cursor keys) will be interpreted and
|
# (like the cursor keys) will be interpreted and
|
||||||
# a special value like curses.KEY_LEFT will be returned
|
# a special value like curses.KEY_LEFT will be returned
|
||||||
stdscr.keypad(1)
|
stdscr.keypad(1)
|
||||||
|
|
||||||
# Start color, too. Harmless if the terminal doesn't have
|
# Start color, too. Harmless if the terminal doesn't have
|
||||||
|
@ -43,8 +43,8 @@ def wrapper(func, *rest):
|
||||||
|
|
||||||
res = apply(func, (stdscr,) + rest)
|
res = apply(func, (stdscr,) + rest)
|
||||||
except:
|
except:
|
||||||
# In the event of an error, restore the terminal
|
# In the event of an error, restore the terminal
|
||||||
# to a sane state.
|
# to a sane state.
|
||||||
stdscr.keypad(0)
|
stdscr.keypad(0)
|
||||||
curses.echo()
|
curses.echo()
|
||||||
curses.nocbreak()
|
curses.nocbreak()
|
||||||
|
@ -54,10 +54,10 @@ def wrapper(func, *rest):
|
||||||
(exc_type, exc_value, exc_traceback) = sys.exc_info()
|
(exc_type, exc_value, exc_traceback) = sys.exc_info()
|
||||||
raise exc_type, exc_value, exc_traceback
|
raise exc_type, exc_value, exc_traceback
|
||||||
else:
|
else:
|
||||||
# Set everything back to normal
|
# Set everything back to normal
|
||||||
stdscr.keypad(0)
|
stdscr.keypad(0)
|
||||||
curses.echo()
|
curses.echo()
|
||||||
curses.nocbreak()
|
curses.nocbreak()
|
||||||
curses.endwin() # Terminate curses
|
curses.endwin() # Terminate curses
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
|
@ -313,4 +313,3 @@ def get_versions():
|
||||||
# anyway - so we can link OMF DLLs
|
# anyway - so we can link OMF DLLs
|
||||||
ld_version = None
|
ld_version = None
|
||||||
return (gcc_version, ld_version)
|
return (gcc_version, ld_version)
|
||||||
|
|
||||||
|
|
|
@ -209,13 +209,13 @@ class RawPen:
|
||||||
|
|
||||||
def window_width(self):
|
def window_width(self):
|
||||||
width = self._canvas.winfo_width()
|
width = self._canvas.winfo_width()
|
||||||
if width <= 1: # the window isn't managed by a geometry manager
|
if width <= 1: # the window isn't managed by a geometry manager
|
||||||
width = self._canvas['width']
|
width = self._canvas['width']
|
||||||
return width
|
return width
|
||||||
|
|
||||||
def window_height(self):
|
def window_height(self):
|
||||||
height = self._canvas.winfo_height()
|
height = self._canvas.winfo_height()
|
||||||
if height <= 1: # the window isn't managed by a geometry manager
|
if height <= 1: # the window isn't managed by a geometry manager
|
||||||
height = self._canvas['height']
|
height = self._canvas['height']
|
||||||
return height
|
return height
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,12 @@ import cStringIO
|
||||||
|
|
||||||
msg = """Mime-Version: 1.0
|
msg = """Mime-Version: 1.0
|
||||||
Content-Type: multipart/mixed;
|
Content-Type: multipart/mixed;
|
||||||
boundary="=====================_590453667==_"
|
boundary="=====================_590453667==_"
|
||||||
X-OriginalArrivalTime: 05 Feb 2002 03:43:23.0310 (UTC) FILETIME=[42D88CE0:01C1ADF7]
|
X-OriginalArrivalTime: 05 Feb 2002 03:43:23.0310 (UTC) FILETIME=[42D88CE0:01C1ADF7]
|
||||||
|
|
||||||
--=====================_590453667==_
|
--=====================_590453667==_
|
||||||
Content-Type: multipart/alternative;
|
Content-Type: multipart/alternative;
|
||||||
boundary="=====================_590453677==_.ALT"
|
boundary="=====================_590453677==_.ALT"
|
||||||
|
|
||||||
--=====================_590453677==_.ALT
|
--=====================_590453677==_.ALT
|
||||||
Content-Type: text/plain; charset="us-ascii"; format=flowed
|
Content-Type: text/plain; charset="us-ascii"; format=flowed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue