rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
while self.pos < len(self.field): if self.field[self.pos] in self.atomends:
if atomends is None: atomends = self.atomends while self.pos < len(self.field): if self.field[self.pos] in atomends:
def getatom(self): """Parse an RFC-822 atom.""" atomlist = ['']
1fb22bb24fd395a12a225b2418ea8d22d5b37610 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1fb22bb24fd395a12a225b2418ea8d22d5b37610/_parseaddr.py
"""Parse a sequence of RFC-822 phrases. A phrase is a sequence of words, which are in turn either RFC-822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space.
"""Parse a sequence of RFC 2822 phrases. A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space.
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
1fb22bb24fd395a12a225b2418ea8d22d5b37610 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1fb22bb24fd395a12a225b2418ea8d22d5b37610/_parseaddr.py
elif self.field[self.pos] in self.atomends: break else: plist.append(self.getatom())
elif self.field[self.pos] in self.phraseends: break else: plist.append(self.getatom(self.phraseends))
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
1fb22bb24fd395a12a225b2418ea8d22d5b37610 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1fb22bb24fd395a12a225b2418ea8d22d5b37610/_parseaddr.py
"""An AddressList encapsulates a list of parsed RFC822 addresses."""
"""An AddressList encapsulates a list of parsed RFC 2822 addresses."""
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
1fb22bb24fd395a12a225b2418ea8d22d5b37610 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1fb22bb24fd395a12a225b2418ea8d22d5b37610/_parseaddr.py
childNodeTypes = (Node.TEXT_NODE, Node.ENTITY_REFERENCE_NODE)
def _getElementsByTagNameNSHelper(parent, nsURI, localName, rc): for node in parent.childNodes: if node.nodeType == Node.ELEMENT_NODE: if ((localName == "*" or node.tagName == localName) and (nsURI == "*" or node.namespaceURI == nsURI)): rc.append(node) _getElementsByTagNameNSHelper(node, nsURI, localName, rc) return rc
291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2/minidom.py
childNodeTypes = (Node.ELEMENT_NODE, Node.PROCESSING_INSTRUCTION_NODE, Node.COMMENT_NODE, Node.TEXT_NODE, Node.CDATA_SECTION_NODE, Node.ENTITY_REFERENCE_NODE)
def __delitem__(self, attname_or_tuple): node = self[attname_or_tuple] node.unlink() del self._attrs[node.name] del self._attrsNS[(node.namespaceURI, node.localName)] self.length = len(self._attrs)
291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2/minidom.py
childNodeTypes = ()
def _get_attributes(self): return AttributeList(self._attrs, self._attrsNS)
291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2/minidom.py
childNodeTypes = ()
def writexml(self, writer): writer.write("<!--%s-->" % self.data)
291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2/minidom.py
childNodeTypes = ()
def writexml(self, writer): writer.write("<?%s %s?>" % (self.target, self.data))
291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2/minidom.py
f = file(fullname, "rU")
f = open(fullname, "rU")
def addpackage(sitedir, name, known_paths): """Add a new path to known_paths by combining sitedir and 'name' or execute sitedir if it starts with 'import'""" if known_paths is None: _init_pathinfo() reset = 1 else: reset = 0 fullname = os.path.join(sitedir, name) try: f = file(fullname, "rU") except IOError: return try: for line in f: if line.startswith("#"): continue if line.startswith("import"): exec line continue line = line.rstrip() dir, dircase = makepath(sitedir, line) if not dircase in known_paths and os.path.exists(dir): sys.path.append(dir) known_paths.add(dircase) finally: f.close() if reset: known_paths = None return known_paths
4d0bddfee66383e746a79d60cd64e40fc1ab1df7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4d0bddfee66383e746a79d60cd64e40fc1ab1df7/site.py
d = _init_pathinfo()
known_paths = _init_pathinfo()
def addsitedir(sitedir, known_paths=None): """Add 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'""" if known_paths is None: d = _init_pathinfo() reset = 1 else: reset = 0 sitedir, sitedircase = makepath(sitedir) if not sitedircase in known_paths: sys.path.append(sitedir) # Add path component try: names = os.listdir(sitedir) except os.error: return names.sort() for name in names: if name[-4:] == os.extsep + "pth": addpackage(sitedir, name, known_paths) if reset: known_paths = None return known_paths
4d0bddfee66383e746a79d60cd64e40fc1ab1df7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4d0bddfee66383e746a79d60cd64e40fc1ab1df7/site.py
if name[-4:] == os.extsep + "pth":
if name.endswith(os.extsep + "pth"):
def addsitedir(sitedir, known_paths=None): """Add 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'""" if known_paths is None: d = _init_pathinfo() reset = 1 else: reset = 0 sitedir, sitedircase = makepath(sitedir) if not sitedircase in known_paths: sys.path.append(sitedir) # Add path component try: names = os.listdir(sitedir) except os.error: return names.sort() for name in names: if name[-4:] == os.extsep + "pth": addpackage(sitedir, name, known_paths) if reset: known_paths = None return known_paths
4d0bddfee66383e746a79d60cd64e40fc1ab1df7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4d0bddfee66383e746a79d60cd64e40fc1ab1df7/site.py
compiler = self.compiler
def build_libraries (self, libraries):
f4aa684132a2752118af9a2412f0acc90c258035 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f4aa684132a2752118af9a2412f0acc90c258035/build_clib.py
f2 = self.tar.extractfile("/S-SPARSE-WITH-NULLS")
f2 = self.tar.extractfile("S-SPARSE-WITH-NULLS")
def test_sparse(self): """Test sparse member extraction. """ if self.sep != "|": f1 = self.tar.extractfile("S-SPARSE") f2 = self.tar.extractfile("/S-SPARSE-WITH-NULLS") self.assert_(f1.read() == f2.read(), "_FileObject failed on sparse file member")
149a8993b0cc7a4c3a252b9387a28b8c75bc1116 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/149a8993b0cc7a4c3a252b9387a28b8c75bc1116/test_tarfile.py
filename = "/0-REGTYPE-TEXT"
filename = "0-REGTYPE-TEXT"
def test_readlines(self): """Test readlines() method of _FileObject. """ if self.sep != "|": filename = "/0-REGTYPE-TEXT" self.tar.extract(filename, dirname()) lines1 = file(os.path.join(dirname(), filename), "rU").readlines() lines2 = self.tar.extractfile(filename).readlines() self.assert_(lines1 == lines2, "_FileObject.readline() does not work correctly")
149a8993b0cc7a4c3a252b9387a28b8c75bc1116 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/149a8993b0cc7a4c3a252b9387a28b8c75bc1116/test_tarfile.py
filename = "/0-REGTYPE"
filename = "0-REGTYPE"
def test_seek(self): """Test seek() method of _FileObject, incl. random reading. """ if self.sep != "|": filename = "/0-REGTYPE" self.tar.extract(filename, dirname()) data = file(os.path.join(dirname(), filename), "rb").read()
149a8993b0cc7a4c3a252b9387a28b8c75bc1116 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/149a8993b0cc7a4c3a252b9387a28b8c75bc1116/test_tarfile.py
"contact_email", "licence", "classifiers",
"contact_email", "license", "classifiers",
def is_pure (self): return (self.has_pure_modules() and not self.has_ext_modules() and not self.has_c_libraries())
a52b85262ae7c0ce3ba92ee7e933f5a449690b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a52b85262ae7c0ce3ba92ee7e933f5a449690b8c/dist.py
exts.append( Extension('_locale', ['_localemodule.c']) )
if platform in ['cygwin']: locale_libs = ['intl'] else: locale_libs = [] exts.append( Extension('_locale', ['_localemodule.c'], libraries=locale_libs ) )
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
d28216b279743ed680d84fe37da190e9754e6be4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d28216b279743ed680d84fe37da190e9754e6be4/setup.py
except socket.err, exc:
except socket.error, exc:
def test_timeout(): test_support.requires('network') if test_support.verbose: print "test_timeout ..." # A service which issues a welcome banner (without need to write # anything). # XXX ("gmail.org", 995) has been unreliable so far, from time to time # XXX non-responsive for hours on end (& across all buildbot slaves, # XXX so that's not just a local thing). ADDR = "gmail.org", 995 s = socket.socket() s.settimeout(30.0) try: s.connect(ADDR) except socket.timeout: print >> sys.stderr, """\ WARNING: an attempt to connect to %r timed out, in test_timeout. That may be legitimate, but is not the outcome we hoped for. If this message is seen often, test_timeout should be changed to use a more reliable address.""" % (ADDR,) return except socket.err, exc: # In case connection is refused. if (isinstance(exc.message, tuple) and exc.message[0] == errno.ECONNREFUSED): raise test_support.TestSkipped("test socket connection refused") else: raise exc ss = socket.ssl(s) # Read part of return welcome banner twice. ss.read(1) ss.read(1) s.close()
115ecb9211ec083494d90c88dcbca2da558d1994 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/115ecb9211ec083494d90c88dcbca2da558d1994/test_socket_ssl.py
basename, ext = os.path.splitext (output_filename) output_filename = basename + '_d' + ext
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None):
95c0b269de14f56a5b5d8fd0b57871b373b4b100 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/95c0b269de14f56a5b5d8fd0b57871b373b4b100/msvccompiler.py
('two', '(compound, (argument, list))',))
('two', '(compound, (argument, list))', 'compound', 'argument', 'list',))
def f5((compound, first), two): pass
4ab7adbd944c72b9f308e940524ca31a10e52bd8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4ab7adbd944c72b9f308e940524ca31a10e52bd8/test_grammar.py
child.id = None
child.my_id = None
def my_ringer(child): child.id = None stdwin.fleep()
0e71dc1106575f26cb55e55daec7c96955fffafa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0e71dc1106575f26cb55e55daec7c96955fffafa/TestSched.py
WindowSched.enter(child.my_number*1000, 0, my_ringer, child)
WindowSched.enter(child.my_number*1000, 0, my_ringer, (child,))
def my_hook(child): # schedule for the bell to ring in N seconds; cancel previous if child.my_id: WindowSched.cancel(child.my_id) child.my_id = \ WindowSched.enter(child.my_number*1000, 0, my_ringer, child)
0e71dc1106575f26cb55e55daec7c96955fffafa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0e71dc1106575f26cb55e55daec7c96955fffafa/TestSched.py
t0 = time.millitimer()
t0 = time.time()
def record(v, info, filename, audiofilename, mono, grey, greybits, \ monotreshold, fields, preallocspace): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile.VoutFile(filename) if mono: format = 'mono' elif grey and greybits == 8: format = 'grey' elif grey: format = 'grey'+`abs(greybits)` else: format = 'rgb8' vout.setformat(format) vout.setsize(x, y) if fields: vout.setpf((1, -2)) vout.writeheader() if preallocspace: print 'Preallocating space...' vout.prealloc(preallocspace) print 'done.' MAXSIZE = 20 # XXX should be a user option import Queue queue = Queue.Queue(MAXSIZE) done = thread.allocate_lock() done.acquire_lock() convertor = None if grey: if greybits == 2: convertor = imageop.grey2grey2 elif greybits == 4: convertor = imageop.grey2grey4 elif greybits == -2: convertor = imageop.dither2grey2 thread.start_new_thread(saveframes, \ (vout, queue, done, mono, monotreshold, convertor)) if audiofilename: audiodone = thread.allocate_lock() audiodone.acquire_lock() audiostop = [] initaudio(audiofilename, audiostop, audiodone) gl.wintitle('(rec) ' + filename) lastid = 0 t0 = time.millitimer() count = 0 ids = [] v.InitContinuousCapture(info) while not gl.qtest(): try: cd, id = v.GetCaptureData() except sv.error: #time.millisleep(10) # XXX is this necessary? sgi.nap(1) # XXX Try by Jack continue ids.append(id) id = id + 2*rate
0efafb39da32880543cd890590a4185b05040479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0efafb39da32880543cd890590a4185b05040479/Vrec.py
def record(v, info, filename, audiofilename, mono, grey, greybits, \ monotreshold, fields, preallocspace): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile.VoutFile(filename) if mono: format = 'mono' elif grey and greybits == 8: format = 'grey' elif grey: format = 'grey'+`abs(greybits)` else: format = 'rgb8' vout.setformat(format) vout.setsize(x, y) if fields: vout.setpf((1, -2)) vout.writeheader() if preallocspace: print 'Preallocating space...' vout.prealloc(preallocspace) print 'done.' MAXSIZE = 20 # XXX should be a user option import Queue queue = Queue.Queue(MAXSIZE) done = thread.allocate_lock() done.acquire_lock() convertor = None if grey: if greybits == 2: convertor = imageop.grey2grey2 elif greybits == 4: convertor = imageop.grey2grey4 elif greybits == -2: convertor = imageop.dither2grey2 thread.start_new_thread(saveframes, \ (vout, queue, done, mono, monotreshold, convertor)) if audiofilename: audiodone = thread.allocate_lock() audiodone.acquire_lock() audiostop = [] initaudio(audiofilename, audiostop, audiodone) gl.wintitle('(rec) ' + filename) lastid = 0 t0 = time.millitimer() count = 0 ids = [] v.InitContinuousCapture(info) while not gl.qtest(): try: cd, id = v.GetCaptureData() except sv.error: #time.millisleep(10) # XXX is this necessary? sgi.nap(1) # XXX Try by Jack continue ids.append(id) id = id + 2*rate
0efafb39da32880543cd890590a4185b05040479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0efafb39da32880543cd890590a4185b05040479/Vrec.py
t1 = time.millitimer()
t1 = time.time()
def record(v, info, filename, audiofilename, mono, grey, greybits, \ monotreshold, fields, preallocspace): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile.VoutFile(filename) if mono: format = 'mono' elif grey and greybits == 8: format = 'grey' elif grey: format = 'grey'+`abs(greybits)` else: format = 'rgb8' vout.setformat(format) vout.setsize(x, y) if fields: vout.setpf((1, -2)) vout.writeheader() if preallocspace: print 'Preallocating space...' vout.prealloc(preallocspace) print 'done.' MAXSIZE = 20 # XXX should be a user option import Queue queue = Queue.Queue(MAXSIZE) done = thread.allocate_lock() done.acquire_lock() convertor = None if grey: if greybits == 2: convertor = imageop.grey2grey2 elif greybits == 4: convertor = imageop.grey2grey4 elif greybits == -2: convertor = imageop.dither2grey2 thread.start_new_thread(saveframes, \ (vout, queue, done, mono, monotreshold, convertor)) if audiofilename: audiodone = thread.allocate_lock() audiodone.acquire_lock() audiostop = [] initaudio(audiofilename, audiostop, audiodone) gl.wintitle('(rec) ' + filename) lastid = 0 t0 = time.millitimer() count = 0 ids = [] v.InitContinuousCapture(info) while not gl.qtest(): try: cd, id = v.GetCaptureData() except sv.error: #time.millisleep(10) # XXX is this necessary? sgi.nap(1) # XXX Try by Jack continue ids.append(id) id = id + 2*rate
0efafb39da32880543cd890590a4185b05040479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0efafb39da32880543cd890590a4185b05040479/Vrec.py
print lastid, 'fields in', t1-t0, 'msec', print '--', 0.1 * int(lastid * 10000.0 / (t1-t0)), 'fields/sec'
print lastid, 'fields in', round(t1-t0, 3), 'sec', print '--', round(lastid/(t1-t0), 1), 'fields/sec'
def record(v, info, filename, audiofilename, mono, grey, greybits, \ monotreshold, fields, preallocspace): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile.VoutFile(filename) if mono: format = 'mono' elif grey and greybits == 8: format = 'grey' elif grey: format = 'grey'+`abs(greybits)` else: format = 'rgb8' vout.setformat(format) vout.setsize(x, y) if fields: vout.setpf((1, -2)) vout.writeheader() if preallocspace: print 'Preallocating space...' vout.prealloc(preallocspace) print 'done.' MAXSIZE = 20 # XXX should be a user option import Queue queue = Queue.Queue(MAXSIZE) done = thread.allocate_lock() done.acquire_lock() convertor = None if grey: if greybits == 2: convertor = imageop.grey2grey2 elif greybits == 4: convertor = imageop.grey2grey4 elif greybits == -2: convertor = imageop.dither2grey2 thread.start_new_thread(saveframes, \ (vout, queue, done, mono, monotreshold, convertor)) if audiofilename: audiodone = thread.allocate_lock() audiodone.acquire_lock() audiostop = [] initaudio(audiofilename, audiostop, audiodone) gl.wintitle('(rec) ' + filename) lastid = 0 t0 = time.millitimer() count = 0 ids = [] v.InitContinuousCapture(info) while not gl.qtest(): try: cd, id = v.GetCaptureData() except sv.error: #time.millisleep(10) # XXX is this necessary? sgi.nap(1) # XXX Try by Jack continue ids.append(id) id = id + 2*rate
0efafb39da32880543cd890590a4185b05040479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0efafb39da32880543cd890590a4185b05040479/Vrec.py
print 0.1*int(count*20000.0/(t1-t0)), 'f/s',
print round(count*2/(t1-t0), 1), 'f/s',
def record(v, info, filename, audiofilename, mono, grey, greybits, \ monotreshold, fields, preallocspace): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile.VoutFile(filename) if mono: format = 'mono' elif grey and greybits == 8: format = 'grey' elif grey: format = 'grey'+`abs(greybits)` else: format = 'rgb8' vout.setformat(format) vout.setsize(x, y) if fields: vout.setpf((1, -2)) vout.writeheader() if preallocspace: print 'Preallocating space...' vout.prealloc(preallocspace) print 'done.' MAXSIZE = 20 # XXX should be a user option import Queue queue = Queue.Queue(MAXSIZE) done = thread.allocate_lock() done.acquire_lock() convertor = None if grey: if greybits == 2: convertor = imageop.grey2grey2 elif greybits == 4: convertor = imageop.grey2grey4 elif greybits == -2: convertor = imageop.dither2grey2 thread.start_new_thread(saveframes, \ (vout, queue, done, mono, monotreshold, convertor)) if audiofilename: audiodone = thread.allocate_lock() audiodone.acquire_lock() audiostop = [] initaudio(audiofilename, audiostop, audiodone) gl.wintitle('(rec) ' + filename) lastid = 0 t0 = time.millitimer() count = 0 ids = [] v.InitContinuousCapture(info) while not gl.qtest(): try: cd, id = v.GetCaptureData() except sv.error: #time.millisleep(10) # XXX is this necessary? sgi.nap(1) # XXX Try by Jack continue ids.append(id) id = id + 2*rate
0efafb39da32880543cd890590a4185b05040479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0efafb39da32880543cd890590a4185b05040479/Vrec.py
print count*200.0/lastid, '%,', print count*rate*200.0/lastid, '% of wanted rate',
print '(', print round(count*200.0/lastid), '%, or', print round(count*rate*200.0/lastid), '% of wanted rate )',
def record(v, info, filename, audiofilename, mono, grey, greybits, \ monotreshold, fields, preallocspace): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile.VoutFile(filename) if mono: format = 'mono' elif grey and greybits == 8: format = 'grey' elif grey: format = 'grey'+`abs(greybits)` else: format = 'rgb8' vout.setformat(format) vout.setsize(x, y) if fields: vout.setpf((1, -2)) vout.writeheader() if preallocspace: print 'Preallocating space...' vout.prealloc(preallocspace) print 'done.' MAXSIZE = 20 # XXX should be a user option import Queue queue = Queue.Queue(MAXSIZE) done = thread.allocate_lock() done.acquire_lock() convertor = None if grey: if greybits == 2: convertor = imageop.grey2grey2 elif greybits == 4: convertor = imageop.grey2grey4 elif greybits == -2: convertor = imageop.dither2grey2 thread.start_new_thread(saveframes, \ (vout, queue, done, mono, monotreshold, convertor)) if audiofilename: audiodone = thread.allocate_lock() audiodone.acquire_lock() audiostop = [] initaudio(audiofilename, audiostop, audiodone) gl.wintitle('(rec) ' + filename) lastid = 0 t0 = time.millitimer() count = 0 ids = [] v.InitContinuousCapture(info) while not gl.qtest(): try: cd, id = v.GetCaptureData() except sv.error: #time.millisleep(10) # XXX is this necessary? sgi.nap(1) # XXX Try by Jack continue ids.append(id) id = id + 2*rate
0efafb39da32880543cd890590a4185b05040479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0efafb39da32880543cd890590a4185b05040479/Vrec.py
dict = {}
r=[]
def parse_qs(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument. Arguments: qs: URL-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in URL encoded queries should be treated as blank strings. A true value inicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. """ name_value_pairs = string.splitfields(qs, '&') dict = {} for name_value in name_value_pairs: nv = string.splitfields(name_value, '=') if len(nv) != 2: if strict_parsing: raise ValueError, "bad query field: %s" % `name_value` continue name = urllib.unquote(string.replace(nv[0], '+', ' ')) value = urllib.unquote(string.replace(nv[1], '+', ' ')) if len(value) or keep_blank_values: if dict.has_key (name): dict[name].append(value) else: dict[name] = [value] return dict
1946f0d6f22987b1616b0935f577e805ca494db8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1946f0d6f22987b1616b0935f577e805ca494db8/cgi.py
if len(value) or keep_blank_values: if dict.has_key (name): dict[name].append(value) else: dict[name] = [value] return dict
r.append(name, value) return r
def parse_qs(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument. Arguments: qs: URL-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in URL encoded queries should be treated as blank strings. A true value inicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. """ name_value_pairs = string.splitfields(qs, '&') dict = {} for name_value in name_value_pairs: nv = string.splitfields(name_value, '=') if len(nv) != 2: if strict_parsing: raise ValueError, "bad query field: %s" % `name_value` continue name = urllib.unquote(string.replace(nv[0], '+', ' ')) value = urllib.unquote(string.replace(nv[1], '+', ' ')) if len(value) or keep_blank_values: if dict.has_key (name): dict[name].append(value) else: dict[name] = [value] return dict
1946f0d6f22987b1616b0935f577e805ca494db8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1946f0d6f22987b1616b0935f577e805ca494db8/cgi.py
dict = parse_qs(qs, self.keep_blank_values, self.strict_parsing) self.list = [] for key, valuelist in dict.items(): for value in valuelist: self.list.append(MiniFieldStorage(key, value))
self.list = list = [] for key, value in parse_qsl(qs, self.keep_blank_values, self.strict_parsing): list.append(MiniFieldStorage(key, value))
def read_urlencoded(self): """Internal: read data in query string format.""" qs = self.fp.read(self.length) dict = parse_qs(qs, self.keep_blank_values, self.strict_parsing) self.list = [] for key, valuelist in dict.items(): for value in valuelist: self.list.append(MiniFieldStorage(key, value)) self.skip_lines()
1946f0d6f22987b1616b0935f577e805ca494db8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1946f0d6f22987b1616b0935f577e805ca494db8/cgi.py
elif _isfunction(v) or _isclass(v):
elif _isfunction(v) or _isclass(v) or _ismethod(v):
def run__test__(self, d, name): """d, name -> Treat dict d like module.__test__.
5f8b0b1fd4801b4808223077643c24d41130b81e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5f8b0b1fd4801b4808223077643c24d41130b81e/doctest.py
"dict must be strings, functions "
"dict must be strings, functions, methods, "
def run__test__(self, d, name): """d, name -> Treat dict d like module.__test__.
5f8b0b1fd4801b4808223077643c24d41130b81e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5f8b0b1fd4801b4808223077643c24d41130b81e/doctest.py
if verbose: print "compiling string with syntax error"
def test_complex_args(self):
exec 'def f(a, a): pass'
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
try: compile("1+*3", "filename", "exec") except SyntaxError, detail: if not detail.filename == "filename": raise TestFailed, "expected 'filename', got %r" % detail.filename
def comp_args((a, b)): return a,b self.assertEqual(comp_args((1, 2)), (1, 2))
exec 'def f(a, a): pass'
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
try: exec 'def f(a = 0, a = 1): pass' raise TestFailed, "duplicate keyword arguments" except SyntaxError: pass
def comp_args((a, b)=(3, 4)): return a, b self.assertEqual(comp_args((1, 2)), (1, 2)) self.assertEqual(comp_args(), (3, 4))
exec 'def f(a, a): pass'
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
try: exec 'def f(a): global a; a = 1' raise TestFailed, "variable is global and local" except SyntaxError: pass
def comp_args(a, (b, c)): return a, b, c self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3))
exec 'def f(a = 0, a = 1): pass'
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
if verbose: print "testing complex args"
def comp_args(a=2, (b, c)=(3, 4)): return a, b, c self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3)) self.assertEqual(comp_args(), (2, 3, 4))
exec 'def f(a): global a; a = 1'
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
def comp_args((a, b)): print a,b
def test_argument_order(self): try: exec 'def f(a=1, (b, c)): pass' self.fail("non-default args after default") except SyntaxError: pass
def comp_args((a, b)): print a,b
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
comp_args((1, 2))
def test_float_literals(self): self.assertRaises(SyntaxError, eval, "2e") self.assertRaises(SyntaxError, eval, "2.0e+") self.assertRaises(SyntaxError, eval, "1e-") self.assertRaises(SyntaxError, eval, "3-4e/21")
def comp_args((a, b)): print a,b
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
def comp_args((a, b)=(3, 4)): print a, b comp_args((1, 2)) comp_args() def comp_args(a, (b, c)): print a, b, c comp_args(1, (2, 3)) def comp_args(a=2, (b, c)=(3, 4)): print a, b, c comp_args(1, (2, 3)) comp_args() try: exec 'def f(a=1, (b, c)): pass' raise TestFailed, "non-default args after default" except SyntaxError: pass if verbose: print "testing bad float literals" def expect_error(s): try: eval(s) raise TestFailed("%r accepted" % s) except SyntaxError: pass expect_error("2e") expect_error("2.0e+") expect_error("1e-") expect_error("3-4e/21") if verbose: print "testing compile() of indented block w/o trailing newline" s = """
def test_indentation(self): s = """
def comp_args((a, b)=(3, 4)): print a, b
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
compile(s, "<string>", "exec")
compile(s, "<string>", "exec") def test_literals_with_leading_zeroes(self): for arg in ["077787", "0xj", "0x.", "0e", "090000000000000", "080000000000000", "000000000000009", "000000000000008"]: self.assertRaises(SyntaxError, eval, arg) self.assertEqual(eval("0777"), 511) self.assertEqual(eval("0777L"), 511) self.assertEqual(eval("000777"), 511) self.assertEqual(eval("0xff"), 255) self.assertEqual(eval("0xffL"), 255) self.assertEqual(eval("0XfF"), 255) self.assertEqual(eval("0777."), 777) self.assertEqual(eval("0777.0"), 777) self.assertEqual(eval("000000000000000000000000000000000000000000000000000777e0"), 777) self.assertEqual(eval("0777e1"), 7770) self.assertEqual(eval("0e0"), 0) self.assertEqual(eval("0000E-012"), 0) self.assertEqual(eval("09.5"), 9.5) self.assertEqual(eval("0777j"), 777j) self.assertEqual(eval("00j"), 0j) self.assertEqual(eval("00.0"), 0) self.assertEqual(eval("0e3"), 0) self.assertEqual(eval("090000000000000."), 90000000000000.) self.assertEqual(eval("090000000000000.0000000000000000000000"), 90000000000000.) self.assertEqual(eval("090000000000000e0"), 90000000000000.) self.assertEqual(eval("090000000000000e-0"), 90000000000000.) self.assertEqual(eval("090000000000000j"), 90000000000000j) self.assertEqual(eval("000000000000007"), 7) self.assertEqual(eval("000000000000008."), 8.) self.assertEqual(eval("000000000000009."), 9.) def test_unary_minus(self): warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning) warnings.filterwarnings("ignore", "hex.* of negative int", FutureWarning) all_one_bits = '0xffffffff' if sys.maxint != 2147483647: all_one_bits = '0xffffffffffffffff' self.assertEqual(eval(all_one_bits), -1) self.assertEqual(eval("-" + all_one_bits), 1) def test_sequence_unpacking_error(self): i,j = (1, -1) or (-1, 1) self.assertEqual(i, 1) self.assertEqual(j, -1)
def expect_error(s): try: eval(s) raise TestFailed("%r accepted" % s) except SyntaxError: pass
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
if verbose: print "testing literals with leading zeroes"
def test_main(): test_support.run_unittest(TestSpecifics)
def expect_error(s): try: eval(s) raise TestFailed("%r accepted" % s) except SyntaxError: pass
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
def expect_same(test_source, expected): got = eval(test_source) if got != expected: raise TestFailed("eval(%r) gave %r, but expected %r" % (test_source, got, expected)) expect_error("077787") expect_error("0xj") expect_error("0x.") expect_error("0e") expect_same("0777", 511) expect_same("0777L", 511) expect_same("000777", 511) expect_same("0xff", 255) expect_same("0xffL", 255) expect_same("0XfF", 255) expect_same("0777.", 777) expect_same("0777.0", 777) expect_same("000000000000000000000000000000000000000000000000000777e0", 777) expect_same("0777e1", 7770) expect_same("0e0", 0) expect_same("0000E-012", 0) expect_same("09.5", 9.5) expect_same("0777j", 777j) expect_same("00j", 0j) expect_same("00.0", 0) expect_same("0e3", 0) expect_same("090000000000000.", 90000000000000.) expect_same("090000000000000.0000000000000000000000", 90000000000000.) expect_same("090000000000000e0", 90000000000000.) expect_same("090000000000000e-0", 90000000000000.) expect_same("090000000000000j", 90000000000000j) expect_error("090000000000000") expect_error("080000000000000") expect_error("000000000000009") expect_error("000000000000008") expect_same("000000000000007", 7) expect_same("000000000000008.", 8.) expect_same("000000000000009.", 9.) import warnings warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning) warnings.filterwarnings("ignore", "hex.* of negative int", FutureWarning) import sys all_one_bits = '0xffffffff' if sys.maxint != 2147483647: all_one_bits = '0xffffffffffffffff' exec """ expect_same(all_one_bits, -1) expect_same("-" + all_one_bits, 1) """ i,j = (1, -1) or (-1, 1) if i != 1 or j != -1: raise TestFailed, "Sequence packing/unpacking"
if __name__ == "__main__": test_main()
def expect_same(test_source, expected): got = eval(test_source) if got != expected: raise TestFailed("eval(%r) gave %r, but expected %r" % (test_source, got, expected))
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
elif platform == 'cygwin': x11_inc = find_file('X11/Xlib.h', [], inc_dirs) if x11_inc is None: return
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module.
9181c94e05250b8f69615a96634d55afe532e406 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9181c94e05250b8f69615a96634d55afe532e406/setup.py
_StringType = type('')
_StringTypes = (str, unicode)
def rfind(s, *args): """rfind(s, sub [,start [,end]]) -> int Return the highest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. """ return s.rfind(*args)
102d1208a8dcf9a502a8720fe5642ee33520d84f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/102d1208a8dcf9a502a8720fe5642ee33520d84f/string.py
if type(x) == type(''): s = x else: s = `x` n = len(s) if n >= width: return s
if not isinstance(x, _StringTypes): x = str(x) n = len(x) if n >= width: return x
def zfill(x, width): """zfill(x, width) -> string Pad a numeric string x with zeros on the left, to fill a field of the specified width. The string x is never truncated. """ if type(x) == type(''): s = x else: s = `x` n = len(s) if n >= width: return s sign = '' if s[0] in ('-', '+'): sign, s = s[0], s[1:] return sign + '0'*(width-n) + s
102d1208a8dcf9a502a8720fe5642ee33520d84f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/102d1208a8dcf9a502a8720fe5642ee33520d84f/string.py
if s[0] in ('-', '+'): sign, s = s[0], s[1:] return sign + '0'*(width-n) + s
if x[0] in '-+': sign, x = x[0], x[1:] return sign + '0'*(width-n) + x
def zfill(x, width): """zfill(x, width) -> string Pad a numeric string x with zeros on the left, to fill a field of the specified width. The string x is never truncated. """ if type(x) == type(''): s = x else: s = `x` n = len(s) if n >= width: return s sign = '' if s[0] in ('-', '+'): sign, s = s[0], s[1:] return sign + '0'*(width-n) + s
102d1208a8dcf9a502a8720fe5642ee33520d84f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/102d1208a8dcf9a502a8720fe5642ee33520d84f/string.py
global DEBUG DEBUG=1
def main(): global DEBUG DEBUG=1 # Find the template # (there's no point in proceeding if we can't find it) template = findtemplate() if DEBUG: print 'Using template', template # Ask for source text if not specified in sys.argv[1:] if not sys.argv[1:]: srcfss, ok = macfs.PromptGetFile('Select Python source file:', 'TEXT') if not ok: return filename = srcfss.as_pathname() tp, tf = os.path.split(filename) if tf[-3:] == '.py': tf = tf[:-3] else: tf = tf + '.applet' dstfss, ok = macfs.StandardPutFile('Save application as:', tf) if not ok: return process(template, filename, dstfss.as_pathname()) else: # Loop over all files to be processed for filename in sys.argv[1:]: process(template, filename, '')
f428c9e3173b18eb5bf019769064be196e77914e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f428c9e3173b18eb5bf019769064be196e77914e/BuildApplet.py
directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout."""
directory already exists (or if 'name' is the empty string, which means the current directory, which of course exists), then do nothing. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout. Return the list of directories actually created."""
def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout.""" global PATH_CREATED # XXX what's the better way to handle verbosity? print as we create # each directory in the path (the current behaviour), or only announce # the creation of the whole path? (quite easy to do the latter since # we're not using a recursive algorithm) name = os.path.normpath (name) created_dirs = [] if os.path.isdir (name) or name == '': return created_dirs if PATH_CREATED.get (name): return created_dirs (head, tail) = os.path.split (name) tails = [tail] # stack of lone dirs to create while head and tail and not os.path.isdir (head): #print "splitting '%s': " % head, (head, tail) = os.path.split (head) #print "to ('%s','%s')" % (head, tail) tails.insert (0, tail) # push next higher dir onto stack #print "stack of tails:", tails # now 'head' contains the deepest directory that already exists # (that is, the child of 'head' in 'name' is the highest directory # that does *not* exist) for d in tails: #print "head = %s, d = %s: " % (head, d), head = os.path.join (head, d) if PATH_CREATED.get (head): continue if verbose: print "creating", head if not dry_run: try: os.mkdir (head) created_dirs.append(head) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not create '%s': %s" % (head, errstr) PATH_CREATED[head] = 1 return created_dirs
739d06689dfd37e9233599c3fd95852bb96f71a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/739d06689dfd37e9233599c3fd95852bb96f71a1/util.py
except os.error, (errno, errstr):
except OSError, exc:
def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout.""" global PATH_CREATED # XXX what's the better way to handle verbosity? print as we create # each directory in the path (the current behaviour), or only announce # the creation of the whole path? (quite easy to do the latter since # we're not using a recursive algorithm) name = os.path.normpath (name) created_dirs = [] if os.path.isdir (name) or name == '': return created_dirs if PATH_CREATED.get (name): return created_dirs (head, tail) = os.path.split (name) tails = [tail] # stack of lone dirs to create while head and tail and not os.path.isdir (head): #print "splitting '%s': " % head, (head, tail) = os.path.split (head) #print "to ('%s','%s')" % (head, tail) tails.insert (0, tail) # push next higher dir onto stack #print "stack of tails:", tails # now 'head' contains the deepest directory that already exists # (that is, the child of 'head' in 'name' is the highest directory # that does *not* exist) for d in tails: #print "head = %s, d = %s: " % (head, d), head = os.path.join (head, d) if PATH_CREATED.get (head): continue if verbose: print "creating", head if not dry_run: try: os.mkdir (head) created_dirs.append(head) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not create '%s': %s" % (head, errstr) PATH_CREATED[head] = 1 return created_dirs
739d06689dfd37e9233599c3fd95852bb96f71a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/739d06689dfd37e9233599c3fd95852bb96f71a1/util.py
"could not create '%s': %s" % (head, errstr)
"could not create '%s': %s" % (head, exc[-1])
def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout.""" global PATH_CREATED # XXX what's the better way to handle verbosity? print as we create # each directory in the path (the current behaviour), or only announce # the creation of the whole path? (quite easy to do the latter since # we're not using a recursive algorithm) name = os.path.normpath (name) created_dirs = [] if os.path.isdir (name) or name == '': return created_dirs if PATH_CREATED.get (name): return created_dirs (head, tail) = os.path.split (name) tails = [tail] # stack of lone dirs to create while head and tail and not os.path.isdir (head): #print "splitting '%s': " % head, (head, tail) = os.path.split (head) #print "to ('%s','%s')" % (head, tail) tails.insert (0, tail) # push next higher dir onto stack #print "stack of tails:", tails # now 'head' contains the deepest directory that already exists # (that is, the child of 'head' in 'name' is the highest directory # that does *not* exist) for d in tails: #print "head = %s, d = %s: " % (head, d), head = os.path.join (head, d) if PATH_CREATED.get (head): continue if verbose: print "creating", head if not dry_run: try: os.mkdir (head) created_dirs.append(head) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not create '%s': %s" % (head, errstr) PATH_CREATED[head] = 1 return created_dirs
739d06689dfd37e9233599c3fd95852bb96f71a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/739d06689dfd37e9233599c3fd95852bb96f71a1/util.py
def __init__(self, filename=None, mode=None,
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
if not size:
readsize = 1024 if not size:
def read(self,size=None):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
self._read()
self._read(readsize) readsize = readsize * 2
def read(self,size=None):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
else:
else:
def read(self,size=None):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
self._read()
self._read(readsize) readsize = readsize * 2
def read(self,size=None):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
def _read(self): buf = self.fileobj.read(1024)
def _unread(self, buf): self.extrabuf = buf + self.extrabuf self.extrasize = len(buf) + self.extrasize def _read(self, size=1024): try: buf = self.fileobj.read(size) except AttributeError: raise EOFError, "Reached EOF"
def _read(self):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
line=""
bufs = [] readsize = 100
def readline(self):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
c = self.read(1) line = line + c if c=='\n' or c=="": break return line
c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2
def readline(self):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
L=[] line = self.readline() while line!="": L.append(line) line = self.readline() return L
buf = self.read() return string.split(buf, '\n')
def readlines(self):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
This is the normal interface: it return a stripped
This is the normal interface: it returns a stripped
def getheader(self, name, default=None): """Get the header value for a name. This is the normal interface: it return a stripped version of the header value for a given header name, or None if it doesn't exist. This uses the dictionary version which finds the *last* such header. """ try: return self.dict[string.lower(name)] except KeyError: return default
ddf22c4243c38e819a07cbad53b8711c08e5563f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ddf22c4243c38e819a07cbad53b8711c08e5563f/rfc822.py
l.append (fd, flags)
l.append ((fd, flags))
def poll2 (timeout=0.0): import poll # timeout is in milliseconds timeout = int(timeout*1000) if socket_map: fd_map = {} for s in socket_map.keys(): fd_map[s.fileno()] = s l = [] for fd, s in fd_map.items(): flags = 0 if s.readable(): flags = poll.POLLIN if s.writable(): flags = flags | poll.POLLOUT if flags: l.append (fd, flags) r = poll.poll (l, timeout) for fd, flags in r: s = fd_map[fd] try: if (flags & poll.POLLIN): s.handle_read_event() if (flags & poll.POLLOUT): s.handle_write_event() if (flags & poll.POLLERR): s.handle_expt_event() except: s.handle_error()
2341794667e5420782fb92a2d3258ade862265eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2341794667e5420782fb92a2d3258ade862265eb/asyncore.py
tbinfo.append (
tbinfo.append ((
def compact_traceback (): t,v,tb = sys.exc_info() tbinfo = [] while 1: tbinfo.append ( tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_name, str(tb.tb_lineno) ) tb = tb.tb_next if not tb: break # just to be safe del tb file, function, line = tbinfo[-1] info = '[' + string.join ( map ( lambda x: string.join (x, '|'), tbinfo ), '] [' ) + ']' return (file, function, line), t, v, info
2341794667e5420782fb92a2d3258ade862265eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2341794667e5420782fb92a2d3258ade862265eb/asyncore.py
tb.tb_frame.f_code.co_name,
tb.tb_frame.f_code.co_name,
def compact_traceback (): t,v,tb = sys.exc_info() tbinfo = [] while 1: tbinfo.append ( tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_name, str(tb.tb_lineno) ) tb = tb.tb_next if not tb: break # just to be safe del tb file, function, line = tbinfo[-1] info = '[' + string.join ( map ( lambda x: string.join (x, '|'), tbinfo ), '] [' ) + ']' return (file, function, line), t, v, info
2341794667e5420782fb92a2d3258ade862265eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2341794667e5420782fb92a2d3258ade862265eb/asyncore.py
)
))
def compact_traceback (): t,v,tb = sys.exc_info() tbinfo = [] while 1: tbinfo.append ( tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_name, str(tb.tb_lineno) ) tb = tb.tb_next if not tb: break # just to be safe del tb file, function, line = tbinfo[-1] info = '[' + string.join ( map ( lambda x: string.join (x, '|'), tbinfo ), '] [' ) + ']' return (file, function, line), t, v, info
2341794667e5420782fb92a2d3258ade862265eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2341794667e5420782fb92a2d3258ade862265eb/asyncore.py
self.tabCols=IntVar(self)
def CreatePageFontTab(self): #tkVars self.fontSize=StringVar(self) self.fontBold=BooleanVar(self) self.fontName=StringVar(self) self.spaceNum=IntVar(self) self.tabCols=IntVar(self) self.indentBySpaces=BooleanVar(self) self.editFont=tkFont.Font(self,('courier',12,'normal')) ##widget creation #body frame frame=self.tabPages.pages['Fonts/Tabs']['page'] #body section frames frameFont=Frame(frame,borderwidth=2,relief=GROOVE) frameIndent=Frame(frame,borderwidth=2,relief=GROOVE) #frameFont labelFontTitle=Label(frameFont,text='Set Base Editor Font') frameFontName=Frame(frameFont) frameFontParam=Frame(frameFont) labelFontNameTitle=Label(frameFontName,justify=LEFT, text='Font :') self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE, exportselection=FALSE) self.listFontName.bind('<ButtonRelease-1>',self.OnListFontButtonRelease) scrollFont=Scrollbar(frameFontName) scrollFont.config(command=self.listFontName.yview) self.listFontName.config(yscrollcommand=scrollFont.set) labelFontSizeTitle=Label(frameFontParam,text='Size :') self.optMenuFontSize=DynOptionMenu(frameFontParam,self.fontSize,None, command=self.SetFontSample) checkFontBold=Checkbutton(frameFontParam,variable=self.fontBold, onvalue=1,offvalue=0,text='Bold',command=self.SetFontSample) frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1) self.labelFontSample=Label(frameFontSample, text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]', justify=LEFT,font=self.editFont) #frameIndent labelIndentTitle=Label(frameIndent,text='Set Indentation Defaults') frameIndentType=Frame(frameIndent) frameIndentSize=Frame(frameIndent) labelIndentTypeTitle=Label(frameIndentType, text='Choose indentation type :') radioUseSpaces=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=1,text='Tab key inserts spaces') radioUseTabs=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=0,text='Tab key inserts tabs') labelIndentSizeTitle=Label(frameIndentSize, text='Choose indentation size :') labelSpaceNumTitle=Label(frameIndentSize,justify=LEFT, text='when tab key inserts spaces,\nspaces per indent') self.scaleSpaceNum=Scale(frameIndentSize,variable=self.spaceNum, orient='horizontal',tickinterval=2,from_=2,to=8) #labeltabColsTitle=Label(frameIndentSize,justify=LEFT, # text='when tab key inserts tabs,\ncolumns per tab') #self.scaleTabCols=Scale(frameIndentSize,variable=self.tabCols, # orient='horizontal',tickinterval=2,from_=2,to=8) #widget packing #body frameFont.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH) frameIndent.pack(side=LEFT,padx=5,pady=10,fill=Y) #frameFont labelFontTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameFontName.pack(side=TOP,padx=5,pady=5,fill=X) frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X) labelFontNameTitle.pack(side=TOP,anchor=W) self.listFontName.pack(side=LEFT,expand=TRUE,fill=X) scrollFont.pack(side=LEFT,fill=Y) labelFontSizeTitle.pack(side=LEFT,anchor=W) self.optMenuFontSize.pack(side=LEFT,anchor=W) checkFontBold.pack(side=LEFT,anchor=W,padx=20) frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) self.labelFontSample.pack(expand=TRUE,fill=BOTH) #frameIndent labelIndentTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameIndentType.pack(side=TOP,padx=5,fill=X) frameIndentSize.pack(side=TOP,padx=5,pady=5,fill=BOTH) labelIndentTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) radioUseSpaces.pack(side=TOP,anchor=W,padx=5) radioUseTabs.pack(side=TOP,anchor=W,padx=5) labelIndentSizeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5) self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X) #labeltabColsTitle.pack(side=TOP,anchor=W,padx=5) #self.scaleTabCols.pack(side=TOP,padx=5,fill=X) return frame
9d142adfce027096a5c80dcaf7193b510cf7f984 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d142adfce027096a5c80dcaf7193b510cf7f984/configDialog.py
orient='horizontal',tickinterval=2,from_=2,to=8)
orient='horizontal',tickinterval=2,from_=2,to=10)
def CreatePageFontTab(self): #tkVars self.fontSize=StringVar(self) self.fontBold=BooleanVar(self) self.fontName=StringVar(self) self.spaceNum=IntVar(self) self.tabCols=IntVar(self) self.indentBySpaces=BooleanVar(self) self.editFont=tkFont.Font(self,('courier',12,'normal')) ##widget creation #body frame frame=self.tabPages.pages['Fonts/Tabs']['page'] #body section frames frameFont=Frame(frame,borderwidth=2,relief=GROOVE) frameIndent=Frame(frame,borderwidth=2,relief=GROOVE) #frameFont labelFontTitle=Label(frameFont,text='Set Base Editor Font') frameFontName=Frame(frameFont) frameFontParam=Frame(frameFont) labelFontNameTitle=Label(frameFontName,justify=LEFT, text='Font :') self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE, exportselection=FALSE) self.listFontName.bind('<ButtonRelease-1>',self.OnListFontButtonRelease) scrollFont=Scrollbar(frameFontName) scrollFont.config(command=self.listFontName.yview) self.listFontName.config(yscrollcommand=scrollFont.set) labelFontSizeTitle=Label(frameFontParam,text='Size :') self.optMenuFontSize=DynOptionMenu(frameFontParam,self.fontSize,None, command=self.SetFontSample) checkFontBold=Checkbutton(frameFontParam,variable=self.fontBold, onvalue=1,offvalue=0,text='Bold',command=self.SetFontSample) frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1) self.labelFontSample=Label(frameFontSample, text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]', justify=LEFT,font=self.editFont) #frameIndent labelIndentTitle=Label(frameIndent,text='Set Indentation Defaults') frameIndentType=Frame(frameIndent) frameIndentSize=Frame(frameIndent) labelIndentTypeTitle=Label(frameIndentType, text='Choose indentation type :') radioUseSpaces=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=1,text='Tab key inserts spaces') radioUseTabs=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=0,text='Tab key inserts tabs') labelIndentSizeTitle=Label(frameIndentSize, text='Choose indentation size :') labelSpaceNumTitle=Label(frameIndentSize,justify=LEFT, text='when tab key inserts spaces,\nspaces per indent') self.scaleSpaceNum=Scale(frameIndentSize,variable=self.spaceNum, orient='horizontal',tickinterval=2,from_=2,to=8) #labeltabColsTitle=Label(frameIndentSize,justify=LEFT, # text='when tab key inserts tabs,\ncolumns per tab') #self.scaleTabCols=Scale(frameIndentSize,variable=self.tabCols, # orient='horizontal',tickinterval=2,from_=2,to=8) #widget packing #body frameFont.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH) frameIndent.pack(side=LEFT,padx=5,pady=10,fill=Y) #frameFont labelFontTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameFontName.pack(side=TOP,padx=5,pady=5,fill=X) frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X) labelFontNameTitle.pack(side=TOP,anchor=W) self.listFontName.pack(side=LEFT,expand=TRUE,fill=X) scrollFont.pack(side=LEFT,fill=Y) labelFontSizeTitle.pack(side=LEFT,anchor=W) self.optMenuFontSize.pack(side=LEFT,anchor=W) checkFontBold.pack(side=LEFT,anchor=W,padx=20) frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) self.labelFontSample.pack(expand=TRUE,fill=BOTH) #frameIndent labelIndentTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameIndentType.pack(side=TOP,padx=5,fill=X) frameIndentSize.pack(side=TOP,padx=5,pady=5,fill=BOTH) labelIndentTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) radioUseSpaces.pack(side=TOP,anchor=W,padx=5) radioUseTabs.pack(side=TOP,anchor=W,padx=5) labelIndentSizeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5) self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X) #labeltabColsTitle.pack(side=TOP,anchor=W,padx=5) #self.scaleTabCols.pack(side=TOP,padx=5,fill=X) return frame
9d142adfce027096a5c80dcaf7193b510cf7f984 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d142adfce027096a5c80dcaf7193b510cf7f984/configDialog.py
self.tabCols.trace_variable('w',self.VarChanged_tabCols)
def AttachVarCallbacks(self): self.fontSize.trace_variable('w',self.VarChanged_fontSize) self.fontName.trace_variable('w',self.VarChanged_fontName) self.fontBold.trace_variable('w',self.VarChanged_fontBold) self.spaceNum.trace_variable('w',self.VarChanged_spaceNum) self.tabCols.trace_variable('w',self.VarChanged_tabCols) self.indentBySpaces.trace_variable('w',self.VarChanged_indentBySpaces) self.colour.trace_variable('w',self.VarChanged_colour) self.builtinTheme.trace_variable('w',self.VarChanged_builtinTheme) self.customTheme.trace_variable('w',self.VarChanged_customTheme) self.themeIsBuiltin.trace_variable('w',self.VarChanged_themeIsBuiltin) self.highlightTarget.trace_variable('w',self.VarChanged_highlightTarget) self.keyBinding.trace_variable('w',self.VarChanged_keyBinding) self.builtinKeys.trace_variable('w',self.VarChanged_builtinKeys) self.customKeys.trace_variable('w',self.VarChanged_customKeys) self.keysAreBuiltin.trace_variable('w',self.VarChanged_keysAreBuiltin) self.winWidth.trace_variable('w',self.VarChanged_winWidth) self.winHeight.trace_variable('w',self.VarChanged_winHeight) self.startupEdit.trace_variable('w',self.VarChanged_startupEdit)
9d142adfce027096a5c80dcaf7193b510cf7f984 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d142adfce027096a5c80dcaf7193b510cf7f984/configDialog.py
def VarChanged_tabCols(self,*params): value=self.tabCols.get() self.AddChangedItem('main','Indent','tab-cols',value)
def VarChanged_tabCols(self,*params): value=self.tabCols.get() self.AddChangedItem('main','Indent','tab-cols',value)
9d142adfce027096a5c80dcaf7193b510cf7f984 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d142adfce027096a5c80dcaf7193b510cf7f984/configDialog.py
if sys.argv[-1] == "Release":
if sys.argv[1] == "Release":
def main(): build_all = "-a" in sys.argv if sys.argv[-1] == "Release": arch = "x86" debug = False configure = "VC-WIN32" makefile = "32.mak" elif sys.argv[-1] == "Debug": arch = "x86" debug = True configure = "VC-WIN32" makefile="d32.mak" elif sys.argv[-1] == "ReleaseItanium": arch = "ia64" debug = False configure = "VC-WIN64I" do_script = "ms\\do_win64i" makefile = "ms\\nt.mak" os.environ["VSEXTCOMP_USECL"] = "MS_ITANIUM" elif sys.argv[-1] == "ReleaseAMD64": arch="amd64" debug=False configure = "VC-WIN64A" do_script = "ms\\do_win64a" makefile = "ms\\nt.mak" os.environ["VSEXTCOMP_USECL"] = "MS_OPTERON" make_flags = "" if build_all: make_flags = "-a" # perl should be on the path, but we also look in "\perl" and "c:\\perl" # as "well known" locations perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"]) perl = find_working_perl(perls) if perl is None: sys.exit(1) print "Found a working perl at '%s'" % (perl,) # Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live. ssl_dir = find_best_ssl_dir(("../..",)) if ssl_dir is None: sys.exit(1) old_cd = os.getcwd() try: os.chdir(ssl_dir) # If the ssl makefiles do not exist, we invoke Perl to generate them. if not os.path.isfile(makefile): print "Creating the makefiles..." # Put our working Perl at the front of our path os.environ["PATH"] = os.path.split(perl)[0] + \ os.pathsep + \ os.environ["PATH"] if arch=="x86": run_32all_py() else: run_configure(configure, do_script) # Now run make. print "Executing nmake over the ssl makefiles..." rc = os.system("nmake /nologo -f "+makefile) if rc: print "Executing d32.mak failed" print rc sys.exit(rc) finally: os.chdir(old_cd) # And finally, we can build the _ssl module itself for Python. defs = "SSL_DIR=%s" % (ssl_dir,) if debug: defs = defs + " " + "DEBUG=1" rc = os.system('nmake /nologo -f _ssl.mak ' + defs + " " + make_flags) sys.exit(rc)
c7990b5b985d5619478b184acd62c49b2a4f24e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7990b5b985d5619478b184acd62c49b2a4f24e6/build_ssl.py
elif sys.argv[-1] == "Debug":
elif sys.argv[1] == "Debug":
def main(): build_all = "-a" in sys.argv if sys.argv[-1] == "Release": arch = "x86" debug = False configure = "VC-WIN32" makefile = "32.mak" elif sys.argv[-1] == "Debug": arch = "x86" debug = True configure = "VC-WIN32" makefile="d32.mak" elif sys.argv[-1] == "ReleaseItanium": arch = "ia64" debug = False configure = "VC-WIN64I" do_script = "ms\\do_win64i" makefile = "ms\\nt.mak" os.environ["VSEXTCOMP_USECL"] = "MS_ITANIUM" elif sys.argv[-1] == "ReleaseAMD64": arch="amd64" debug=False configure = "VC-WIN64A" do_script = "ms\\do_win64a" makefile = "ms\\nt.mak" os.environ["VSEXTCOMP_USECL"] = "MS_OPTERON" make_flags = "" if build_all: make_flags = "-a" # perl should be on the path, but we also look in "\perl" and "c:\\perl" # as "well known" locations perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"]) perl = find_working_perl(perls) if perl is None: sys.exit(1) print "Found a working perl at '%s'" % (perl,) # Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live. ssl_dir = find_best_ssl_dir(("../..",)) if ssl_dir is None: sys.exit(1) old_cd = os.getcwd() try: os.chdir(ssl_dir) # If the ssl makefiles do not exist, we invoke Perl to generate them. if not os.path.isfile(makefile): print "Creating the makefiles..." # Put our working Perl at the front of our path os.environ["PATH"] = os.path.split(perl)[0] + \ os.pathsep + \ os.environ["PATH"] if arch=="x86": run_32all_py() else: run_configure(configure, do_script) # Now run make. print "Executing nmake over the ssl makefiles..." rc = os.system("nmake /nologo -f "+makefile) if rc: print "Executing d32.mak failed" print rc sys.exit(rc) finally: os.chdir(old_cd) # And finally, we can build the _ssl module itself for Python. defs = "SSL_DIR=%s" % (ssl_dir,) if debug: defs = defs + " " + "DEBUG=1" rc = os.system('nmake /nologo -f _ssl.mak ' + defs + " " + make_flags) sys.exit(rc)
c7990b5b985d5619478b184acd62c49b2a4f24e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7990b5b985d5619478b184acd62c49b2a4f24e6/build_ssl.py
elif sys.argv[-1] == "ReleaseItanium":
elif sys.argv[1] == "ReleaseItanium":
def main(): build_all = "-a" in sys.argv if sys.argv[-1] == "Release": arch = "x86" debug = False configure = "VC-WIN32" makefile = "32.mak" elif sys.argv[-1] == "Debug": arch = "x86" debug = True configure = "VC-WIN32" makefile="d32.mak" elif sys.argv[-1] == "ReleaseItanium": arch = "ia64" debug = False configure = "VC-WIN64I" do_script = "ms\\do_win64i" makefile = "ms\\nt.mak" os.environ["VSEXTCOMP_USECL"] = "MS_ITANIUM" elif sys.argv[-1] == "ReleaseAMD64": arch="amd64" debug=False configure = "VC-WIN64A" do_script = "ms\\do_win64a" makefile = "ms\\nt.mak" os.environ["VSEXTCOMP_USECL"] = "MS_OPTERON" make_flags = "" if build_all: make_flags = "-a" # perl should be on the path, but we also look in "\perl" and "c:\\perl" # as "well known" locations perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"]) perl = find_working_perl(perls) if perl is None: sys.exit(1) print "Found a working perl at '%s'" % (perl,) # Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live. ssl_dir = find_best_ssl_dir(("../..",)) if ssl_dir is None: sys.exit(1) old_cd = os.getcwd() try: os.chdir(ssl_dir) # If the ssl makefiles do not exist, we invoke Perl to generate them. if not os.path.isfile(makefile): print "Creating the makefiles..." # Put our working Perl at the front of our path os.environ["PATH"] = os.path.split(perl)[0] + \ os.pathsep + \ os.environ["PATH"] if arch=="x86": run_32all_py() else: run_configure(configure, do_script) # Now run make. print "Executing nmake over the ssl makefiles..." rc = os.system("nmake /nologo -f "+makefile) if rc: print "Executing d32.mak failed" print rc sys.exit(rc) finally: os.chdir(old_cd) # And finally, we can build the _ssl module itself for Python. defs = "SSL_DIR=%s" % (ssl_dir,) if debug: defs = defs + " " + "DEBUG=1" rc = os.system('nmake /nologo -f _ssl.mak ' + defs + " " + make_flags) sys.exit(rc)
c7990b5b985d5619478b184acd62c49b2a4f24e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7990b5b985d5619478b184acd62c49b2a4f24e6/build_ssl.py
elif sys.argv[-1] == "ReleaseAMD64":
elif sys.argv[1] == "ReleaseAMD64":
def main(): build_all = "-a" in sys.argv if sys.argv[-1] == "Release": arch = "x86" debug = False configure = "VC-WIN32" makefile = "32.mak" elif sys.argv[-1] == "Debug": arch = "x86" debug = True configure = "VC-WIN32" makefile="d32.mak" elif sys.argv[-1] == "ReleaseItanium": arch = "ia64" debug = False configure = "VC-WIN64I" do_script = "ms\\do_win64i" makefile = "ms\\nt.mak" os.environ["VSEXTCOMP_USECL"] = "MS_ITANIUM" elif sys.argv[-1] == "ReleaseAMD64": arch="amd64" debug=False configure = "VC-WIN64A" do_script = "ms\\do_win64a" makefile = "ms\\nt.mak" os.environ["VSEXTCOMP_USECL"] = "MS_OPTERON" make_flags = "" if build_all: make_flags = "-a" # perl should be on the path, but we also look in "\perl" and "c:\\perl" # as "well known" locations perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"]) perl = find_working_perl(perls) if perl is None: sys.exit(1) print "Found a working perl at '%s'" % (perl,) # Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live. ssl_dir = find_best_ssl_dir(("../..",)) if ssl_dir is None: sys.exit(1) old_cd = os.getcwd() try: os.chdir(ssl_dir) # If the ssl makefiles do not exist, we invoke Perl to generate them. if not os.path.isfile(makefile): print "Creating the makefiles..." # Put our working Perl at the front of our path os.environ["PATH"] = os.path.split(perl)[0] + \ os.pathsep + \ os.environ["PATH"] if arch=="x86": run_32all_py() else: run_configure(configure, do_script) # Now run make. print "Executing nmake over the ssl makefiles..." rc = os.system("nmake /nologo -f "+makefile) if rc: print "Executing d32.mak failed" print rc sys.exit(rc) finally: os.chdir(old_cd) # And finally, we can build the _ssl module itself for Python. defs = "SSL_DIR=%s" % (ssl_dir,) if debug: defs = defs + " " + "DEBUG=1" rc = os.system('nmake /nologo -f _ssl.mak ' + defs + " " + make_flags) sys.exit(rc)
c7990b5b985d5619478b184acd62c49b2a4f24e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7990b5b985d5619478b184acd62c49b2a4f24e6/build_ssl.py
eq(int(time.mktime(timetup)), 1044470846)
t = int(time.mktime(timetup)) eq(time.localtime(t)[:6], timetup[:6])
def test_parsedate_acceptable_to_time_functions(self): eq = self.assertEqual timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800') eq(int(time.mktime(timetup)), 1044470846) eq(int(time.strftime('%Y', timetup)), 2003) timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800') eq(int(time.mktime(timetup[:9])), 1044470846) eq(int(time.strftime('%Y', timetup[:9])), 2003)
e3dd5b2c87dbab223d32fae544595cc5b54baf69 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e3dd5b2c87dbab223d32fae544595cc5b54baf69/test_email.py
eq(int(time.mktime(timetup[:9])), 1044470846)
t = int(time.mktime(timetup[:9])) eq(time.localtime(t)[:6], timetup[:6])
def test_parsedate_acceptable_to_time_functions(self): eq = self.assertEqual timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800') eq(int(time.mktime(timetup)), 1044470846) eq(int(time.strftime('%Y', timetup)), 2003) timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800') eq(int(time.mktime(timetup[:9])), 1044470846) eq(int(time.strftime('%Y', timetup[:9])), 2003)
e3dd5b2c87dbab223d32fae544595cc5b54baf69 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e3dd5b2c87dbab223d32fae544595cc5b54baf69/test_email.py
if type(f) == type(''):
if isinstance(f, basestring):
def __init__(self, f): self._i_opened_the_file = None if type(f) == type(''): f = __builtin__.open(f, 'rb') self._i_opened_the_file = f # else, assume it is an open file object already self.initfp(f)
0e67fd478f04d8634ea1e196e6ade2c4394984ee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0e67fd478f04d8634ea1e196e6ade2c4394984ee/wave.py
if type(f) == type(''):
if isinstance(f, basestring):
def __init__(self, f): self._i_opened_the_file = None if type(f) == type(''): f = __builtin__.open(f, 'wb') self._i_opened_the_file = f self.initfp(f)
0e67fd478f04d8634ea1e196e6ade2c4394984ee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0e67fd478f04d8634ea1e196e6ade2c4394984ee/wave.py
return self._qsize - self.getfilled()
return (self._qsize / self._nchannels / self._sampwidth) - self.getfilled()
def getfillable(self): return self._qsize - self.getfilled()
195e33efa29db8eb4c5350572b5c92394db0c4a0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/195e33efa29db8eb4c5350572b5c92394db0c4a0/Audio_mac.py
self._link(body, headers, include_dirs, libraries, library_dirs, lang)
src, obj, exe = self._link(body, headers, include_dirs, libraries, library_dirs, lang)
def try_run (self, body, headers=None, include_dirs=None, libraries=None, library_dirs=None, lang="c"): """Try to compile, link to an executable, and run a program built from 'body' and 'headers'. Return true on success, false otherwise. """ from distutils.ccompiler import CompileError, LinkError self._check_compiler() try: self._link(body, headers, include_dirs, libraries, library_dirs, lang) self.spawn([exe]) ok = 1 except (CompileError, LinkError, DistutilsExecError): ok = 0
246c425964ba742db85076538f14e206a90706b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/246c425964ba742db85076538f14e206a90706b8/config.py
"timzone value not set to -1")
"timezone value not set to -1")
def test_timezone(self): # Test timezone directives. # When gmtime() is used with %Z, entire result of strftime() is empty. # Check for equal timezone names deals with bad locale info when this # occurs; first found in FreeBSD 4.4. strp_output = _strptime.strptime("UTC", "%Z") self.failUnlessEqual(strp_output.tm_isdst, 0) strp_output = _strptime.strptime("GMT", "%Z") self.failUnlessEqual(strp_output.tm_isdst, 0) time_tuple = time.localtime() strf_output = time.strftime("%Z") #UTC does not have a timezone strp_output = _strptime.strptime(strf_output, "%Z") locale_time = _strptime.LocaleTime() if time.tzname[0] != time.tzname[1]: self.failUnless(strp_output[8] == time_tuple[8], "timezone check failed; '%s' -> %s != %s" % (strf_output, strp_output[8], time_tuple[8])) else: self.failUnless(strp_output[8] == -1, "LocaleTime().timezone has duplicate values but " "timzone value not set to -1")
3106817c68a79c5e718ff61db34b7d363724ffd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3106817c68a79c5e718ff61db34b7d363724ffd5/test_strptime.py
__slots__ = ('_exp','_int','_sign') def __init__(self, value="0", context=None):
__slots__ = ('_exp','_int','_sign', '_is_special') def __new__(cls, value="0", context=None):
def setcontext(context, _local=local): """Set this thread's context to context.""" if context in (DefaultContext, BasicContext, ExtendedContext): context = context.copy() context.clear_flags() _local.__decimal_context__ = context
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext()
self = object.__new__(cls) self._is_special = False if isinstance(value, _WorkRep): if value.sign == 1: self._sign = 0 else: self._sign = 1 self._int = tuple(map(int, str(value.int))) self._exp = int(value.exp) return self if isinstance(value, Decimal): self._exp = value._exp self._sign = value._sign self._int = value._int self._is_special = value._is_special return self
def __init__(self, value="0", context=None): """Create a decimal point instance.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
value = str(value) if isinstance(value, basestring): if _isinfinity(value): self._exp = 'F' self._int = (0,) sign = _isinfinity(value) if sign == 1: self._sign = 0 else: self._sign = 1 return if _isnan(value): sig, sign, diag = _isnan(value) if len(diag) > context.prec: self._sign, self._int, self._exp = \ context._raise_error(ConversionSyntax) return if sig == 1: self._exp = 'n' else: self._exp = 'N' self._sign = sign self._int = tuple(map(int, diag)) return try: self._sign, self._int, self._exp = _string2exact(value) except ValueError: self._sign, self._int, self._exp = context._raise_error(ConversionSyntax) return
if value >= 0: self._sign = 0 else: self._sign = 1 self._exp = 0 self._int = tuple(map(int, str(abs(value)))) return self
def __init__(self, value="0", context=None): """Create a decimal point instance.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
return if isinstance(value, _WorkRep): if value.sign == 1: self._sign = 0 else: self._sign = 1 self._int = tuple(value.int) self._exp = int(value.exp) return if isinstance(value, Decimal): self._exp = value._exp self._sign = value._sign self._int = value._int return
return self
def __init__(self, value="0", context=None): """Create a decimal point instance.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
raise TypeError("Cannot convert %r" % value) def _convert_other(self, other): """Convert other to Decimal. Verifies that it's ok to use in an implicit construction. """ if isinstance(other, Decimal): return other if isinstance(other, (int, long)): other = Decimal(other) return other raise TypeError, "You can interact Decimal only with int, long or Decimal data types."
if context is None: context = getcontext() if isinstance(value, basestring): if _isinfinity(value): self._exp = 'F' self._int = (0,) self._is_special = True if _isinfinity(value) == 1: self._sign = 0 else: self._sign = 1 return self if _isnan(value): sig, sign, diag = _isnan(value) self._is_special = True if len(diag) > context.prec: self._sign, self._int, self._exp = \ context._raise_error(ConversionSyntax) return self if sig == 1: self._exp = 'n' else: self._exp = 'N' self._sign = sign self._int = tuple(map(int, diag)) return self try: self._sign, self._int, self._exp = _string2exact(value) except ValueError: self._is_special = True self._sign, self._int, self._exp = context._raise_error(ConversionSyntax) return self raise TypeError("Cannot convert %r to Decimal" % value)
def __init__(self, value="0", context=None): """Create a decimal point instance.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if self._exp == 'n': return 1 elif self._exp == 'N': return 2
if self._is_special: exp = self._exp if exp == 'n': return 1 elif exp == 'N': return 2
def _isnan(self): """Returns whether the number is not actually one.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext() if self._isnan() == 2: return context._raise_error(InvalidOperation, 'sNaN', 1, self) if other is not None and other._isnan() == 2: return context._raise_error(InvalidOperation, 'sNaN', 1, other) if self._isnan(): return self if other is not None and other._isnan():
self_is_nan = self._isnan() if other is None: other_is_nan = False else: other_is_nan = other._isnan() if self_is_nan or other_is_nan: if context is None: context = getcontext() if self_is_nan == 2: return context._raise_error(InvalidOperation, 'sNaN', 1, self) if other_is_nan == 2: return context._raise_error(InvalidOperation, 'sNaN', 1, other) if self_is_nan: return self
def _check_nans(self, other = None, context=None): """Returns whether the number is not actually one.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if isinstance(self._exp, str):
if self._is_special:
def __nonzero__(self): """Is the number non-zero?
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
return self._int != (0,)*len(self._int)
return sum(self._int) != 0
def __nonzero__(self): """Is the number non-zero?
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext() other = self._convert_other(other) ans = self._check_nans(other, context) if ans: return 1
other = _convert_other(other) if self._is_special or other._is_special: ans = self._check_nans(other, context) if ans: return 1 return cmp(self._isinfinity(), other._isinfinity())
def __cmp__(self, other, context=None): if context is None: context = getcontext() other = self._convert_other(other)
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if self._isinfinity() and other._isinfinity(): return 0 if self._isinfinity(): return (-1)**self._sign if other._isinfinity(): return -((-1)**other._sign) if self.adjusted() == other.adjusted() and \
self_adjusted = self.adjusted() other_adjusted = other.adjusted() if self_adjusted == other_adjusted and \
def __cmp__(self, other, context=None): if context is None: context = getcontext() other = self._convert_other(other)
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
elif self.adjusted() > other.adjusted() and self._int[0] != 0:
elif self_adjusted > other_adjusted and self._int[0] != 0:
def __cmp__(self, other, context=None): if context is None: context = getcontext() other = self._convert_other(other)
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
elif self.adjusted < other.adjusted() and other._int[0] != 0:
elif self_adjusted < other_adjusted and other._int[0] != 0:
def __cmp__(self, other, context=None): if context is None: context = getcontext() other = self._convert_other(other)
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext() other = self._convert_other(other)
other = _convert_other(other)
def compare(self, other, context=None): """Compares one to another.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
ans = self._check_nans(other, context) if ans: return ans
if (self._is_special or other and other._is_special): ans = self._check_nans(other, context) if ans: return ans
def compare(self, other, context=None): """Compares one to another.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext()
def to_eng_string(self, context=None): """Convert to engineering-type string.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext() ans = self._check_nans(context=context) if ans: return ans
if self._is_special: ans = self._check_nans(context=context) if ans: return ans
def __neg__(self, context=None): """Returns a copy with the sign switched.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext() ans = self._check_nans(context=context) if ans: return ans
if self._is_special: ans = self._check_nans(context=context) if ans: return ans
def __pos__(self, context=None): """Returns a copy, unless it is a sNaN.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py