getopt() -- Parse command line options
gnu_getopt() -- Like getopt(), but allow option and non-option arguments
-to be intermixed.
+to be intermixed.
GetoptError -- exception (class) raised with 'opt' attribute, which is the
option involved with the exception.
"""
If the first character of the option string is `+', or if the
environment variable POSIXLY_CORRECT is set, then option
processing stops as soon as a non-option argument is encountered.
-
+
"""
opts = []
break
if self.debuglevel > 0:
print "header:", skip
-
+
self.status = status
self.reason = reason.strip()
if version == 'HTTP/1.0':
self._buffer = []
self.__response = None
self.__state = _CS_IDLE
-
+
self._set_hostport(host, port)
if strict is not None:
self.strict = strict
"""File-like object wrapping an SSL socket."""
BUFSIZE = 8192
-
+
def __init__(self, sock, ssl, bufsize=None):
SharedSocketClient.__init__(self, sock)
self._ssl = ssl
if amt is None:
return s + self._file.read()
else:
- return s + self._file.read(amt - len(s))
+ return s + self._file.read(amt - len(s))
else:
assert amt <= self._line_left
i = self._line_offset
if self._line_left == 0:
self._done()
return s
-
+
def readline(self):
s = self._line[self._line_offset:]
self._done()
h.close()
if hasattr(socket, 'ssl'):
-
+
for host, selector in (('sourceforge.net', '/projects/python'),
('dbserv2.theopalgroup.com', '/mediumfile'),
('dbserv2.theopalgroup.com', '/smallfile'),
# sslobj.read() sometimes returns < size bytes
data = self.sslobj.read(size)
while len(data) < size:
- data += self.sslobj.read(size-len(data))
+ data += self.sslobj.read(size-len(data))
return data
def __contains__(self, name):
"""Determine whether a message contains the named header."""
- return name.lower() in self.dict
+ return name.lower() in self.dict
def keys(self):
"""Get all of a message's header field names."""
test_zlib
""",
'atheos':
- """
- test_al
- test_cd
- test_cl
- test_curses
- test_dl
- test_email_codecs
- test_gdbm
- test_gl
- test_imgfile
- test_largefile
- test_linuxaudiodev
- test_locale
- test_mhlib
- test_mmap
- test_mpz
- test_nis
- test_poll
- test_popen2
- test_resource
- test_socket_ssl
- test_socketserver
- test_sunaudiodev
- test_unicode_file
- test_winreg
- test_winsound
- """,
+ """
+ test_al
+ test_cd
+ test_cl
+ test_curses
+ test_dl
+ test_email_codecs
+ test_gdbm
+ test_gl
+ test_imgfile
+ test_largefile
+ test_linuxaudiodev
+ test_locale
+ test_mhlib
+ test_mmap
+ test_mpz
+ test_nis
+ test_poll
+ test_popen2
+ test_resource
+ test_socket_ssl
+ test_socketserver
+ test_sunaudiodev
+ test_unicode_file
+ test_winreg
+ test_winsound
+ """,
}
class _ExpectedSkips:
import sys
sys.exitfunc = direct
-# Make sure atexit doesn't drop
+# Make sure atexit doesn't drop
def indirect():
print "indirect exit"
print 'complex'
class OS:
- def __complex__(self): return 1+10j
+ def __complex__(self): return 1+10j
class NS(object):
- def __complex__(self): return 1+10j
+ def __complex__(self): return 1+10j
if complex(OS()) != 1+10j: raise TestFailed, '__complex__ in old style class'
if complex(NS()) != 1+10j: raise TestFailed, '__complex__ in new style class'
if complex("1+10j") != 1+10j: raise TestFailed, 'complex("1+10j")'
... continue
... finally:
... yield i
-...
+...
>>> g = f()
>>> print g.next()
0
cookies = r.getheader("Set-Cookie")
if cookies != hdr:
raise AssertionError, "multiple headers not combined properly"
-
pass
else:
raise TestFailed, "sigsupsend didn't raise"
-
vereq(a[-100:100:], a)
vereq(a[100:-100:-1], a[::-1])
vereq(a[-100L:100L:2L], unicode('02468', 'ascii'))
-
+
print '6.5.2 Tuples'
if len(()) != 0: raise TestFailed, 'len(())'
whitespace_trans = string.maketrans(string.whitespace,
' ' * len(string.whitespace))
- # This funky little regex is just the trick for splitting
+ # This funky little regex is just the trick for splitting
# text up into word-wrappable chunks. E.g.
# "Hello there -- you goof-ball, use the -b option!"
# splits into
self.replace_whitespace = replace_whitespace
self.fix_sentence_endings = fix_sentence_endings
self.break_long_words = break_long_words
-
+
# -- Private methods -----------------------------------------------
# (possibly useful for subclasses to override)
break
# The current line is full, and the next chunk is too big to
- # fit on *any* line (not just this one).
+ # fit on *any* line (not just this one).
if chunks and len(chunks[0]) > width:
self._handle_long_word(chunks, cur_line, cur_len, width)
# The addinfourl classes depend on fp being a valid file
# object. In some cases, the HTTPError may not have a valid
# file object. If this happens, the simplest workaround is to
- # not initialize the base classes.
+ # not initialize the base classes.
if fp is not None:
self.__super_init(fp, hdrs, url)
user_pass, host = host.split('@', 1)
if ':' in user_pass:
user, password = user_pass.split(':', 1)
- user_pass = base64.encodestring('%s:%s' % (unquote(user),
+ user_pass = base64.encodestring('%s:%s' % (unquote(user),
unquote(password)))
req.add_header('Proxy-Authorization', 'Basic ' + user_pass)
host = unquote(host)
except TypeError:
return 0
return wr in self.data
-
+
def items(self):
L = []
for key, value in self.data.items():