]> granicus.if.org Git - python/commitdiff
A few lines were indented using spaces instead of tabs -- fix them.
authorGuido van Rossum <guido@python.org>
Thu, 26 Mar 1998 20:56:10 +0000 (20:56 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 26 Mar 1998 20:56:10 +0000 (20:56 +0000)
12 files changed:
Lib/binhex.py
Lib/bisect.py
Lib/copy.py
Lib/ftplib.py
Lib/gopherlib.py
Lib/mailbox.py
Lib/multifile.py
Lib/nntplib.py
Lib/profile.py
Lib/quopri.py
Lib/string.py
Lib/stringold.py

index 469344330757711089f6e3651fbc0b52cdef1e56..92ff4e4e6f7c1714f2e4d55779a9802a2152aa89 100644 (file)
@@ -89,9 +89,9 @@ else:
                fp = open(name)
                data = open(name).read(256)
                for c in data:
-                   if not c in string.whitespace \
-                       and (c<' ' or ord(c) > 0177):
-                       break
+                       if not c in string.whitespace \
+                           and (c<' ' or ord(c) > 0177):
+                               break
                else:
                        finfo.Type = 'TEXT'
                fp.seek(0, 2)
@@ -214,10 +214,10 @@ class BinHex:
                self.ofp.write(data)
 
        def _writecrc(self):
-           # XXXX Should this be here??
-           # self.crc = binascii.crc_hqx('\0\0', self.crc)
-           self.ofp.write(struct.pack('>h', self.crc))
-           self.crc = 0
+               # XXXX Should this be here??
+               # self.crc = binascii.crc_hqx('\0\0', self.crc)
+               self.ofp.write(struct.pack('>h', self.crc))
+               self.crc = 0
 
        def write(self, data):
                if self.state != _DID_HEADER:
index 4d92bc8e8aad661d74089cf0029be3e9477c881d..5fbc4efc02a9464c73030ce9631df90e1ef06bec 100644 (file)
@@ -6,7 +6,7 @@
 def insort(a, x, lo=0, hi=None):
        if hi is None:
                hi = len(a)
-        while lo < hi:
+       while lo < hi:
                mid = (lo+hi)/2
                if x < a[mid]: hi = mid
                else: lo = mid+1
@@ -18,7 +18,7 @@ def insort(a, x, lo=0, hi=None):
 def bisect(a, x, lo=0, hi=None):
        if hi is None:
                hi = len(a)
-        while lo < hi:
+       while lo < hi:
                mid = (lo+hi)/2
                if x < a[mid]: hi = mid
                else: lo = mid+1
index 1bdd4e15d6dd13832fefee749b4fe94af0783bb7..b481d29db7f43bb18fefada0206aff3d5a59941b 100644 (file)
@@ -198,20 +198,20 @@ def _deepcopy_dict(x, memo):
 d[types.DictionaryType] = _deepcopy_dict
 
 def _keep_alive(x, memo):
-    """Keeps a reference to the object x in the memo.
-
-    Because we remember objects by their id, we have
-    to assure that possibly temporary objects are kept
-    alive by referencing them.
-    We store a reference at the id of the memo, which should
-    normally not be used unless someone tries to deepcopy
-    the memo itself...
-    """
-    try:
-       memo[id(memo)].append(x)
-    except KeyError:
-       # aha, this is the first one :-)
-       memo[id(memo)]=[x]
+       """Keeps a reference to the object x in the memo.
+
+       Because we remember objects by their id, we have
+       to assure that possibly temporary objects are kept
+       alive by referencing them.
+       We store a reference at the id of the memo, which should
+       normally not be used unless someone tries to deepcopy
+       the memo itself...
+       """
+       try:
+               memo[id(memo)].append(x)
+       except KeyError:
+               # aha, this is the first one :-)
+               memo[id(memo)]=[x]
 
 def _deepcopy_inst(x, memo):
        if hasattr(x, '__deepcopy__'):
index 5274b75d7df8ba169fea951ccf29c98f6dfcf590..63903d0879441b64205b49a349ffeac896290b39 100644 (file)
@@ -40,9 +40,9 @@ import string
 
 # Import SOCKS module if it exists, else standard socket module socket
 try:
-    import SOCKS; socket = SOCKS
+       import SOCKS; socket = SOCKS
 except ImportError:
-    import socket
+       import socket
 
 
 # Magic number from <socket.h>
@@ -293,14 +293,14 @@ class FTP:
                        thishost = socket.gethostname()
                        # Make sure it is fully qualified
                        if not '.' in thishost:
-                           thisaddr = socket.gethostbyname(thishost)
-                           firstname, names, unused = \
-                                      socket.gethostbyaddr(thisaddr)
-                           names.insert(0, firstname)
-                           for name in names:
-                                   if '.' in name:
-                                           thishost = name
-                                           break
+                               thisaddr = socket.gethostbyname(thishost)
+                               firstname, names, unused = \
+                                          socket.gethostbyaddr(thisaddr)
+                               names.insert(0, firstname)
+                               for name in names:
+                                       if '.' in name:
+                                               thishost = name
+                                               break
                        try:
                                if os.environ.has_key('LOGNAME'):
                                        realuser = os.environ['LOGNAME']
@@ -419,15 +419,15 @@ class FTP:
                        raise error_reply, resp
                return self.voidcmd('RNTO ' + toname)
 
-        def delete(self, filename):
+       def delete(self, filename):
                '''Delete a file.'''
-                resp = self.sendcmd('DELE ' + filename)
-                if resp[:3] == '250':
-                        return resp
-                elif resp[:1] == '5':
-                        raise error_perm, resp
-                else:
-                        raise error_reply, resp
+               resp = self.sendcmd('DELE ' + filename)
+               if resp[:3] == '250':
+                       return resp
+               elif resp[:1] == '5':
+                       raise error_perm, resp
+               else:
+                       raise error_reply, resp
 
        def cwd(self, dirname):
                '''Change to a directory.'''
@@ -477,20 +477,21 @@ class FTP:
 _150_re = None
 
 def parse150(resp):
-    '''Parse the '150' response for a RETR request.
-    Returns the expected transfer size or None; size is not guaranteed to
-    be present in the 150 message.
-    '''
-    if resp[:3] != '150':
-       raise error_reply, resp
-    global _150_re
-    if _150_re is None:
-       import re
-       _150_re = re.compile("150 .* \(([0-9][0-9]*) bytes\)", re.IGNORECASE)
-    m = _150_re.match(resp)
-    if m:
-       return string.atoi(m.group(1))
-    return None
+       '''Parse the '150' response for a RETR request.
+       Returns the expected transfer size or None; size is not guaranteed to
+       be present in the 150 message.
+       '''
+       if resp[:3] != '150':
+               raise error_reply, resp
+       global _150_re
+       if _150_re is None:
+               import re
+               _150_re = re.compile("150 .* \(([0-9][0-9]*) bytes\)",
+                                    re.IGNORECASE)
+       m = _150_re.match(resp)
+       if m:
+               return string.atoi(m.group(1))
+       return None
 
 
 def parse227(resp):
@@ -561,104 +562,107 @@ def ftpcp(source, sourcename, target, targetname = '', type = 'I'):
 
 \f
 class Netrc:
-    """Class to parse & provide access to 'netrc' format files.
-
-    See the netrc(4) man page for information on the file format.
-
-    """
-    __defuser = None
-    __defpasswd = None
-    __defacct = None
-
-    def __init__(self, filename=None):
-       if not filename:
-           if os.environ.has_key("HOME"):
-               filename = os.path.join(os.environ["HOME"], ".netrc")
-           else:
-               raise IOError, "specify file to load or set $HOME"
-       self.__hosts = {}
-       self.__macros = {}
-       fp = open(filename, "r")
-       in_macro = 0
-       while 1:
-           line = fp.readline()
-           if not line: break
-           if in_macro and string.strip(line):
-               macro_lines.append(line)
-               continue
-           elif in_macro:
-               self.__macros[macro_name] = tuple(macro_lines)
+       """Class to parse & provide access to 'netrc' format files.
+
+       See the netrc(4) man page for information on the file format.
+
+       """
+       __defuser = None
+       __defpasswd = None
+       __defacct = None
+
+       def __init__(self, filename=None):
+               if not filename:
+                       if os.environ.has_key("HOME"):
+                               filename = os.path.join(os.environ["HOME"],
+                                                       ".netrc")
+                       else:
+                               raise IOError, \
+                                     "specify file to load or set $HOME"
+               self.__hosts = {}
+               self.__macros = {}
+               fp = open(filename, "r")
                in_macro = 0
-           words = string.split(line)
-           host = user = passwd = acct = None
-           default = 0
-           i = 0
-           while i < len(words):
-               w1 = words[i]
-               if i+1 < len(words):
-                   w2 = words[i + 1]
-               else:
-                   w2 = None
-               if w1 == 'default':
-                   default = 1
-               elif w1 == 'machine' and w2:
-                   host = string.lower(w2)
-                   i = i + 1
-               elif w1 == 'login' and w2:
-                   user = w2
-                   i = i + 1
-               elif w1 == 'password' and w2:
-                   passwd = w2
-                   i = i + 1
-               elif w1 == 'account' and w2:
-                   acct = w2
-                   i = i + 1
-               elif w1 == 'macdef' and w2:
-                   macro_name = w2
-                   macro_lines = []
-                   in_macro = 1
-                   break
-               i = i + 1
-           if default:
-               self.__defuser = user or self.__defuser
-               self.__defpasswd = passwd or self.__defpasswd
-               self.__defacct = acct or self.__defacct
-           if host:
-               if self.__hosts.has_key(host):
-                   ouser, opasswd, oacct = self.__hosts[host]
-                   user = user or ouser
-                   passwd = passwd or opasswd
-                   acct = acct or oacct
-               self.__hosts[host] = user, passwd, acct
-       fp.close()
+               while 1:
+                       line = fp.readline()
+                       if not line: break
+                       if in_macro and string.strip(line):
+                               macro_lines.append(line)
+                               continue
+                       elif in_macro:
+                               self.__macros[macro_name] = tuple(macro_lines)
+                               in_macro = 0
+                       words = string.split(line)
+                       host = user = passwd = acct = None
+                       default = 0
+                       i = 0
+                       while i < len(words):
+                               w1 = words[i]
+                               if i+1 < len(words):
+                                       w2 = words[i + 1]
+                               else:
+                                       w2 = None
+                               if w1 == 'default':
+                                       default = 1
+                               elif w1 == 'machine' and w2:
+                                       host = string.lower(w2)
+                                       i = i + 1
+                               elif w1 == 'login' and w2:
+                                       user = w2
+                                       i = i + 1
+                               elif w1 == 'password' and w2:
+                                       passwd = w2
+                                       i = i + 1
+                               elif w1 == 'account' and w2:
+                                       acct = w2
+                                       i = i + 1
+                               elif w1 == 'macdef' and w2:
+                                       macro_name = w2
+                                       macro_lines = []
+                                       in_macro = 1
+                                       break
+                               i = i + 1
+                       if default:
+                               self.__defuser = user or self.__defuser
+                               self.__defpasswd = passwd or self.__defpasswd
+                               self.__defacct = acct or self.__defacct
+                       if host:
+                               if self.__hosts.has_key(host):
+                                       ouser, opasswd, oacct = \
+                                              self.__hosts[host]
+                                       user = user or ouser
+                                       passwd = passwd or opasswd
+                                       acct = acct or oacct
+                               self.__hosts[host] = user, passwd, acct
+               fp.close()
 
-    def get_hosts(self):
-       """Return a list of hosts mentioned in the .netrc file."""
-       return self.__hosts.keys()
+       def get_hosts(self):
+               """Return a list of hosts mentioned in the .netrc file."""
+               return self.__hosts.keys()
 
-    def get_account(self, host):
-       """Returns login information for the named host.
+       def get_account(self, host):
+               """Returns login information for the named host.
 
-       The return value is a triple containing userid, password, and the
-       accounting field.
+               The return value is a triple containing userid,
+               password, and the accounting field.
 
-       """
-       host = string.lower(host)
-       user = passwd = acct = None
-       if self.__hosts.has_key(host):
-           user, passwd, acct = self.__hosts[host]
-       user = user or self.__defuser
-       passwd = passwd or self.__defpasswd
-       acct = acct or self.__defacct
-       return user, passwd, acct
+               """
+               host = string.lower(host)
+               user = passwd = acct = None
+               if self.__hosts.has_key(host):
+                       user, passwd, acct = self.__hosts[host]
+               user = user or self.__defuser
+               passwd = passwd or self.__defpasswd
+               acct = acct or self.__defacct
+               return user, passwd, acct
 
-    def get_macros(self):
-       """Return a list of all defined macro names."""
-       return self.__macros.keys()
+       def get_macros(self):
+               """Return a list of all defined macro names."""
+               return self.__macros.keys()
 
-    def get_macro(self, macro):
-       """Return a sequence of lines which define a named macro."""
-       return self.__macros[macro]
+       def get_macro(self, macro):
+               """Return a sequence of lines which define a named macro."""
+               return self.__macros[macro]
 
 
 \f
@@ -680,17 +684,18 @@ def test():
        ftp.set_debuglevel(debugging)
        userid = passwd = acct = ''
        try:
-           netrc = Netrc(rcfile)
+               netrc = Netrc(rcfile)
        except IOError:
-           if rcfile is not None:
-               sys.stderr.write("Could not open account file"
-                                " -- using anonymous login.")
+               if rcfile is not None:
+                       sys.stderr.write("Could not open account file"
+                                        " -- using anonymous login.")
        else:
-           try:
-               userid, passwd, acct = netrc.get_account(host)
-           except KeyError:
-               # no account for host
-               sys.stderr.write("No account -- using anonymous login.")
+               try:
+                       userid, passwd, acct = netrc.get_account(host)
+               except KeyError:
+                       # no account for host
+                       sys.stderr.write(
+                               "No account -- using anonymous login.")
        ftp.login(userid, passwd, acct)
        for file in sys.argv[2:]:
                if file[:2] == '-l':
index e91ef99eb70699e8aecc44643f0a3af452fd9155..033e579885db87c090690c9d18a0a9c930b853b7 100644 (file)
@@ -77,19 +77,20 @@ def send_query(selector, query, host, port = 0):
 
 # Takes a path as returned by urlparse and returns the appropriate selector
 def path_to_selector(path):
-    if path=="/":
-       return "/"
-    else:
-       return path[2:]   # Cuts initial slash and data type identifier
+       if path=="/":
+               return "/"
+       else:
+               return path[2:] # Cuts initial slash and data type identifier
 
 # Takes a path as returned by urlparse and maps it to a string
 # See section 3.4 of RFC 1738 for details
 def path_to_datatype_name(path):
-    if path=="/":
-       return "TYPE='unknown'" # No way to tell, although "INDEX" is probable
-    else:
-       return type_to_name(path[1])
-    
+       if path=="/":
+               # No way to tell, although "INDEX" is likely
+               return "TYPE='unknown'"
+       else:
+               return type_to_name(path[1])
+
 # The following functions interpret the data returned by the gopher
 # server according to the expected type, e.g. textfile or directory
 
@@ -118,7 +119,8 @@ def get_directory(f):
                        continue
                if len(parts) > 4:
                        if parts[4:] != ['+']:
-                           print '(Extra info from server:', parts[4:], ')'
+                               print '(Extra info from server:',
+                               print parts[4:], ')'
                else:
                        parts.append('')
                parts.insert(0, gtype)
index 37a4636cc30a79bdf69e37e951db8f490dcc2418..d1315d0b894388dc598ff36a484abcd7f92a32d2 100755 (executable)
@@ -7,6 +7,7 @@ import rfc822
 import os
 
 class _Mailbox:
+
        def __init__(self, fp):
                self.fp = fp
                self.seekp = 0
@@ -35,6 +36,7 @@ class _Mailbox:
                return rfc822.Message(_Subfile(self.fp, start, stop))
 
 class _Subfile:
+
        def __init__(self, fp, start, stop):
                self.fp = fp
                self.start = start
@@ -66,17 +68,18 @@ class _Subfile:
                return self.pos - self.start
 
        def seek(self, pos, whence=0):
-               if whence == 0:
-                   self.pos = self.start + pos
+               if whence == 0:
+                       self.pos = self.start + pos
                elif whence == 1:
-                   self.pos = self.pos + pos
+                       self.pos = self.pos + pos
                elif whence == 2:
-                   self.pos = self.stop + pos
+                       self.pos = self.stop + pos
 
        def close(self):
                pass
 
 class UnixMailbox(_Mailbox):
+
        def _search_start(self):
                while 1:
                        line = self.fp.readline()
@@ -96,6 +99,7 @@ class UnixMailbox(_Mailbox):
                                return
 
 class MmdfMailbox(_Mailbox):
+
        def _search_start(self):
                while 1:
                        line = self.fp.readline()
@@ -115,43 +119,45 @@ class MmdfMailbox(_Mailbox):
                                return
 
 class MHMailbox:
-    def __init__(self, dirname):
-       import re
-       pat = re.compile('^[0-9][0-9]*$')
-       self.dirname = dirname
-       files = os.listdir(self.dirname)
-       self.boxes = []
-       for f in files:
-           if pat.match(f):
-               self.boxes.append(f)
-
-    def next(self):
-       if not self.boxes:
-           return None
-       fn = self.boxes[0]
-       del self.boxes[0]
-       fp = open(os.path.join(self.dirname, fn))
-       return rfc822.Message(fp)
+
+       def __init__(self, dirname):
+               import re
+               pat = re.compile('^[0-9][0-9]*$')
+               self.dirname = dirname
+               files = os.listdir(self.dirname)
+               self.boxes = []
+               for f in files:
+                       if pat.match(f):
+                               self.boxes.append(f)
+
+       def next(self):
+               if not self.boxes:
+                       return None
+               fn = self.boxes[0]
+               del self.boxes[0]
+               fp = open(os.path.join(self.dirname, fn))
+               return rfc822.Message(fp)
            
     
 class BabylMailbox(_Mailbox):
-    def _search_start(self):
-       while 1:
-           line = self.fp.readline()
-           if not line:
-               raise EOFError
-           if line == '*** EOOH ***\n':
-               return
 
-    def _search_end(self):
-       while 1:
-           pos = self.fp.tell()
-           line = self.fp.readline()
-           if not line:
-               return
-           if line == '\037\014\n':
-               self.fp.seek(pos)
-               return
+       def _search_start(self):
+               while 1:
+                       line = self.fp.readline()
+                       if not line:
+                               raise EOFError
+                       if line == '*** EOOH ***\n':
+                               return
+
+       def _search_end(self):
+               while 1:
+                       pos = self.fp.tell()
+                       line = self.fp.readline()
+                       if not line:
+                               return
+                       if line == '\037\014\n':
+                               self.fp.seek(pos)
+                               return
 
 
 def _test():
index 247b01079de5031ab36ef4e04ab577611ede396e..8ba88e46328c056f75c0c034a5a41a277e4bb234 100644 (file)
@@ -45,15 +45,15 @@ class MultiFile:
                return self.fp.tell() - self.start
        #
        def seek(self, pos, whence=0):
-                here = self.tell()
-                if whence:
-                        if whence == 1:
-                                pos = pos + here
-                        elif whence == 2:
-                                if self.level > 0:
-                                        pos = pos + self.lastpos
-                                else:
-                                        raise Error, "can't use whence=2 yet"
+               here = self.tell()
+               if whence:
+                       if whence == 1:
+                               pos = pos + here
+                       elif whence == 2:
+                               if self.level > 0:
+                                       pos = pos + self.lastpos
+                               else:
+                                       raise Error, "can't use whence=2 yet"
                if not 0 <= pos <= here or \
                                self.level > 0 and pos > self.lastpos:
                        raise Error, 'bad MultiFile.seek() call'
index 85c2a63912a194948d77e01dcfbd06e8d3ed06eb..0ee3ab094e75d1ae9c0258a50b0b3ff8f61feee6 100644 (file)
@@ -72,14 +72,15 @@ class NNTP:
                self.debugging = 0
                self.welcome = self.getresp()
                if user:
-                   resp = self.shortcmd('authinfo user '+user)
-                   if resp[:3] == '381':
-                       if not password:
-                           raise error_reply, resp
-                       else:
-                           resp = self.shortcmd('authinfo pass '+password)
-                           if resp[:3] != '281':
-                               raise error_perm, resp
+                       resp = self.shortcmd('authinfo user '+user)
+                       if resp[:3] == '381':
+                               if not password:
+                                       raise error_reply, resp
+                               else:
+                                       resp = self.shortcmd(
+                                               'authinfo pass '+password)
+                                       if resp[:3] != '281':
+                                               raise error_perm, resp
 
        # Get the welcome message from the server
        # (this is read and squirreled away by __init__()).
index f7de6a42f54db9b46132ce72c9f1a400902e1ad2..df36c176a54fb6eed490fa76bffbc105e21604d9 100755 (executable)
@@ -438,7 +438,7 @@ class Profile:
                        sys.setprofile(None)
 
 
-        #******************************************************************
+       #******************************************************************
        # The following calculates the overhead for using a profiler.  The
        # problem is that it takes a fair amount of time for the profiler
        # to stop the stopwatch (from the time it recieves an event).
@@ -481,35 +481,36 @@ class Profile:
        # profiler very much, and the accuracy goes way up.
        #**************************************************************
        
-        def calibrate(self, m):
+       def calibrate(self, m):
+               # Modified by Tim Peters
                n = m
-               s = self.timer()
+               s = self.get_time()
                while n:
                        self.simple()
                        n = n - 1
-               f = self.timer()
-               my_simple = f[0]+f[1]-s[0]-s[1]
+               f = self.get_time()
+               my_simple = f - s
                #print "Simple =", my_simple,
 
                n = m
-               s = self.timer()
+               s = self.get_time()
                while n:
                        self.instrumented()
                        n = n - 1
-               f = self.timer()
-               my_inst = f[0]+f[1]-s[0]-s[1]
+               f = self.get_time()
+               my_inst = f - s
                # print "Instrumented =", my_inst
                avg_cost = (my_inst - my_simple)/m
                #print "Delta/call =", avg_cost, "(profiler fixup constant)"
                return avg_cost
 
        # simulate a program with no profiler activity
-        def simple(self):      
+       def simple(self):
                a = 1
                pass
 
        # simulate a program with call/return event processing
-        def instrumented(self):
+       def instrumented(self):
                a = 1
                self.profiler_simulation(a, a, a)
 
index e8e83977ef0b7494e42b452c6035e6066c13eed4..6b4559704e0f33b2b469f7702c8c6ac191f2f0c4 100755 (executable)
@@ -93,43 +93,43 @@ def test():
        import sys
        import getopt
        try:
-           opts, args = getopt.getopt(sys.argv[1:], 'td')
+               opts, args = getopt.getopt(sys.argv[1:], 'td')
        except getopt.error, msg:
-           sys.stdout = sys.stderr
-           print msg
-           print "usage: quopri [-t | -d] [file] ..."
-           print "-t: quote tabs"
-           print "-d: decode; default encode"
-           sys.exit(2)
+               sys.stdout = sys.stderr
+               print msg
+               print "usage: quopri [-t | -d] [file] ..."
+               print "-t: quote tabs"
+               print "-d: decode; default encode"
+               sys.exit(2)
        deco = 0
        tabs = 0
        for o, a in opts:
-           if o == '-t': tabs = 1
-           if o == '-d': deco = 1
+               if o == '-t': tabs = 1
+               if o == '-d': deco = 1
        if tabs and deco:
-           sys.stdout = sys.stderr
-           print "-t and -d are mutually exclusive"
-           sys.exit(2)
+               sys.stdout = sys.stderr
+               print "-t and -d are mutually exclusive"
+               sys.exit(2)
        if not args: args = ['-']
        sts = 0
        for file in args:
-           if file == '-':
-               fp = sys.stdin
-           else:
-               try:
-                   fp = open(file)
-               except IOError, msg:
-                   sys.stderr.write("%s: can't open (%s)\n" % (file, msg))
-                   sts = 1
-                   continue
-           if deco:
-               decode(fp, sys.stdout)
-           else:
-               encode(fp, sys.stdout, tabs)
-           if fp is not sys.stdin:
-               fp.close()
+               if file == '-':
+                       fp = sys.stdin
+               else:
+                       try:
+                               fp = open(file)
+                       except IOError, msg:
+                               sys.stderr.write("%s: can't open (%s)\n" % (file, msg))
+                               sts = 1
+                               continue
+               if deco:
+                       decode(fp, sys.stdout)
+               else:
+                       encode(fp, sys.stdout, tabs)
+               if fp is not sys.stdin:
+                       fp.close()
        if sts:
-           sys.exit(sts)
+               sys.exit(sts)
 
 if __name__ == '__main__':
        test()
index b2563f99572d2f964d5b7ff73ba6635428a8adc4..f2c37440a67ba2666edd68d7b9ca8460ca59488f 100644 (file)
@@ -203,7 +203,7 @@ def joinfields(words, sep = ' '):
 
        (joinfields and join are synonymous)
 
-       """    
+       """
        res = ''
        for w in words:
                res = res + (sep + w)
@@ -430,7 +430,7 @@ def ljust(s, width):
 
 # Right-justify a string
 def rjust(s, width):
-       """rjust(s, width) -> string
+       """rjust(s, width) -> string
 
        Return a right-justified version of s, in a field of the
        specified width, padded with spaces as needed.  The string is
@@ -443,7 +443,7 @@ def rjust(s, width):
 
 # Center a string
 def center(s, width):
-       """center(s, width) -> string
+       """center(s, width) -> string
 
        Return a center version of s, in a field of the specified
        width. padded with spaces as needed.  The string is never
@@ -508,7 +508,8 @@ def translate(s, table, deletions=""):
 
        """
        if type(table) != type('') or len(table) != 256:
-           raise TypeError, "translation table must be 256 characters long"
+               raise TypeError, \
+                     "translation table must be 256 characters long"
        res = ""
        for c in s:
                if c not in deletions:
index b2563f99572d2f964d5b7ff73ba6635428a8adc4..f2c37440a67ba2666edd68d7b9ca8460ca59488f 100644 (file)
@@ -203,7 +203,7 @@ def joinfields(words, sep = ' '):
 
        (joinfields and join are synonymous)
 
-       """    
+       """
        res = ''
        for w in words:
                res = res + (sep + w)
@@ -430,7 +430,7 @@ def ljust(s, width):
 
 # Right-justify a string
 def rjust(s, width):
-       """rjust(s, width) -> string
+       """rjust(s, width) -> string
 
        Return a right-justified version of s, in a field of the
        specified width, padded with spaces as needed.  The string is
@@ -443,7 +443,7 @@ def rjust(s, width):
 
 # Center a string
 def center(s, width):
-       """center(s, width) -> string
+       """center(s, width) -> string
 
        Return a center version of s, in a field of the specified
        width. padded with spaces as needed.  The string is never
@@ -508,7 +508,8 @@ def translate(s, table, deletions=""):
 
        """
        if type(table) != type('') or len(table) != 256:
-           raise TypeError, "translation table must be 256 characters long"
+               raise TypeError, \
+                     "translation table must be 256 characters long"
        res = ""
        for c in s:
                if c not in deletions: