diff options
author | Guido van Rossum <guido@python.org> | 2002-09-29 00:25:51 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-09-29 00:25:51 (GMT) |
commit | bffa52f07fc73b3c8eb4b30e30e2417bc406d2ee (patch) | |
tree | a5fe735c4e0ca016924636adfe155445f84e6d3b | |
parent | af7a302c78258d418eba57bc2f80e4dabd8bbe9a (diff) | |
download | cpython-bffa52f07fc73b3c8eb4b30e30e2417bc406d2ee.zip cpython-bffa52f07fc73b3c8eb4b30e30e2417bc406d2ee.tar.gz cpython-bffa52f07fc73b3c8eb4b30e30e2417bc406d2ee.tar.bz2 |
Whitespace normalization (get rid of tabs).
-rw-r--r-- | Lib/curses/ascii.py | 75 | ||||
-rw-r--r-- | Lib/curses/textpad.py | 24 | ||||
-rw-r--r-- | Lib/curses/wrapper.py | 26 | ||||
-rw-r--r-- | Lib/distutils/emxccompiler.py | 57 | ||||
-rw-r--r-- | Lib/lib-tk/turtle.py | 8 | ||||
-rw-r--r-- | Lib/test/test_multifile.py | 8 |
6 files changed, 98 insertions, 100 deletions
diff --git a/Lib/curses/ascii.py b/Lib/curses/ascii.py index 3c21169..b8ae6f3 100644 --- a/Lib/curses/ascii.py +++ b/Lib/curses/ascii.py @@ -1,41 +1,41 @@ """Constants and membership tests for ASCII characters""" -NUL = 0x00 # ^@ -SOH = 0x01 # ^A -STX = 0x02 # ^B -ETX = 0x03 # ^C -EOT = 0x04 # ^D -ENQ = 0x05 # ^E -ACK = 0x06 # ^F -BEL = 0x07 # ^G -BS = 0x08 # ^H -TAB = 0x09 # ^I -HT = 0x09 # ^I -LF = 0x0a # ^J -NL = 0x0a # ^J -VT = 0x0b # ^K -FF = 0x0c # ^L -CR = 0x0d # ^M -SO = 0x0e # ^N -SI = 0x0f # ^O -DLE = 0x10 # ^P -DC1 = 0x11 # ^Q -DC2 = 0x12 # ^R -DC3 = 0x13 # ^S -DC4 = 0x14 # ^T -NAK = 0x15 # ^U -SYN = 0x16 # ^V -ETB = 0x17 # ^W -CAN = 0x18 # ^X -EM = 0x19 # ^Y -SUB = 0x1a # ^Z -ESC = 0x1b # ^[ -FS = 0x1c # ^\ -GS = 0x1d # ^] -RS = 0x1e # ^^ -US = 0x1f # ^_ -SP = 0x20 # space -DEL = 0x7f # delete +NUL = 0x00 # ^@ +SOH = 0x01 # ^A +STX = 0x02 # ^B +ETX = 0x03 # ^C +EOT = 0x04 # ^D +ENQ = 0x05 # ^E +ACK = 0x06 # ^F +BEL = 0x07 # ^G +BS = 0x08 # ^H +TAB = 0x09 # ^I +HT = 0x09 # ^I +LF = 0x0a # ^J +NL = 0x0a # ^J +VT = 0x0b # ^K +FF = 0x0c # ^L +CR = 0x0d # ^M +SO = 0x0e # ^N +SI = 0x0f # ^O +DLE = 0x10 # ^P +DC1 = 0x11 # ^Q +DC2 = 0x12 # ^R +DC3 = 0x13 # ^S +DC4 = 0x14 # ^T +NAK = 0x15 # ^U +SYN = 0x16 # ^V +ETB = 0x17 # ^W +CAN = 0x18 # ^X +EM = 0x19 # ^Y +SUB = 0x1a # ^Z +ESC = 0x1b # ^[ +FS = 0x1c # ^\ +GS = 0x1d # ^] +RS = 0x1e # ^^ +US = 0x1f # ^_ +SP = 0x20 # space +DEL = 0x7f # delete controlnames = [ "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 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 iscntrl(c): return _ctoi(c) <= 31 def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57 @@ -97,4 +97,3 @@ def unctrl(c): if bits & 0x80: return "!" + rep return rep - diff --git a/Lib/curses/textpad.py b/Lib/curses/textpad.py index ece425f..bfc270a 100644 --- a/Lib/curses/textpad.py +++ b/Lib/curses/textpad.py @@ -71,7 +71,7 @@ class Textbox: self.win.addch(ch) except curses.error: pass - elif ch == ascii.SOH: # ^a + elif ch == ascii.SOH: # ^a self.win.move(y, 0) elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS,curses.KEY_BACKSPACE): if x > 0: @@ -84,48 +84,48 @@ class Textbox: self.win.move(y-1, self.maxx) if ch in (ascii.BS, curses.KEY_BACKSPACE): self.win.delch() - elif ch == ascii.EOT: # ^d + elif ch == ascii.EOT: # ^d self.win.delch() - elif ch == ascii.ENQ: # ^e + elif ch == ascii.ENQ: # ^e if self.stripspaces: self.win.move(y, self._end_of_line(y)) else: 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: self.win.move(y, x+1) elif y == self.maxy: pass else: self.win.move(y+1, 0) - elif ch == ascii.BEL: # ^g + elif ch == ascii.BEL: # ^g return 0 - elif ch == ascii.NL: # ^j + elif ch == ascii.NL: # ^j if self.maxy == 0: return 0 elif y < self.maxy: 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: self.win.deleteln() else: self.win.clrtoeol() - elif ch == ascii.FF: # ^l + elif ch == ascii.FF: # ^l 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: self.win.move(y+1, x) if x > 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() - elif ch in (ascii.DLE, curses.KEY_UP): # ^p + elif ch in (ascii.DLE, curses.KEY_UP): # ^p if y > 0: self.win.move(y-1, x) if x > self._end_of_line(y-1): self.win.move(y-1, self._end_of_line(y-1)) return 1 - + def gather(self): "Collect and return the contents of the window." result = "" diff --git a/Lib/curses/wrapper.py b/Lib/curses/wrapper.py index 51fb724..e725c5a 100644 --- a/Lib/curses/wrapper.py +++ b/Lib/curses/wrapper.py @@ -16,20 +16,20 @@ def wrapper(func, *rest): as its first argument, followed by any other arguments passed to wrapper(). """ - + res = None try: - # Initialize curses + # Initialize curses stdscr=curses.initscr() - - # Turn off echoing of keys, and enter cbreak mode, - # where no buffering is performed on keyboard input + + # Turn off echoing of keys, and enter cbreak mode, + # where no buffering is performed on keyboard input curses.noecho() curses.cbreak() - # In keypad mode, escape sequences for special keys - # (like the cursor keys) will be interpreted and - # a special value like curses.KEY_LEFT will be returned + # In keypad mode, escape sequences for special keys + # (like the cursor keys) will be interpreted and + # a special value like curses.KEY_LEFT will be returned stdscr.keypad(1) # Start color, too. Harmless if the terminal doesn't have @@ -43,21 +43,21 @@ def wrapper(func, *rest): res = apply(func, (stdscr,) + rest) except: - # In the event of an error, restore the terminal - # to a sane state. + # In the event of an error, restore the terminal + # to a sane state. stdscr.keypad(0) curses.echo() curses.nocbreak() curses.endwin() - + # Pass the exception upwards (exc_type, exc_value, exc_traceback) = sys.exc_info() raise exc_type, exc_value, exc_traceback else: - # Set everything back to normal + # Set everything back to normal stdscr.keypad(0) curses.echo() curses.nocbreak() - curses.endwin() # Terminate curses + curses.endwin() # Terminate curses return res diff --git a/Lib/distutils/emxccompiler.py b/Lib/distutils/emxccompiler.py index 9cd9600..7c3ad02 100644 --- a/Lib/distutils/emxccompiler.py +++ b/Lib/distutils/emxccompiler.py @@ -16,7 +16,7 @@ handles the EMX port of the GNU C compiler to OS/2. # of Python is only distributed with threads enabled. # # tested configurations: -# +# # * EMX gcc 2.81/EMX 0.9d fix03 # created 2001/5/7, Andrew MacIntyre, from Rene Liebscher's cywinccompiler.py @@ -40,7 +40,7 @@ class EMXCCompiler (UnixCCompiler): shared_lib_format = "%s%s" res_extension = ".res" # compiled resource file exe_extension = ".exe" - + def __init__ (self, verbose=0, dry_run=0, @@ -56,11 +56,11 @@ class EMXCCompiler (UnixCCompiler): "Python's pyconfig.h doesn't seem to support your compiler. " + ("Reason: %s." % details) + "Compiling may fail because of undefined preprocessor macros.") - + (self.gcc_version, self.ld_version) = \ get_versions() self.debug_print(self.compiler_type + ": gcc %s, ld %s\n" % - (self.gcc_version, + (self.gcc_version, self.ld_version) ) # Hard-code GCC because that's what this is all about. @@ -73,7 +73,7 @@ class EMXCCompiler (UnixCCompiler): # want the gcc library statically linked (so that we don't have # to distribute a version dependent on the compiler we have) self.dll_libraries=["gcc"] - + # __init__ () def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): @@ -83,7 +83,7 @@ class EMXCCompiler (UnixCCompiler): self.spawn(["rc", "-r", src]) except DistutilsExecError, msg: raise CompileError, msg - else: # for other files use the C-compiler + else: # for other files use the C-compiler try: self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + extra_postargs) @@ -103,12 +103,12 @@ class EMXCCompiler (UnixCCompiler): extra_preargs=None, extra_postargs=None, build_temp=None): - + # use separate copies, so we can modify the lists extra_preargs = copy.copy(extra_preargs or []) libraries = copy.copy(libraries or []) objects = copy.copy(objects or []) - + # Additional libraries libraries.extend(self.dll_libraries) @@ -118,10 +118,10 @@ class EMXCCompiler (UnixCCompiler): (target_desc != self.EXECUTABLE)): # (The linker doesn't do anything if output is up-to-date. # So it would probably better to check if we really need this, - # but for this we had to insert some unchanged parts of - # UnixCCompiler, and this is not what we want.) + # but for this we had to insert some unchanged parts of + # UnixCCompiler, and this is not what we want.) - # we want to put some files in the same directory as the + # we want to put some files in the same directory as the # object files are, build_temp doesn't help much # where are the object files temp_dir = os.path.dirname(objects[0]) @@ -131,7 +131,7 @@ class EMXCCompiler (UnixCCompiler): # generate the filenames for these files def_file = os.path.join(temp_dir, dll_name + ".def") - + # Generate .def file contents = [ "LIBRARY %s INITINSTANCE TERMINSTANCE" % \ @@ -144,21 +144,21 @@ class EMXCCompiler (UnixCCompiler): "writing %s" % def_file) # next add options for def-file and to creating import libraries - # for gcc/ld the def-file is specified as any other object files + # for gcc/ld the def-file is specified as any other object files objects.append(def_file) #end: if ((export_symbols is not None) and # (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")): - + # who wants symbols and a many times larger output file - # should explicitly switch the debug mode on + # should explicitly switch the debug mode on # otherwise we let dllwrap/ld strip the output file - # (On my machine: 10KB < stripped_file < ??100KB + # (On my machine: 10KB < stripped_file < ??100KB # unstripped_file = stripped_file + XXX KB - # ( XXX=254 for a typical python extension)) - if not debug: - extra_preargs.append("-s") - + # ( XXX=254 for a typical python extension)) + if not debug: + extra_preargs.append("-s") + UnixCCompiler.link(self, target_desc, objects, @@ -172,7 +172,7 @@ class EMXCCompiler (UnixCCompiler): extra_preargs, extra_postargs, build_temp) - + # link () # -- Miscellaneous methods ----------------------------------------- @@ -196,7 +196,7 @@ class EMXCCompiler (UnixCCompiler): base = os.path.basename (base) if ext == '.rc': # these need to be compiled to object files - obj_names.append (os.path.join (output_dir, + obj_names.append (os.path.join (output_dir, base + self.res_extension)) else: obj_names.append (os.path.join (output_dir, @@ -216,7 +216,7 @@ class EMXCCompiler (UnixCCompiler): emx_dirs = os.environ['LIBRARY_PATH'].split(';') except KeyError: emx_dirs = [] - + for dir in dirs + emx_dirs: shortlibp = os.path.join(dir, shortlib) longlibp = os.path.join(dir, longlib) @@ -224,7 +224,7 @@ class EMXCCompiler (UnixCCompiler): return shortlibp elif os.path.exists(longlibp): return longlibp - + # Oops, didn't find it in *any* of 'dirs' return None @@ -266,15 +266,15 @@ def check_config_h(): # GCC, and the pyconfig.h file should be OK if string.find(sys.version,"GCC") >= 0: return (CONFIG_H_OK, "sys.version mentions 'GCC'") - + fn = sysconfig.get_config_h_filename() try: # It would probably better to read single lines to search. - # But we do this only once, and it is fast enough + # But we do this only once, and it is fast enough f = open(fn) s = f.read() f.close() - + except IOError, exc: # if we can't read this file, we cannot say it is wrong # the compiler will complain later about this file as missing @@ -296,7 +296,7 @@ def get_versions(): from distutils.version import StrictVersion from distutils.spawn import find_executable import re - + gcc_exe = find_executable('gcc') if gcc_exe: out = os.popen(gcc_exe + ' -dumpversion','r') @@ -313,4 +313,3 @@ def get_versions(): # anyway - so we can link OMF DLLs ld_version = None return (gcc_version, ld_version) - diff --git a/Lib/lib-tk/turtle.py b/Lib/lib-tk/turtle.py index d59cd7a..16e5735 100644 --- a/Lib/lib-tk/turtle.py +++ b/Lib/lib-tk/turtle.py @@ -199,7 +199,7 @@ class RawPen: if self._filling: self._path.append(self._position) self._draw_turtle() - + def heading(self): return self._angle @@ -209,13 +209,13 @@ class RawPen: def window_width(self): 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'] return width def window_height(self): 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'] return height @@ -254,7 +254,7 @@ class RawPen: if self._filling: self._path.append(self._position) if self._drawing: - if self._tracing: + if self._tracing: dx = float(x1 - x0) dy = float(y1 - y0) distance = hypot(dx, dy) diff --git a/Lib/test/test_multifile.py b/Lib/test/test_multifile.py index 8f70347..6cb946f 100644 --- a/Lib/test/test_multifile.py +++ b/Lib/test/test_multifile.py @@ -4,12 +4,12 @@ import cStringIO msg = """Mime-Version: 1.0 Content-Type: multipart/mixed; - boundary="=====================_590453667==_" + boundary="=====================_590453667==_" X-OriginalArrivalTime: 05 Feb 2002 03:43:23.0310 (UTC) FILETIME=[42D88CE0:01C1ADF7] --=====================_590453667==_ Content-Type: multipart/alternative; - boundary="=====================_590453677==_.ALT" + boundary="=====================_590453677==_.ALT" --=====================_590453677==_.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed @@ -49,8 +49,8 @@ def getMIMEMsg(mf): boundaries += 1 mf.push(boundary) - while mf.next(): - getMIMEMsg(mf) + while mf.next(): + getMIMEMsg(mf) mf.pop() else: lines = mf.readlines() |