Commit e07745ec authored by Guido van Rossum's avatar Guido van Rossum

A few lines were indented using spaces instead of tabs -- fix them.

parent 3e415c72
...@@ -486,7 +486,8 @@ def parse150(resp): ...@@ -486,7 +486,8 @@ def parse150(resp):
global _150_re global _150_re
if _150_re is None: if _150_re is None:
import re import re
_150_re = re.compile("150 .* \(([0-9][0-9]*) bytes\)", re.IGNORECASE) _150_re = re.compile("150 .* \(([0-9][0-9]*) bytes\)",
re.IGNORECASE)
m = _150_re.match(resp) m = _150_re.match(resp)
if m: if m:
return string.atoi(m.group(1)) return string.atoi(m.group(1))
...@@ -573,9 +574,11 @@ class Netrc: ...@@ -573,9 +574,11 @@ class Netrc:
def __init__(self, filename=None): def __init__(self, filename=None):
if not filename: if not filename:
if os.environ.has_key("HOME"): if os.environ.has_key("HOME"):
filename = os.path.join(os.environ["HOME"], ".netrc") filename = os.path.join(os.environ["HOME"],
".netrc")
else: else:
raise IOError, "specify file to load or set $HOME" raise IOError, \
"specify file to load or set $HOME"
self.__hosts = {} self.__hosts = {}
self.__macros = {} self.__macros = {}
fp = open(filename, "r") fp = open(filename, "r")
...@@ -625,7 +628,8 @@ class Netrc: ...@@ -625,7 +628,8 @@ class Netrc:
self.__defacct = acct or self.__defacct self.__defacct = acct or self.__defacct
if host: if host:
if self.__hosts.has_key(host): if self.__hosts.has_key(host):
ouser, opasswd, oacct = self.__hosts[host] ouser, opasswd, oacct = \
self.__hosts[host]
user = user or ouser user = user or ouser
passwd = passwd or opasswd passwd = passwd or opasswd
acct = acct or oacct acct = acct or oacct
...@@ -639,8 +643,8 @@ class Netrc: ...@@ -639,8 +643,8 @@ class Netrc:
def get_account(self, host): def get_account(self, host):
"""Returns login information for the named host. """Returns login information for the named host.
The return value is a triple containing userid, password, and the The return value is a triple containing userid,
accounting field. password, and the accounting field.
""" """
host = string.lower(host) host = string.lower(host)
...@@ -690,7 +694,8 @@ def test(): ...@@ -690,7 +694,8 @@ def test():
userid, passwd, acct = netrc.get_account(host) userid, passwd, acct = netrc.get_account(host)
except KeyError: except KeyError:
# no account for host # no account for host
sys.stderr.write("No account -- using anonymous login.") sys.stderr.write(
"No account -- using anonymous login.")
ftp.login(userid, passwd, acct) ftp.login(userid, passwd, acct)
for file in sys.argv[2:]: for file in sys.argv[2:]:
if file[:2] == '-l': if file[:2] == '-l':
......
...@@ -86,7 +86,8 @@ def path_to_selector(path): ...@@ -86,7 +86,8 @@ def path_to_selector(path):
# See section 3.4 of RFC 1738 for details # See section 3.4 of RFC 1738 for details
def path_to_datatype_name(path): def path_to_datatype_name(path):
if path=="/": if path=="/":
return "TYPE='unknown'" # No way to tell, although "INDEX" is probable # No way to tell, although "INDEX" is likely
return "TYPE='unknown'"
else: else:
return type_to_name(path[1]) return type_to_name(path[1])
...@@ -118,7 +119,8 @@ def get_directory(f): ...@@ -118,7 +119,8 @@ def get_directory(f):
continue continue
if len(parts) > 4: if len(parts) > 4:
if parts[4:] != ['+']: if parts[4:] != ['+']:
print '(Extra info from server:', parts[4:], ')' print '(Extra info from server:',
print parts[4:], ')'
else: else:
parts.append('') parts.append('')
parts.insert(0, gtype) parts.insert(0, gtype)
......
...@@ -7,6 +7,7 @@ import rfc822 ...@@ -7,6 +7,7 @@ import rfc822
import os import os
class _Mailbox: class _Mailbox:
def __init__(self, fp): def __init__(self, fp):
self.fp = fp self.fp = fp
self.seekp = 0 self.seekp = 0
...@@ -35,6 +36,7 @@ class _Mailbox: ...@@ -35,6 +36,7 @@ class _Mailbox:
return rfc822.Message(_Subfile(self.fp, start, stop)) return rfc822.Message(_Subfile(self.fp, start, stop))
class _Subfile: class _Subfile:
def __init__(self, fp, start, stop): def __init__(self, fp, start, stop):
self.fp = fp self.fp = fp
self.start = start self.start = start
...@@ -77,6 +79,7 @@ class _Subfile: ...@@ -77,6 +79,7 @@ class _Subfile:
pass pass
class UnixMailbox(_Mailbox): class UnixMailbox(_Mailbox):
def _search_start(self): def _search_start(self):
while 1: while 1:
line = self.fp.readline() line = self.fp.readline()
...@@ -96,6 +99,7 @@ class UnixMailbox(_Mailbox): ...@@ -96,6 +99,7 @@ class UnixMailbox(_Mailbox):
return return
class MmdfMailbox(_Mailbox): class MmdfMailbox(_Mailbox):
def _search_start(self): def _search_start(self):
while 1: while 1:
line = self.fp.readline() line = self.fp.readline()
...@@ -115,6 +119,7 @@ class MmdfMailbox(_Mailbox): ...@@ -115,6 +119,7 @@ class MmdfMailbox(_Mailbox):
return return
class MHMailbox: class MHMailbox:
def __init__(self, dirname): def __init__(self, dirname):
import re import re
pat = re.compile('^[0-9][0-9]*$') pat = re.compile('^[0-9][0-9]*$')
...@@ -135,6 +140,7 @@ class MHMailbox: ...@@ -135,6 +140,7 @@ class MHMailbox:
class BabylMailbox(_Mailbox): class BabylMailbox(_Mailbox):
def _search_start(self): def _search_start(self):
while 1: while 1:
line = self.fp.readline() line = self.fp.readline()
......
...@@ -77,7 +77,8 @@ class NNTP: ...@@ -77,7 +77,8 @@ class NNTP:
if not password: if not password:
raise error_reply, resp raise error_reply, resp
else: else:
resp = self.shortcmd('authinfo pass '+password) resp = self.shortcmd(
'authinfo pass '+password)
if resp[:3] != '281': if resp[:3] != '281':
raise error_perm, resp raise error_perm, resp
......
...@@ -482,22 +482,23 @@ class Profile: ...@@ -482,22 +482,23 @@ class Profile:
#************************************************************** #**************************************************************
def calibrate(self, m): def calibrate(self, m):
# Modified by Tim Peters
n = m n = m
s = self.timer() s = self.get_time()
while n: while n:
self.simple() self.simple()
n = n - 1 n = n - 1
f = self.timer() f = self.get_time()
my_simple = f[0]+f[1]-s[0]-s[1] my_simple = f - s
#print "Simple =", my_simple, #print "Simple =", my_simple,
n = m n = m
s = self.timer() s = self.get_time()
while n: while n:
self.instrumented() self.instrumented()
n = n - 1 n = n - 1
f = self.timer() f = self.get_time()
my_inst = f[0]+f[1]-s[0]-s[1] my_inst = f - s
# print "Instrumented =", my_inst # print "Instrumented =", my_inst
avg_cost = (my_inst - my_simple)/m avg_cost = (my_inst - my_simple)/m
#print "Delta/call =", avg_cost, "(profiler fixup constant)" #print "Delta/call =", avg_cost, "(profiler fixup constant)"
......
...@@ -508,7 +508,8 @@ def translate(s, table, deletions=""): ...@@ -508,7 +508,8 @@ def translate(s, table, deletions=""):
""" """
if type(table) != type('') or len(table) != 256: 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 = "" res = ""
for c in s: for c in s:
if c not in deletions: if c not in deletions:
......
...@@ -508,7 +508,8 @@ def translate(s, table, deletions=""): ...@@ -508,7 +508,8 @@ def translate(s, table, deletions=""):
""" """
if type(table) != type('') or len(table) != 256: 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 = "" res = ""
for c in s: for c in s:
if c not in deletions: if c not in deletions:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment