raise TypeError, "unhashable type (it is mutable)"
def __setitem__(self, index, sub):
if index < 0:
- index += len(self.data)
+ index += len(self.data)
if index < 0 or index >= len(self.data): raise IndexError
self.data = self.data[:index] + sub + self.data[index+1:]
def __delitem__(self, index):
if index < 0:
- index += len(self.data)
+ index += len(self.data)
if index < 0 or index >= len(self.data): raise IndexError
self.data = self.data[:index] + self.data[index+1:]
def __setslice__(self, start, end, sub):
schema, netloc, url, params, query, fragments = \
urlparse.urlparse(self.repository)
assert not params and not query and not fragments
- if schema == 'http':
+ if schema == 'http':
http = httplib.HTTPConnection(netloc)
elif schema == 'https':
http = httplib.HTTPSConnection(netloc)
try:
http.connect()
http.putrequest("POST", url)
- http.putheader('Content-type',
+ http.putheader('Content-type',
'multipart/form-data; boundary=%s'%boundary)
http.putheader('Content-length', str(len(body)))
http.putheader('Authorization', auth)
r = http.getresponse()
if r.status == 200:
- self.announce('Server response (%s): %s' % (r.status, r.reason),
+ self.announce('Server response (%s): %s' % (r.status, r.reason),
log.INFO)
else:
- self.announce('Upload failed (%s): %s' % (r.status, r.reason),
+ self.announce('Upload failed (%s): %s' % (r.status, r.reason),
log.ERROR)
if self.show_response:
print '-'*75, r.read(), '-'*75
-
{"name": "package",
"version": "1.0",
"obsoletes": ["my.pkg (splat)"]})
-
+
def format_metadata(self, dist):
sio = StringIO.StringIO()
dist.metadata.write_pkg_file(sio)
import doctest
def test_suite():
- return doctest.DocTestSuite(distutils.versionpredicate)
+ return doctest.DocTestSuite(distutils.versionpredicate)
versionPredicateStr = versionPredicateStr.strip()
if not versionPredicateStr:
- raise ValueError("empty package restriction")
+ raise ValueError("empty package restriction")
match = re_validPackage.match(versionPredicateStr)
if not match:
- raise ValueError("bad package name in %r" % versionPredicateStr)
+ raise ValueError("bad package name in %r" % versionPredicateStr)
self.name, paren = match.groups()
paren = paren.strip()
if paren:
str = match.groups()[0]
self.pred = [splitUp(aPred) for aPred in str.split(",")]
if not self.pred:
- raise ValueError("empty parenthesized list in %r"
+ raise ValueError("empty parenthesized list in %r"
% versionPredicateStr)
else:
self.pred = []
def flush(self,zlib_mode=zlib.Z_SYNC_FLUSH):
if self.mode == WRITE:
- # Ensure the compressor's buffer is flushed
- self.fileobj.write(self.compress.flush(zlib_mode))
+ # Ensure the compressor's buffer is flushed
+ self.fileobj.write(self.compress.flush(zlib_mode))
self.fileobj.flush()
def fileno(self):
process to terminate. The optional input argument should be a
string to be sent to the child process, or None, if no data
should be sent to the child.
-
+
communicate() returns a tuple (stdout, stderr)."""
# Optimization: If we are only using one pipe, or no pipe at
# all, using select() or threads is unnecessary.
if [self.stdin, self.stdout, self.stderr].count(None) >= 2:
- stdout = None
- stderr = None
+ stdout = None
+ stderr = None
if self.stdin:
if input:
self.stdin.write(input)
stderr = self.stderr.read()
self.wait()
return (stdout, stderr)
-
+
return self._communicate(input)
if not result:
raise StopIteration
return result
-
+
#class ExFileObject
#------------------
in the standard library and test suite. This takes
a long time.
- subprocess Run all tests for the subprocess module.
+ subprocess Run all tests for the subprocess module.
To enable all resources except one, use '-uall,-<resource>'. For
example, to run all the tests except for the bsddb tests, give the
self.assertEqual(join(data), '0123456789')
join = self.thetype(''.join)
self.assertEqual(join(data), '0123456789')
-
+
class PartialSubclass(functional.partial):
pass
f.close()
f = open(TESTFN, "rb+")
- mf = mmap.mmap(f.fileno(), 0)
+ mf = mmap.mmap(f.fileno(), 0)
verify(len(mf) == 2**16, "Map size should equal file size.")
vereq(mf.read(2**16), 2**16 * "m")
mf.close()
finally:
os.unlink(TESTFN)
-
+
# test mapping of entire file by passing 0 for map length
if hasattr(os, "stat"):
print " Ensuring that passing 0 as map length sets map size to current file size."
try:
f.write(2**16 * 'm') # Arbitrary character
f.close()
-
+
f = open(TESTFN, "rb+")
- mf = mmap.mmap(f.fileno(), 0)
+ mf = mmap.mmap(f.fileno(), 0)
verify(len(mf) == 2**16, "Map size should equal file size.")
vereq(mf.read(2**16), 2**16 * "m")
mf.close()
f.close()
-
+
finally:
os.unlink(TESTFN)
-
+
print ' Test passed'
test_both()
if test_support.is_resource_enabled("subprocess") and not mswindows:
max_handles = 1026 # too much for most UNIX systems
else:
- max_handles = 65
+ max_handles = 65
for i in range(max_handles):
p = subprocess.Popen([sys.executable, "-c",
"import sys;sys.stdout.write(sys.stdin.read())"],
import xdrlib
xdrlib._test()
-
"24":"{9B81E618-2301-4035-AC77-75D9ABEB7301}",
"25":"{2e41b118-38bd-4c1b-a840-6977efd1b911}"
} [major+minor]
-
+
# Build the mingw import library, libpythonXY.a
# This requires 'nm' and 'dlltool' executables on your PATH