rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
node = self.document.createElement(tagName) for attr in attrs.keys():
node = self.document.createElement(name) for (attr, value) in attrs.items():
def startElement(self, name, tagName, attrs): if not hasattr(self, "curNode"): # FIXME: hack! self.startDocument()
2000138a82287e905603626bfdaf81af44e0fcd8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2000138a82287e905603626bfdaf81af44e0fcd8/pulldom.py
def startElement(self, name, tagName, attrs): if not hasattr(self, "curNode"): # FIXME: hack! self.startDocument()
2000138a82287e905603626bfdaf81af44e0fcd8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2000138a82287e905603626bfdaf81af44e0fcd8/pulldom.py
def endElement(self, name, tagName):
def endElement(self, name):
def endElement(self, name, tagName): node = self.curNode self.lastEvent[1] = [(END_ELEMENT, node), None] self.lastEvent = self.lastEvent[1] #self.events.append((END_ELEMENT, node)) self.curNode = node.parentNode
2000138a82287e905603626bfdaf81af44e0fcd8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2000138a82287e905603626bfdaf81af44e0fcd8/pulldom.py
for meth in get_methods(handler):
for meth in dir(handler):
def add_handler(self, handler): added = 0 for meth in get_methods(handler): if meth[-5:] == '_open': protocol = meth[:-5] if self.handle_open.has_key(protocol): self.handle_open[protocol].append(handler) else: self.handle_open[protocol] = [handler] added = 1 continue i = meth.find('_') j = meth[i+1:].find('_') + i + 1 if j != -1 and meth[i+1:j] == 'error': proto = meth[:i] kind = meth[j+1:] try: kind = int(kind) except ValueError: pass dict = self.handle_error.get(proto, {}) if dict.has_key(kind): dict[kind].append(handler) else: dict[kind] = [handler] self.handle_error[proto] = dict added = 1 continue if added: self.handlers.append(handler) handler.add_parent(self)
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
if isinstance(fullurl, types.StringType):
if isinstance(fullurl, (types.StringType, types.UnicodeType)):
def open(self, fullurl, data=None): # accept a URL or a Request object if isinstance(fullurl, types.StringType): req = Request(fullurl, data) else: req = fullurl if data is not None: req.add_data(data) assert isinstance(req, Request) # really only care about interface
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
def is_callable(obj): if type(obj) in (types.BuiltinFunctionType, types.BuiltinMethodType, types.LambdaType, types.MethodType): return 1 if isinstance(obj, types.InstanceType): return hasattr(obj, '__call__') return 0 def get_methods(inst): methods = {} classes = [] classes.append(inst.__class__) while classes: klass = classes[0] del classes[0] classes = classes + list(klass.__bases__) for name in dir(klass): attr = getattr(klass, name) if isinstance(attr, types.UnboundMethodType): methods[name] = 1 for name in dir(inst): if is_callable(getattr(inst, name)): methods[name] = 1 return methods.keys()
def error(self, proto, *args): if proto in ['http', 'https']: # XXX http[s] protocols are special cased dict = self.handle_error['http'] # https is not different then http proto = args[2] # YUCK! meth_name = 'http_error_%d' % proto http_err = 1 orig_args = args else: dict = self.handle_error meth_name = proto + '_error' http_err = 0 args = (dict, proto, meth_name) + args result = self._call_chain(*args) if result: return result
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
if isinstance(check, types.ClassType):
if inspect.isclass(check):
def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP and FTP. If there is a ProxyHandler, it must be at the front of the list of handlers. (Yuck.) If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used. """ opener = OpenerDirector() default_classes = [ProxyHandler, UnknownHandler, HTTPHandler, HTTPDefaultErrorHandler, HTTPRedirectHandler, FTPHandler, FileHandler] if hasattr(httplib, 'HTTPS'): default_classes.append(HTTPSHandler) skip = [] for klass in default_classes: for check in handlers: if isinstance(check, types.ClassType): if issubclass(check, klass): skip.append(klass) elif isinstance(check, types.InstanceType): if isinstance(check, klass): skip.append(klass) for klass in skip: default_classes.remove(klass) for klass in default_classes: opener.add_handler(klass()) for h in handlers: if isinstance(h, types.ClassType): h = h() opener.add_handler(h) return opener
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
elif isinstance(check, types.InstanceType): if isinstance(check, klass): skip.append(klass)
elif isinstance(check, klass): skip.append(klass)
def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP and FTP. If there is a ProxyHandler, it must be at the front of the list of handlers. (Yuck.) If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used. """ opener = OpenerDirector() default_classes = [ProxyHandler, UnknownHandler, HTTPHandler, HTTPDefaultErrorHandler, HTTPRedirectHandler, FTPHandler, FileHandler] if hasattr(httplib, 'HTTPS'): default_classes.append(HTTPSHandler) skip = [] for klass in default_classes: for check in handlers: if isinstance(check, types.ClassType): if issubclass(check, klass): skip.append(klass) elif isinstance(check, types.InstanceType): if isinstance(check, klass): skip.append(klass) for klass in skip: default_classes.remove(klass) for klass in default_classes: opener.add_handler(klass()) for h in handlers: if isinstance(h, types.ClassType): h = h() opener.add_handler(h) return opener
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
if isinstance(h, types.ClassType):
if inspect.isclass(h):
def build_opener(*handlers): """Create an opener object from a list of handlers. The opener will use several default handlers, including support for HTTP and FTP. If there is a ProxyHandler, it must be at the front of the list of handlers. (Yuck.) If any of the handlers passed as arguments are subclasses of the default handlers, the default handlers will not be used. """ opener = OpenerDirector() default_classes = [ProxyHandler, UnknownHandler, HTTPHandler, HTTPDefaultErrorHandler, HTTPRedirectHandler, FTPHandler, FileHandler] if hasattr(httplib, 'HTTPS'): default_classes.append(HTTPSHandler) skip = [] for klass in default_classes: for check in handlers: if isinstance(check, types.ClassType): if issubclass(check, klass): skip.append(klass) elif isinstance(check, types.InstanceType): if isinstance(check, klass): skip.append(klass) for klass in skip: default_classes.remove(klass) for klass in default_classes: opener.add_handler(klass()) for h in handlers: if isinstance(h, types.ClassType): h = h() opener.add_handler(h) return opener
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
if isinstance(uri, types.StringType):
if isinstance(uri, (types.StringType, types.UnicodeType)):
def add_password(self, realm, uri, user, passwd): # uri could be a single URI or a sequence if isinstance(uri, types.StringType): uri = [uri] uri = tuple(map(self.reduce_uri, uri)) if not self.passwd.has_key(realm): self.passwd[realm] = {} self.passwd[realm][uri] = (user, passwd)
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
if isinstance(ph, types.ClassType):
if inspect.isclass(ph):
def build_opener(self): opener = OpenerDirector() for ph in self.proxy_handlers: if isinstance(ph, types.ClassType): ph = ph() opener.add_handler(ph)
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
'ftp://www.python.org/pub/tmp/httplib.py', 'ftp://www.python.org/pub/tmp/imageop.c',
'ftp://www.python.org/pub/python/misc/sousa.au',
def build_opener(self): opener = OpenerDirector() for ph in self.proxy_handlers: if isinstance(ph, types.ClassType): ph = ph() opener.add_handler(ph)
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
('http://grail.cnri.reston.va.us/cgi-bin/faqw.py',
('http://www.python.org/cgi-bin/faqw.py',
def build_opener(self): opener = OpenerDirector() for ph in self.proxy_handlers: if isinstance(ph, types.ClassType): ph = ph() opener.add_handler(ph)
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
'ftp://prep.ai.mit.edu/welcome.msg', 'ftp://www.python.org/pub/tmp/figure.prn', 'ftp://www.python.org/pub/tmp/interp.pl', 'http://checkproxy.cnri.reston.va.us/test/test.html',
'ftp://gatekeeper.research.compaq.com/pub/DEC/SRC/research-reports/00README-Legal-Rules-Regs',
def build_opener(self): opener = OpenerDirector() for ph in self.proxy_handlers: if isinstance(ph, types.ClassType): ph = ph() opener.add_handler(ph)
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
if localhost is not None: urls = urls + [ 'file://%s/etc/passwd' % localhost, 'http://%s/simple/' % localhost, 'http://%s/digest/' % localhost, 'http://%s/not/found.h' % localhost, ] bauth = HTTPBasicAuthHandler() bauth.add_password('basic_test_realm', localhost, 'jhylton', 'password') dauth = HTTPDigestAuthHandler() dauth.add_password('digest_test_realm', localhost, 'jhylton', 'password')
def build_opener(self): opener = OpenerDirector() for ph in self.proxy_handlers: if isinstance(ph, types.ClassType): ph = ph() opener.add_handler(ph)
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
def at_cnri(req): host = req.get_host() print host if host[-18:] == '.cnri.reston.va.us': return 1 p = CustomProxy('http', at_cnri, 'proxy.cnri.reston.va.us') ph = CustomProxyHandler(p)
install_opener(build_opener(cfh, GopherHandler))
def build_opener(self): opener = OpenerDirector() for ph in self.proxy_handlers: if isinstance(ph, types.ClassType): ph = ph() opener.add_handler(ph)
29c9255ef1aa5548e844d7bb72d92c9eba5f1df2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/29c9255ef1aa5548e844d7bb72d92c9eba5f1df2/urllib2.py
self.assertRaises( RuntimeError, winsound.PlaySound, 'SystemQuestion', winsound.SND_ALIAS | winsound.SND_NOSTOP )
try: winsound.PlaySound( 'SystemQuestion', winsound.SND_ALIAS | winsound.SND_NOSTOP ) except RuntimeError: pass else: pass
def test_stopasync(self): winsound.PlaySound( 'SystemQuestion', winsound.SND_ALIAS | winsound.SND_ASYNC | winsound.SND_LOOP ) time.sleep(0.5) self.assertRaises( RuntimeError, winsound.PlaySound, 'SystemQuestion', winsound.SND_ALIAS | winsound.SND_NOSTOP ) winsound.PlaySound(None, winsound.SND_PURGE)
cfeb7791cb5a5c431a98503ea1149cdd483b1462 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cfeb7791cb5a5c431a98503ea1149cdd483b1462/test_winsound.py
def TemporaryFile(mode='w+b', bufsize=-1, suffix=""): """Create and return a temporary file (opened read-write by default).""" name = mktemp(suffix) if os.name == 'posix': # Unix -- be very careful fd = os.open(name, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0700) try: os.unlink(name) return os.fdopen(fd, mode, bufsize) except: os.close(fd) raise else: # Non-unix -- can't unlink file that's still open, use wrapper file = open(name, mode, bufsize) return TemporaryFileWrapper(file, name)
8deff29201b1a3b5dd2363794bc76347a5b52a16 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8deff29201b1a3b5dd2363794bc76347a5b52a16/tempfile.py
def handler1(): print "handler1"
One public function, register, is defined. """
def handler1(): print "handler1"
901b47b8cf3162cb062ae0268da0f00c375b5951 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/901b47b8cf3162cb062ae0268da0f00c375b5951/atexit.py
def handler2(*args, **kargs): print "handler2", args, kargs
_exithandlers = [] def _run_exitfuncs(): """run any registered exit functions
def handler2(*args, **kargs): print "handler2", args, kargs
901b47b8cf3162cb062ae0268da0f00c375b5951 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/901b47b8cf3162cb062ae0268da0f00c375b5951/atexit.py
_exithandlers = atexit._exithandlers atexit._exithandlers = []
_exithandlers is traversed in reverse order so functions are executed last in, first out. """ while _exithandlers: func, targs, kargs = _exithandlers[-1] apply(func, targs, kargs) _exithandlers.remove(_exithandlers[-1])
def handler2(*args, **kargs): print "handler2", args, kargs
901b47b8cf3162cb062ae0268da0f00c375b5951 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/901b47b8cf3162cb062ae0268da0f00c375b5951/atexit.py
atexit.register(handler1) atexit.register(handler2) atexit.register(handler2, 7, kw="abc")
def register(func, *targs, **kargs): """register a function to be executed upon normal program termination
def handler2(*args, **kargs): print "handler2", args, kargs
901b47b8cf3162cb062ae0268da0f00c375b5951 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/901b47b8cf3162cb062ae0268da0f00c375b5951/atexit.py
atexit._run_exitfuncs()
func - function to be called at exit targs - optional arguments to pass to func kargs - optional keyword arguments to pass to func """ _exithandlers.append((func, targs, kargs))
def handler2(*args, **kargs): print "handler2", args, kargs
901b47b8cf3162cb062ae0268da0f00c375b5951 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/901b47b8cf3162cb062ae0268da0f00c375b5951/atexit.py
atexit._exithandlers = _exithandlers
import sys try: x = sys.exitfunc except AttributeError: sys.exitfunc = _run_exitfuncs else: if x != _run_exitfuncs: register(x) del sys if __name__ == "__main__": def x1(): print "running x1" def x2(n): print "running x2(%s)" % `n` def x3(n, kwd=None): print "running x3(%s, kwd=%s)" % (`n`, `kwd`) register(x1) register(x2, 12) register(x3, 5, "bar") register(x3, "no kwd args")
def handler2(*args, **kargs): print "handler2", args, kargs
901b47b8cf3162cb062ae0268da0f00c375b5951 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/901b47b8cf3162cb062ae0268da0f00c375b5951/atexit.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
437fea7f520bb363b8562ec108a3d48494dc61e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/437fea7f520bb363b8562ec108a3d48494dc61e0/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
437fea7f520bb363b8562ec108a3d48494dc61e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/437fea7f520bb363b8562ec108a3d48494dc61e0/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
437fea7f520bb363b8562ec108a3d48494dc61e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/437fea7f520bb363b8562ec108a3d48494dc61e0/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
437fea7f520bb363b8562ec108a3d48494dc61e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/437fea7f520bb363b8562ec108a3d48494dc61e0/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
437fea7f520bb363b8562ec108a3d48494dc61e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/437fea7f520bb363b8562ec108a3d48494dc61e0/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
437fea7f520bb363b8562ec108a3d48494dc61e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/437fea7f520bb363b8562ec108a3d48494dc61e0/Vrec.py
byte_increments = [ord(c) for c in co.co_lnotab[0::2]] line_increments = [ord(c) for c in co.co_lnotab[1::2]] table_length = len(byte_increments) lineno = co.co_firstlineno table_index = 0 while (table_index < table_length and byte_increments[table_index] == 0): lineno += line_increments[table_index] table_index += 1 addr = 0 line_incr = 0
def disassemble(co, lasti=-1): """Disassemble a code object.""" code = co.co_code byte_increments = [ord(c) for c in co.co_lnotab[0::2]] line_increments = [ord(c) for c in co.co_lnotab[1::2]] table_length = len(byte_increments) # == len(line_increments) lineno = co.co_firstlineno table_index = 0 while (table_index < table_length and byte_increments[table_index] == 0): lineno += line_increments[table_index] table_index += 1 addr = 0 line_incr = 0 labels = findlabels(code) n = len(code) i = 0 extended_arg = 0 free = None while i < n: c = code[i] op = ord(c) if i >= addr: lineno += line_incr while table_index < table_length: addr += byte_increments[table_index] line_incr = line_increments[table_index] table_index += 1 if line_incr: break else: addr = sys.maxint if i > 0: print print "%3d"%lineno, else: print ' ', if i == lasti: print '-->', else: print ' ', if i in labels: print '>>', else: print ' ', print `i`.rjust(4), print opname[op].ljust(20), i = i+1 if op >= HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg extended_arg = 0 i = i+2 if op == EXTENDED_ARG: extended_arg = oparg*65536L print `oparg`.rjust(5), if op in hasconst: print '(' + `co.co_consts[oparg]` + ')', elif op in hasname: print '(' + co.co_names[oparg] + ')', elif op in hasjrel: print '(to ' + `i + oparg` + ')', elif op in haslocal: print '(' + co.co_varnames[oparg] + ')', elif op in hascompare: print '(' + cmp_op[oparg] + ')', elif op in hasfree: if free is None: free = co.co_cellvars + co.co_freevars print '(' + free[oparg] + ')', print
093fcd0de00d8a9ac895e2b96a65349d065f1026 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/093fcd0de00d8a9ac895e2b96a65349d065f1026/dis.py
if i >= addr: lineno += line_incr while table_index < table_length: addr += byte_increments[table_index] line_incr = line_increments[table_index] table_index += 1 if line_incr: break else: addr = sys.maxint
if i in linestarts:
def disassemble(co, lasti=-1): """Disassemble a code object.""" code = co.co_code byte_increments = [ord(c) for c in co.co_lnotab[0::2]] line_increments = [ord(c) for c in co.co_lnotab[1::2]] table_length = len(byte_increments) # == len(line_increments) lineno = co.co_firstlineno table_index = 0 while (table_index < table_length and byte_increments[table_index] == 0): lineno += line_increments[table_index] table_index += 1 addr = 0 line_incr = 0 labels = findlabels(code) n = len(code) i = 0 extended_arg = 0 free = None while i < n: c = code[i] op = ord(c) if i >= addr: lineno += line_incr while table_index < table_length: addr += byte_increments[table_index] line_incr = line_increments[table_index] table_index += 1 if line_incr: break else: addr = sys.maxint if i > 0: print print "%3d"%lineno, else: print ' ', if i == lasti: print '-->', else: print ' ', if i in labels: print '>>', else: print ' ', print `i`.rjust(4), print opname[op].ljust(20), i = i+1 if op >= HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg extended_arg = 0 i = i+2 if op == EXTENDED_ARG: extended_arg = oparg*65536L print `oparg`.rjust(5), if op in hasconst: print '(' + `co.co_consts[oparg]` + ')', elif op in hasname: print '(' + co.co_names[oparg] + ')', elif op in hasjrel: print '(to ' + `i + oparg` + ')', elif op in haslocal: print '(' + co.co_varnames[oparg] + ')', elif op in hascompare: print '(' + cmp_op[oparg] + ')', elif op in hasfree: if free is None: free = co.co_cellvars + co.co_freevars print '(' + free[oparg] + ')', print
093fcd0de00d8a9ac895e2b96a65349d065f1026 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/093fcd0de00d8a9ac895e2b96a65349d065f1026/dis.py
print "%3d"%lineno,
print "%3d" % linestarts[i],
def disassemble(co, lasti=-1): """Disassemble a code object.""" code = co.co_code byte_increments = [ord(c) for c in co.co_lnotab[0::2]] line_increments = [ord(c) for c in co.co_lnotab[1::2]] table_length = len(byte_increments) # == len(line_increments) lineno = co.co_firstlineno table_index = 0 while (table_index < table_length and byte_increments[table_index] == 0): lineno += line_increments[table_index] table_index += 1 addr = 0 line_incr = 0 labels = findlabels(code) n = len(code) i = 0 extended_arg = 0 free = None while i < n: c = code[i] op = ord(c) if i >= addr: lineno += line_incr while table_index < table_length: addr += byte_increments[table_index] line_incr = line_increments[table_index] table_index += 1 if line_incr: break else: addr = sys.maxint if i > 0: print print "%3d"%lineno, else: print ' ', if i == lasti: print '-->', else: print ' ', if i in labels: print '>>', else: print ' ', print `i`.rjust(4), print opname[op].ljust(20), i = i+1 if op >= HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg extended_arg = 0 i = i+2 if op == EXTENDED_ARG: extended_arg = oparg*65536L print `oparg`.rjust(5), if op in hasconst: print '(' + `co.co_consts[oparg]` + ')', elif op in hasname: print '(' + co.co_names[oparg] + ')', elif op in hasjrel: print '(to ' + `i + oparg` + ')', elif op in haslocal: print '(' + co.co_varnames[oparg] + ')', elif op in hascompare: print '(' + cmp_op[oparg] + ')', elif op in hasfree: if free is None: free = co.co_cellvars + co.co_freevars print '(' + free[oparg] + ')', print
093fcd0de00d8a9ac895e2b96a65349d065f1026 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/093fcd0de00d8a9ac895e2b96a65349d065f1026/dis.py
if op == opmap['SET_LINENO'] and i > 0: print
def disassemble_string(code, lasti=-1, varnames=None, names=None, constants=None): labels = findlabels(code) n = len(code) i = 0 while i < n: c = code[i] op = ord(c) if op == opmap['SET_LINENO'] and i > 0: print # Extra blank line if i == lasti: print '-->', else: print ' ', if i in labels: print '>>', else: print ' ', print `i`.rjust(4), print opname[op].ljust(15), i = i+1 if op >= HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 i = i+2 print `oparg`.rjust(5), if op in hasconst: if constants: print '(' + `constants[oparg]` + ')', else: print '(%d)'%oparg, elif op in hasname: if names is not None: print '(' + names[oparg] + ')', else: print '(%d)'%oparg, elif op in hasjrel: print '(to ' + `i + oparg` + ')', elif op in haslocal: if varnames: print '(' + varnames[oparg] + ')', else: print '(%d)' % oparg, elif op in hascompare: print '(' + cmp_op[oparg] + ')', print
093fcd0de00d8a9ac895e2b96a65349d065f1026 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/093fcd0de00d8a9ac895e2b96a65349d065f1026/dis.py
for h in root.handlers:
for h in root.handlers[:]:
def fileConfig(fname, defaults=None): """ Read the logging configuration from a ConfigParser-format file. This can be called several times from an application, allowing an end user the ability to select from various pre-canned configurations (if the developer provides a mechanism to present the choices and load the chosen configuration). In versions of ConfigParser which have the readfp method [typically shipped in 2.x versions of Python], you can pass in a file-like object rather than a filename, in which case the file-like object will be read using readfp. """ import ConfigParser cp = ConfigParser.ConfigParser(defaults) if hasattr(cp, 'readfp') and hasattr(fname, 'readline'): cp.readfp(fname) else: cp.read(fname) #first, do the formatters... flist = cp.get("formatters", "keys") if len(flist): flist = string.split(flist, ",") formatters = {} for form in flist: sectname = "formatter_%s" % form opts = cp.options(sectname) if "format" in opts: fs = cp.get(sectname, "format", 1) else: fs = None if "datefmt" in opts: dfs = cp.get(sectname, "datefmt", 1) else: dfs = None f = logging.Formatter(fs, dfs) formatters[form] = f #next, do the handlers... #critical section... logging._acquireLock() try: try: #first, lose the existing handlers... logging._handlers.clear() #now set up the new ones... hlist = cp.get("handlers", "keys") if len(hlist): hlist = string.split(hlist, ",") handlers = {} fixups = [] #for inter-handler references for hand in hlist: sectname = "handler_%s" % hand klass = cp.get(sectname, "class") opts = cp.options(sectname) if "formatter" in opts: fmt = cp.get(sectname, "formatter") else: fmt = "" klass = eval(klass, vars(logging)) args = cp.get(sectname, "args") args = eval(args, vars(logging)) h = apply(klass, args) if "level" in opts: level = cp.get(sectname, "level") h.setLevel(logging._levelNames[level]) if len(fmt): h.setFormatter(formatters[fmt]) #temporary hack for FileHandler and MemoryHandler. if klass == logging.handlers.MemoryHandler: if "target" in opts: target = cp.get(sectname,"target") else: target = "" if len(target): #the target handler may not be loaded yet, so keep for later... fixups.append((h, target)) handlers[hand] = h #now all handlers are loaded, fixup inter-handler references... for fixup in fixups: h = fixup[0] t = fixup[1] h.setTarget(handlers[t]) #at last, the loggers...first the root... llist = cp.get("loggers", "keys") llist = string.split(llist, ",") llist.remove("root") sectname = "logger_root" root = logging.root log = root opts = cp.options(sectname) if "level" in opts: level = cp.get(sectname, "level") log.setLevel(logging._levelNames[level]) for h in root.handlers: root.removeHandler(h) hlist = cp.get(sectname, "handlers") if len(hlist): hlist = string.split(hlist, ",") for hand in hlist: log.addHandler(handlers[hand]) #and now the others... #we don't want to lose the existing loggers, #since other threads may have pointers to them. #existing is set to contain all existing loggers, #and as we go through the new configuration we #remove any which are configured. At the end, #what's left in existing is the set of loggers #which were in the previous configuration but #which are not in the new configuration. existing = root.manager.loggerDict.keys() #now set up the new ones... for log in llist: sectname = "logger_%s" % log qn = cp.get(sectname, "qualname") opts = cp.options(sectname) if "propagate" in opts: propagate = cp.getint(sectname, "propagate") else: propagate = 1 logger = logging.getLogger(qn) if qn in existing: existing.remove(qn) if "level" in opts: level = cp.get(sectname, "level") logger.setLevel(logging._levelNames[level]) for h in logger.handlers: logger.removeHandler(h) logger.propagate = propagate logger.disabled = 0 hlist = cp.get(sectname, "handlers") if len(hlist): hlist = string.split(hlist, ",") for hand in hlist: logger.addHandler(handlers[hand]) #Disable any old loggers. There's no point deleting #them as other threads may continue to hold references #and by disabling them, you stop them doing any logging. for log in existing: root.manager.loggerDict[log].disabled = 1 except: import traceback ei = sys.exc_info() traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr) del ei finally: logging._releaseLock()
791fc3757aac60ce8bef5cb2c03a4b5964b60a04 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/791fc3757aac60ce8bef5cb2c03a4b5964b60a04/config.py
for h in logger.handlers:
for h in logger.handlers[:]:
def fileConfig(fname, defaults=None): """ Read the logging configuration from a ConfigParser-format file. This can be called several times from an application, allowing an end user the ability to select from various pre-canned configurations (if the developer provides a mechanism to present the choices and load the chosen configuration). In versions of ConfigParser which have the readfp method [typically shipped in 2.x versions of Python], you can pass in a file-like object rather than a filename, in which case the file-like object will be read using readfp. """ import ConfigParser cp = ConfigParser.ConfigParser(defaults) if hasattr(cp, 'readfp') and hasattr(fname, 'readline'): cp.readfp(fname) else: cp.read(fname) #first, do the formatters... flist = cp.get("formatters", "keys") if len(flist): flist = string.split(flist, ",") formatters = {} for form in flist: sectname = "formatter_%s" % form opts = cp.options(sectname) if "format" in opts: fs = cp.get(sectname, "format", 1) else: fs = None if "datefmt" in opts: dfs = cp.get(sectname, "datefmt", 1) else: dfs = None f = logging.Formatter(fs, dfs) formatters[form] = f #next, do the handlers... #critical section... logging._acquireLock() try: try: #first, lose the existing handlers... logging._handlers.clear() #now set up the new ones... hlist = cp.get("handlers", "keys") if len(hlist): hlist = string.split(hlist, ",") handlers = {} fixups = [] #for inter-handler references for hand in hlist: sectname = "handler_%s" % hand klass = cp.get(sectname, "class") opts = cp.options(sectname) if "formatter" in opts: fmt = cp.get(sectname, "formatter") else: fmt = "" klass = eval(klass, vars(logging)) args = cp.get(sectname, "args") args = eval(args, vars(logging)) h = apply(klass, args) if "level" in opts: level = cp.get(sectname, "level") h.setLevel(logging._levelNames[level]) if len(fmt): h.setFormatter(formatters[fmt]) #temporary hack for FileHandler and MemoryHandler. if klass == logging.handlers.MemoryHandler: if "target" in opts: target = cp.get(sectname,"target") else: target = "" if len(target): #the target handler may not be loaded yet, so keep for later... fixups.append((h, target)) handlers[hand] = h #now all handlers are loaded, fixup inter-handler references... for fixup in fixups: h = fixup[0] t = fixup[1] h.setTarget(handlers[t]) #at last, the loggers...first the root... llist = cp.get("loggers", "keys") llist = string.split(llist, ",") llist.remove("root") sectname = "logger_root" root = logging.root log = root opts = cp.options(sectname) if "level" in opts: level = cp.get(sectname, "level") log.setLevel(logging._levelNames[level]) for h in root.handlers: root.removeHandler(h) hlist = cp.get(sectname, "handlers") if len(hlist): hlist = string.split(hlist, ",") for hand in hlist: log.addHandler(handlers[hand]) #and now the others... #we don't want to lose the existing loggers, #since other threads may have pointers to them. #existing is set to contain all existing loggers, #and as we go through the new configuration we #remove any which are configured. At the end, #what's left in existing is the set of loggers #which were in the previous configuration but #which are not in the new configuration. existing = root.manager.loggerDict.keys() #now set up the new ones... for log in llist: sectname = "logger_%s" % log qn = cp.get(sectname, "qualname") opts = cp.options(sectname) if "propagate" in opts: propagate = cp.getint(sectname, "propagate") else: propagate = 1 logger = logging.getLogger(qn) if qn in existing: existing.remove(qn) if "level" in opts: level = cp.get(sectname, "level") logger.setLevel(logging._levelNames[level]) for h in logger.handlers: logger.removeHandler(h) logger.propagate = propagate logger.disabled = 0 hlist = cp.get(sectname, "handlers") if len(hlist): hlist = string.split(hlist, ",") for hand in hlist: logger.addHandler(handlers[hand]) #Disable any old loggers. There's no point deleting #them as other threads may continue to hold references #and by disabling them, you stop them doing any logging. for log in existing: root.manager.loggerDict[log].disabled = 1 except: import traceback ei = sys.exc_info() traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr) del ei finally: logging._releaseLock()
791fc3757aac60ce8bef5cb2c03a4b5964b60a04 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/791fc3757aac60ce8bef5cb2c03a4b5964b60a04/config.py
test_support.run_unittest(TestBug1385040)
pass
def test_main(): test_support.run_unittest(TestBug1385040)
4d9c3952de8baed7587bf774450d5321f55d8ec0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4d9c3952de8baed7587bf774450d5321f55d8ec0/outstanding_bugs.py
ci.append(-2.5, -3.7, 1.0) ci.append(-1.5, -3.7, 3.0) ci.append(1.5, -3.7, -2.5) ci.append(2.5, -3.7, -0.75)
ci.append((-2.5, -3.7, 1.0)) ci.append((-1.5, -3.7, 3.0)) ci.append((1.5, -3.7, -2.5)) ci.append((2.5, -3.7, -0.75))
def make_ctlpoints(): c = [] # ci = [] ci.append(-2.5, -3.7, 1.0) ci.append(-1.5, -3.7, 3.0) ci.append(1.5, -3.7, -2.5) ci.append(2.5, -3.7, -0.75) c.append(ci) # ci = [] ci.append(-2.5, -2.0, 3.0) ci.append(-1.5, -2.0, 4.0) ci.append(1.5, -2.0, -3.0) ci.append(2.5, -2.0, 0.0) c.append(ci) # ci = [] ci.append(-2.5, 2.0, 1.0) ci.append(-1.5, 2.0, 0.0) ci.append(1.5, 2.0, -1.0) ci.append(2.5, 2.0, 2.0) c.append(ci) # ci = [] ci.append(-2.5, 2.7, 1.25) ci.append(-1.5, 2.7, 0.1) ci.append(1.5, 2.7, -0.6) ci.append(2.5, 2.7, 0.2) c.append(ci) # return c
062c870df054eb11558984a420ed98a4052153ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/062c870df054eb11558984a420ed98a4052153ff/nurbs.py
ci.append(-2.5, -2.0, 3.0) ci.append(-1.5, -2.0, 4.0) ci.append(1.5, -2.0, -3.0) ci.append(2.5, -2.0, 0.0)
ci.append((-2.5, -2.0, 3.0)) ci.append((-1.5, -2.0, 4.0)) ci.append((1.5, -2.0, -3.0)) ci.append((2.5, -2.0, 0.0))
def make_ctlpoints(): c = [] # ci = [] ci.append(-2.5, -3.7, 1.0) ci.append(-1.5, -3.7, 3.0) ci.append(1.5, -3.7, -2.5) ci.append(2.5, -3.7, -0.75) c.append(ci) # ci = [] ci.append(-2.5, -2.0, 3.0) ci.append(-1.5, -2.0, 4.0) ci.append(1.5, -2.0, -3.0) ci.append(2.5, -2.0, 0.0) c.append(ci) # ci = [] ci.append(-2.5, 2.0, 1.0) ci.append(-1.5, 2.0, 0.0) ci.append(1.5, 2.0, -1.0) ci.append(2.5, 2.0, 2.0) c.append(ci) # ci = [] ci.append(-2.5, 2.7, 1.25) ci.append(-1.5, 2.7, 0.1) ci.append(1.5, 2.7, -0.6) ci.append(2.5, 2.7, 0.2) c.append(ci) # return c
062c870df054eb11558984a420ed98a4052153ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/062c870df054eb11558984a420ed98a4052153ff/nurbs.py
ci.append(-2.5, 2.0, 1.0) ci.append(-1.5, 2.0, 0.0) ci.append(1.5, 2.0, -1.0) ci.append(2.5, 2.0, 2.0)
ci.append((-2.5, 2.0, 1.0)) ci.append((-1.5, 2.0, 0.0)) ci.append((1.5, 2.0, -1.0)) ci.append((2.5, 2.0, 2.0))
def make_ctlpoints(): c = [] # ci = [] ci.append(-2.5, -3.7, 1.0) ci.append(-1.5, -3.7, 3.0) ci.append(1.5, -3.7, -2.5) ci.append(2.5, -3.7, -0.75) c.append(ci) # ci = [] ci.append(-2.5, -2.0, 3.0) ci.append(-1.5, -2.0, 4.0) ci.append(1.5, -2.0, -3.0) ci.append(2.5, -2.0, 0.0) c.append(ci) # ci = [] ci.append(-2.5, 2.0, 1.0) ci.append(-1.5, 2.0, 0.0) ci.append(1.5, 2.0, -1.0) ci.append(2.5, 2.0, 2.0) c.append(ci) # ci = [] ci.append(-2.5, 2.7, 1.25) ci.append(-1.5, 2.7, 0.1) ci.append(1.5, 2.7, -0.6) ci.append(2.5, 2.7, 0.2) c.append(ci) # return c
062c870df054eb11558984a420ed98a4052153ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/062c870df054eb11558984a420ed98a4052153ff/nurbs.py
ci.append(-2.5, 2.7, 1.25) ci.append(-1.5, 2.7, 0.1) ci.append(1.5, 2.7, -0.6) ci.append(2.5, 2.7, 0.2)
ci.append((-2.5, 2.7, 1.25)) ci.append((-1.5, 2.7, 0.1)) ci.append((1.5, 2.7, -0.6)) ci.append((2.5, 2.7, 0.2))
def make_ctlpoints(): c = [] # ci = [] ci.append(-2.5, -3.7, 1.0) ci.append(-1.5, -3.7, 3.0) ci.append(1.5, -3.7, -2.5) ci.append(2.5, -3.7, -0.75) c.append(ci) # ci = [] ci.append(-2.5, -2.0, 3.0) ci.append(-1.5, -2.0, 4.0) ci.append(1.5, -2.0, -3.0) ci.append(2.5, -2.0, 0.0) c.append(ci) # ci = [] ci.append(-2.5, 2.0, 1.0) ci.append(-1.5, 2.0, 0.0) ci.append(1.5, 2.0, -1.0) ci.append(2.5, 2.0, 2.0) c.append(ci) # ci = [] ci.append(-2.5, 2.7, 1.25) ci.append(-1.5, 2.7, 0.1) ci.append(1.5, 2.7, -0.6) ci.append(2.5, 2.7, 0.2) c.append(ci) # return c
062c870df054eb11558984a420ed98a4052153ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/062c870df054eb11558984a420ed98a4052153ff/nurbs.py
c.append(1.0, 0.0, 1.0) c.append(1.0, 1.0, 1.0) c.append(0.0, 2.0, 2.0) c.append(-1.0, 1.0, 1.0) c.append(-1.0, 0.0, 1.0) c.append(-1.0, -1.0, 1.0) c.append(0.0, -2.0, 2.0) c.append(1.0, -1.0, 1.0) c.append(1.0, 0.0, 1.0)
c.append((1.0, 0.0, 1.0)) c.append((1.0, 1.0, 1.0)) c.append((0.0, 2.0, 2.0)) c.append((-1.0, 1.0, 1.0)) c.append((-1.0, 0.0, 1.0)) c.append((-1.0, -1.0, 1.0)) c.append((0.0, -2.0, 2.0)) c.append((1.0, -1.0, 1.0) ) c.append((1.0, 0.0, 1.0))
def make_trimpoints(): c = [] c.append(1.0, 0.0, 1.0) c.append(1.0, 1.0, 1.0) c.append(0.0, 2.0, 2.0) c.append(-1.0, 1.0, 1.0) c.append(-1.0, 0.0, 1.0) c.append(-1.0, -1.0, 1.0) c.append(0.0, -2.0, 2.0) c.append(1.0, -1.0, 1.0) c.append(1.0, 0.0, 1.0) return c
062c870df054eb11558984a420ed98a4052153ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/062c870df054eb11558984a420ed98a4052153ff/nurbs.py
writer = _get_StringIO() self.writexml(writer, "", indent, newl) return writer.getvalue()
writer = _get_StringIO() self.writexml(writer, "", indent, newl) return writer.getvalue()
def toprettyxml(self, indent="\t", newl="\n"): # indent = the indentation string to prepend, per level # newl = the newline string to append writer = _get_StringIO() self.writexml(writer, "", indent, newl) return writer.getvalue()
c0b238c24ff0298290d32676bc6fdfb74d04e772 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c0b238c24ff0298290d32676bc6fdfb74d04e772/minidom.py
from distutils.util import get_platform s = "build/lib.%s-%.3s" % (get_platform(), sys.version)
s = "build/lib.%s-%.3s" % ("linux-i686", sys.version)
def makepath(*paths): dir = os.path.abspath(os.path.join(*paths)) return dir, os.path.normcase(dir)
3a61bcd99a50e62f3f924a0d66543304993e8ec8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3a61bcd99a50e62f3f924a0d66543304993e8ec8/site.py
del get_platform, s
def makepath(*paths): dir = os.path.abspath(os.path.join(*paths)) return dir, os.path.normcase(dir)
3a61bcd99a50e62f3f924a0d66543304993e8ec8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3a61bcd99a50e62f3f924a0d66543304993e8ec8/site.py
self.__msg = msg
self._msg = msg
def __init__(self, msg=''): self.__msg = msg
8203d9b3441c1cba254101518f985ee4667f50ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8203d9b3441c1cba254101518f985ee4667f50ab/ConfigParser.py
return self.__msg
return self._msg
def __repr__(self): return self.__msg
8203d9b3441c1cba254101518f985ee4667f50ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8203d9b3441c1cba254101518f985ee4667f50ab/ConfigParser.py
on the defaults passed into the constructor.
on the defaults passed into the constructor, unless the optional argument `raw' is true.
def get(self, section, option, raw=0): """Get an option value for a given section.
8203d9b3441c1cba254101518f985ee4667f50ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8203d9b3441c1cba254101518f985ee4667f50ab/ConfigParser.py
cursect = None
cursect = None
def __read(self, fp): """Parse a sectioned setup file.
8203d9b3441c1cba254101518f985ee4667f50ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8203d9b3441c1cba254101518f985ee4667f50ab/ConfigParser.py
if line[0] in ' \t' and cursect <> None and optname:
if line[0] in ' \t' and cursect is not None and optname:
def __read(self, fp): """Parse a sectioned setup file.
8203d9b3441c1cba254101518f985ee4667f50ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8203d9b3441c1cba254101518f985ee4667f50ab/ConfigParser.py
cursect = cursect[optname] + '\n ' + value elif secthead_cre.match(line) >= 0: sectname = secthead_cre.group(1) if self.__sections.has_key(sectname): cursect = self.__sections[sectname] elif sectname == DEFAULTSECT: cursect = self.__defaults
cursect[optname] = cursect[optname] + '\n ' + value else: mo = self.__SECTCRE.match(line) if mo: sectname = mo.group('header') if self.__sections.has_key(sectname): cursect = self.__sections[sectname] elif sectname == DEFAULTSECT: cursect = self.__defaults else: cursect = {} self.__sections[sectname] = cursect optname = None elif cursect is None: raise MissingSectionHeaderError(fp.name, lineno, `line`)
def __read(self, fp): """Parse a sectioned setup file.
8203d9b3441c1cba254101518f985ee4667f50ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8203d9b3441c1cba254101518f985ee4667f50ab/ConfigParser.py
cursect = {'name': sectname} self.__sections[sectname] = cursect optname = None elif option_cre.match(line) >= 0: optname, optval = option_cre.group(1, 3) optname = string.lower(optname) optval = string.strip(optval) if optval == '""': optval = '' cursect[optname] = optval else: print 'Error in %s at %d: %s', (fp.name, lineno, `line`)
mo = self.__OPTCRE.match(line) if mo: optname, optval = mo.group('option', 'value') optname = string.lower(optname) optval = string.strip(optval) if optval == '""': optval = '' cursect[optname] = optval else: if not e: e = ParsingError(fp.name) e.append(lineno, `line`) if e: raise e
def __read(self, fp): """Parse a sectioned setup file.
8203d9b3441c1cba254101518f985ee4667f50ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8203d9b3441c1cba254101518f985ee4667f50ab/ConfigParser.py
class _MultiCallMethod: def __init__(self, call_list, name): self.__call_list = call_list self.__name = name def __getattr__(self, name): return _MultiCallMethod(self.__call_list, "%s.%s" % (self.__name, name)) def __call__(self, *args): self.__call_list.append((self.__name, args)) def MultiCallIterator(results): """Iterates over the results of a multicall. Exceptions are thrown in response to xmlrpc faults.""" for i in results: if type(i) == type({}): raise Fault(i['faultCode'], i['faultString']) elif type(i) == type([]): yield i[0] else: raise ValueError,\ "unexpected type in multicall result" class MultiCall: """server -> a object used to boxcar method calls server should be a ServerProxy object. Methods can be added to the MultiCall using normal method call syntax e.g.: multicall = MultiCall(server_proxy) multicall.add(2,3) multicall.get_address("Guido") To execute the multicall, call the MultiCall object e.g.: add_result, address = multicall() """ def __init__(self, server): self.__server = server self.__call_list = [] def __repr__(self): return "<MultiCall at %x>" % id(self) __str__ = __repr__ def __getattr__(self, name): return _MultiCallMethod(self.__call_list, name) def __call__(self): marshalled_list = [] for name, args in self.__call_list: marshalled_list.append({'methodName' : name, 'params' : args}) return MultiCallIterator(self.__server.system.multicall(marshalled_list))
def end_methodName(self, data): if self._encoding: data = _decode(data, self._encoding) self._methodname = data self._type = "methodName" # no params
da300e34b8a06ebbd0d1e3ca698b8b5aef773766 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da300e34b8a06ebbd0d1e3ca698b8b5aef773766/xmlrpclib.py
def __repr__(self): return ( "<ServerProxy for %s%s>" % (self.__host, self.__handler) )
da300e34b8a06ebbd0d1e3ca698b8b5aef773766 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da300e34b8a06ebbd0d1e3ca698b8b5aef773766/xmlrpclib.py
exts.append( Extension('unicodedata', ['unicodedata.c', 'unicodedatabase.c']) )
exts.append( Extension('unicodedata', ['unicodedata.c']) )
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' )
4ee99536e74d360265f36abaa9d2526216fe8f9a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4ee99536e74d360265f36abaa9d2526216fe8f9a/setup.py
if hasattr(m, "__file__"):
if hasattr(m, "__file__") and m.__file__:
def makepath(*paths): dir = os.path.join(*paths) return os.path.normcase(os.path.abspath(dir))
54d9124e8c96c0438ad7a978fa1af8a214a0759c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54d9124e8c96c0438ad7a978fa1af8a214a0759c/site.py
[here, os.path.join(here, os.pardir), os.curdir])
[os.path.join(here, os.pardir), here, os.curdir])
def __call__(self): self.__setup() prompt = 'Hit Return for more, or q (and Return) to quit: ' lineno = 0 while 1: try: for i in range(lineno, lineno + self.MAXLINES): print self.__lines[i] except IndexError: break else: lineno += self.MAXLINES key = None while key is None: key = raw_input(prompt) if key not in ('', 'q'): key = None if key == 'q': break
54d9124e8c96c0438ad7a978fa1af8a214a0759c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54d9124e8c96c0438ad7a978fa1af8a214a0759c/site.py
if __name__ == "__main__": import glob f = glob.glob("command/*.py") byte_compile(f, optimize=0, prefix="command/", base_dir="/usr/lib/python")
def byte_compile (py_files, optimize=0, force=0, prefix=None, base_dir=None, verbose=1, dry_run=0, direct=None): """Byte-compile a collection of Python source files to either .pyc or .pyo files in the same directory. 'py_files' is a list of files to compile; any files that don't end in ".py" are silently skipped. 'optimize' must be one of the following: 0 - don't optimize (generate .pyc) 1 - normal optimization (like "python -O") 2 - extra optimization (like "python -OO") If 'force' is true, all files are recompiled regardless of timestamps. The source filename encoded in each bytecode file defaults to the filenames listed in 'py_files'; you can modify these with 'prefix' and 'basedir'. 'prefix' is a string that will be stripped off of each source filename, and 'base_dir' is a directory name that will be prepended (after 'prefix' is stripped). You can supply either or both (or neither) of 'prefix' and 'base_dir', as you wish. If 'verbose' is true, prints out a report of each file. If 'dry_run' is true, doesn't actually do anything that would affect the filesystem. Byte-compilation is either done directly in this interpreter process with the standard py_compile module, or indirectly by writing a temporary script and executing it. Normally, you should let 'byte_compile()' figure out to use direct compilation or not (see the source for details). The 'direct' flag is used by the script generated in indirect mode; unless you know what you're doing, leave it set to None. """ # First, if the caller didn't force us into direct or indirect mode, # figure out which mode we should be in. We take a conservative # approach: choose direct mode *only* if the current interpreter is # in debug mode and optimize is 0. If we're not in debug mode (-O # or -OO), we don't know which level of optimization this # interpreter is running with, so we can't do direct # byte-compilation and be certain that it's the right thing. Thus, # always compile indirectly if the current interpreter is in either # optimize mode, or if either optimization level was requested by # the caller. if direct is None: direct = (__debug__ and optimize == 0) # "Indirect" byte-compilation: write a temporary script and then # run it with the appropriate flags. if not direct: from tempfile import mktemp script_name = mktemp(".py") if verbose: print "writing byte-compilation script '%s'" % script_name if not dry_run: script = open(script_name, "w") script.write("""\
301b41de5d1a33736402e12f2fef992defde180f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/301b41de5d1a33736402e12f2fef992defde180f/util.py
default_compiler = { 'posix': 'unix', 'nt': 'msvc', 'mac': 'mwerks', }
_default_compilers = ( ('cygwin.*', 'cygwin'), ('posix', 'unix'), ('nt', 'msvc'), ('mac', 'mwerks'), ) def get_default_compiler(osname=None, platform=None): """ Determine the default compiler to use for the given platform. osname should be one of the standard Python OS names (i.e. the ones returned by os.name) and platform the common value returned by sys.platform for the platform in question. The default values are os.name and sys.platform in case the parameters are not given. """ if osname is None: osname = os.name if platform is None: platform = sys.platform for pattern, compiler in _default_compilers: if re.match(pattern, platform) is not None or \ re.match(pattern, osname) is not None: return compiler return 'unix'
def mkpath (self, name, mode=0777): mkpath (name, mode, self.verbose, self.dry_run)
4be4be8ede8d2cb760abf6af749f2bd1c0178bc9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4be4be8ede8d2cb760abf6af749f2bd1c0178bc9/ccompiler.py
compiler = default_compiler[plat]
compiler = get_default_compiler(plat)
def new_compiler (plat=None, compiler=None, verbose=0, dry_run=0, force=0): """Generate an instance of some CCompiler subclass for the supplied platform/compiler combination. 'plat' defaults to 'os.name' (eg. 'posix', 'nt'), and 'compiler' defaults to the default compiler for that platform. Currently only 'posix' and 'nt' are supported, and the default compilers are "traditional Unix interface" (UnixCCompiler class) and Visual C++ (MSVCCompiler class). Note that it's perfectly possible to ask for a Unix compiler object under Windows, and a Microsoft compiler object under Unix -- if you supply a value for 'compiler', 'plat' is ignored. """ if plat is None: plat = os.name try: if compiler is None: compiler = default_compiler[plat] (module_name, class_name, long_description) = compiler_class[compiler] except KeyError: msg = "don't know how to compile C/C++ code on platform '%s'" % plat if compiler is not None: msg = msg + " with '%s' compiler" % compiler raise DistutilsPlatformError, msg try: module_name = "distutils." + module_name __import__ (module_name) module = sys.modules[module_name] klass = vars(module)[class_name] except ImportError: raise DistutilsModuleError, \ "can't compile C/C++ code: unable to load module '%s'" % \ module_name except KeyError: raise DistutilsModuleError, \ ("can't compile C/C++ code: unable to find class '%s' " + "in module '%s'") % (class_name, module_name) return klass (verbose, dry_run, force)
4be4be8ede8d2cb760abf6af749f2bd1c0178bc9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4be4be8ede8d2cb760abf6af749f2bd1c0178bc9/ccompiler.py
coords = self._canvas.bbox(self._TAG)
coords = self._canvas.coords(self._TAG)
def _x(self): coords = self._canvas.bbox(self._TAG) assert coords return coords[2] - 6 # BAW: kludge
b5d3dfa0fc243824fd8097dc3b4950e5aafd4feb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b5d3dfa0fc243824fd8097dc3b4950e5aafd4feb/StripViewer.py
return coords[2] - 6
return coords[0] + self._ARROWWIDTH
def _x(self): coords = self._canvas.bbox(self._TAG) assert coords return coords[2] - 6 # BAW: kludge
b5d3dfa0fc243824fd8097dc3b4950e5aafd4feb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b5d3dfa0fc243824fd8097dc3b4950e5aafd4feb/StripViewer.py
":build.macppc.shared:PythonCore.",
":build.macppc.shared:PythonCorePPC.",
def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst)
0c28b63263149c7e1a7a07ef92681a509258fd3e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c28b63263149c7e1a7a07ef92681a509258fd3e/fullbuild.py
":build.macppc.shared:PythonApplet.",
":build.macppc.shared:PythonAppletPPC.",
def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst)
0c28b63263149c7e1a7a07ef92681a509258fd3e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c28b63263149c7e1a7a07ef92681a509258fd3e/fullbuild.py
":PlugIns:ctbmodule.ppc.",
":PlugIns:ctb.ppc.",
def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst)
0c28b63263149c7e1a7a07ef92681a509258fd3e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c28b63263149c7e1a7a07ef92681a509258fd3e/fullbuild.py
":PlugIns:macspeechmodule.ppc.",
":PlugIns:macspeech.ppc.",
def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst)
0c28b63263149c7e1a7a07ef92681a509258fd3e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c28b63263149c7e1a7a07ef92681a509258fd3e/fullbuild.py
":PlugIns:wastemodule.ppc.", ":PlugIns:_tkintermodule.ppc.",
":PlugIns:qtmodules.ppc.", ":PlugIns:waste.ppc.", ":PlugIns:_tkinter.ppc.",
def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst)
0c28b63263149c7e1a7a07ef92681a509258fd3e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c28b63263149c7e1a7a07ef92681a509258fd3e/fullbuild.py
":PlugIns:ctbmodule.CFM68K.",
":PlugIns:ctb.CFM68K.", ":PlugIns:imgmodules.ppc.",
def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst)
0c28b63263149c7e1a7a07ef92681a509258fd3e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c28b63263149c7e1a7a07ef92681a509258fd3e/fullbuild.py
":PlugIns:wastemodule.CFM68K.", ":PlugIns:_tkintermodule.CFM68K.",
":PlugIns:qtmodules.CFM68K.", ":PlugIns:waste.CFM68K.", ":PlugIns:_tkinter.CFM68K.",
def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst)
0c28b63263149c7e1a7a07ef92681a509258fd3e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0c28b63263149c7e1a7a07ef92681a509258fd3e/fullbuild.py
The function prototype can be called in three ways to create a
The function prototype can be called in different ways to create a
def CFUNCTYPE(restype, *argtypes): """CFUNCTYPE(restype, *argtypes) -> function prototype. restype: the result type argtypes: a sequence specifying the argument types The function prototype can be called in three ways to create a callable object: prototype(integer address) -> foreign function prototype(callable) -> create and return a C callable function from callable prototype(integer index, method name[, paramflags]) -> foreign function calling a COM method prototype((ordinal number, dll object)[, paramflags]) -> foreign function exported by ordinal prototype((function name, dll object)[, paramflags]) -> foreign function exported by name """ try: return _c_functype_cache[(restype, argtypes)] except KeyError: class CFunctionType(_CFuncPtr): _argtypes_ = argtypes _restype_ = restype _flags_ = _FUNCFLAG_CDECL _c_functype_cache[(restype, argtypes)] = CFunctionType return CFunctionType
372d22c570ff8cc92b80aa14f932e403a3853c68 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/372d22c570ff8cc92b80aa14f932e403a3853c68/__init__.py
(to an older frame)."""
(to a newer frame)."""
def help_d(self): print """d(own)
3815c552721a7d8d5b6a7f0aa8788455371968ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3815c552721a7d8d5b6a7f0aa8788455371968ef/pdb.py
(to a newer frame)."""
(to an older frame)."""
def help_u(self): print """u(p)
3815c552721a7d8d5b6a7f0aa8788455371968ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3815c552721a7d8d5b6a7f0aa8788455371968ef/pdb.py
def add_windows_to_menu(menu): registry.add_windows_to_menu(menu)
add_windows_to_menu = registry.add_windows_to_menu register_callback = registry.register_callback unregister_callback = registry.unregister_callback call_callbacks = registry.call_callbacks
def add_windows_to_menu(menu): registry.add_windows_to_menu(menu)
2f485d659a3e4d1b788b595b7adc4469306d9f8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2f485d659a3e4d1b788b595b7adc4469306d9f8c/WindowList.py
client address as self.client_request, and the server (in case it
client address as self.client_address, and the server (in case it
def process_request(self, request, client_address): """Start a new thread to process the request.""" import thread thread.start_new_thread(self.finish_request, (request, client_address))
fc7db8ca200b82e6726711548ed2e921696e989d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fc7db8ca200b82e6726711548ed2e921696e989d/SocketServer.py
if not included: self._version = dict.get('Version', '0.1') if self._version != PIMP_VERSION: sys.stderr.write("Warning: database version %s does not match %s\n"
if included: version = dict.get('Version') if version and version > self._version: sys.stderr.write("Warning: included database %s is for pimp version %s\n" % (url, version)) else: self._version = dict.get('Version') if not self._version: sys.stderr.write("Warning: database has no Version information\n") elif self._version > PIMP_VERSION: sys.stderr.write("Warning: database version %s newer than pimp version %s\n"
def appendURL(self, url, included=0): """Append packages from the database with the given URL. Only the first database should specify included=0, so the global information (maintainer, description) get stored.""" if url in self._urllist: return self._urllist.append(url) fp = urllib2.urlopen(url).fp dict = plistlib.Plist.fromFile(fp) # Test here for Pimp version, etc if not included: self._version = dict.get('Version', '0.1') if self._version != PIMP_VERSION: sys.stderr.write("Warning: database version %s does not match %s\n" % (self._version, PIMP_VERSION)) self._maintainer = dict.get('Maintainer', '') self._description = dict.get('Description', '') self._appendPackages(dict['Packages']) others = dict.get('Include', []) for url in others: self.appendURL(url, included=1)
005fe6f20a68475eb007be99622a42047de0bdcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/005fe6f20a68475eb007be99622a42047de0bdcf/pimp.py
print " -D dir Set destination directory (default: site-packages)"
print " -D dir Set destination directory" print " (default: %s)" % DEFAULT_INSTALLDIR print " -u url URL for database" print " (default: %s)" % DEFAULT_PIMPDATABASE
def _help(): print "Usage: pimp [options] -s [package ...] List installed status" print " pimp [options] -l [package ...] Show package information" print " pimp [options] -i package ... Install packages" print " pimp -d Dump database to stdout" print "Options:" print " -v Verbose" print " -f Force installation" print " -D dir Set destination directory (default: site-packages)" sys.exit(1)
005fe6f20a68475eb007be99622a42047de0bdcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/005fe6f20a68475eb007be99622a42047de0bdcf/pimp.py
opts, args = getopt.getopt(sys.argv[1:], "slifvdD:") except getopt.Error:
opts, args = getopt.getopt(sys.argv[1:], "slifvdD:Vu:") except getopt.GetoptError:
def _help(): print "Usage: pimp [options] -s [package ...] List installed status" print " pimp [options] -l [package ...] Show package information" print " pimp [options] -i package ... Install packages" print " pimp -d Dump database to stdout" print "Options:" print " -v Verbose" print " -f Force installation" print " -D dir Set destination directory (default: site-packages)" sys.exit(1)
005fe6f20a68475eb007be99622a42047de0bdcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/005fe6f20a68475eb007be99622a42047de0bdcf/pimp.py
_run(mode, verbose, force, args, prefargs)
if mode == 'version': print 'Pimp version %s; module name is %s' % (PIMP_VERSION, __name__) else: _run(mode, verbose, force, args, prefargs) if __name__ != 'pimp_update': try: import pimp_update except ImportError: pass else: if pimp_update.PIMP_VERSION <= PIMP_VERSION: import warnings warnings.warn("pimp_update is version %s, not newer than pimp version %s" % (pimp_update.PIMP_VERSION, PIMP_VERSION)) else: from pimp_update import *
def _help(): print "Usage: pimp [options] -s [package ...] List installed status" print " pimp [options] -l [package ...] Show package information" print " pimp [options] -i package ... Install packages" print " pimp -d Dump database to stdout" print "Options:" print " -v Verbose" print " -f Force installation" print " -D dir Set destination directory (default: site-packages)" sys.exit(1)
005fe6f20a68475eb007be99622a42047de0bdcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/005fe6f20a68475eb007be99622a42047de0bdcf/pimp.py
if os.path.exists (self.build_bdist)
if os.path.exists (self.build_bdist):
def run(self): # remove the build/temp.<plat> directory (unless it's already # gone) if os.path.exists (self.build_temp): remove_tree (self.build_temp, self.verbose, self.dry_run)
b6902b2ec210f44a40642e42909daf771c48b42d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b6902b2ec210f44a40642e42909daf771c48b42d/clean.py
base = path[len(longest) + 1:].replace("/", ".")
if longest: base = path[len(longest) + 1:] else: base = path base = base.replace("/", ".")
def fullmodname(path): """Return a plausible module name for the path.""" # If the file 'path' is part of a package, then the filename isn't # enough to uniquely identify it. Try to do the right thing by # looking in sys.path for the longest matching prefix. We'll # assume that the rest is the package name. longest = "" for dir in sys.path: if path.startswith(dir) and path[len(dir)] == os.path.sep: if len(dir) > len(longest): longest = dir base = path[len(longest) + 1:].replace("/", ".") filename, ext = os.path.splitext(base) return filename
6778d9dcbcf5c3a570157b7f4b220230d80b83f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6778d9dcbcf5c3a570157b7f4b220230d80b83f6/trace.py
from pprint import pprint print "options (after parsing config files):" pprint (self.command_options)
parser.__init__()
def parse_config_files (self, filenames=None):
83524a79f442571b7411524d49f6f5fa8e189c0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83524a79f442571b7411524d49f6f5fa8e189c0d/dist.py
if opts.help:
if hasattr(opts, 'help') and opts.help:
def _parse_command_opts (self, parser, args):
83524a79f442571b7411524d49f6f5fa8e189c0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83524a79f442571b7411524d49f6f5fa8e189c0d/dist.py
cmd_opts[command] = ("command line", value)
cmd_opts[name] = ("command line", value)
def _parse_command_opts (self, parser, args):
83524a79f442571b7411524d49f6f5fa8e189c0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83524a79f442571b7411524d49f6f5fa8e189c0d/dist.py
cmd_obj = self.command_obj[command] = klass() self.command_run[command] = 0
cmd_obj = self.command_obj[command] = klass(self) self.have_run[command] = 0 options = self.command_options.get(command) if options: print " setting options:" for (option, (source, value)) in options.items(): print " %s = %s (from %s)" % (option, value, source) setattr(cmd_obj, option, value)
def get_command_obj (self, command, create=1): """Return the command object for 'command'. Normally this object is cached on a previous call to 'get_command_obj()'; if no comand object for 'command' is in the cache, then we either create and return it (if 'create' is true) or return None. """ cmd_obj = self.command_obj.get(command) if not cmd_obj and create: klass = self.get_command_class(command) cmd_obj = self.command_obj[command] = klass() self.command_run[command] = 0
83524a79f442571b7411524d49f6f5fa8e189c0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/83524a79f442571b7411524d49f6f5fa8e189c0d/dist.py
self.default(line) return
return self.default(line)
def onecmd(self, line): line = string.strip(line) if line == '?': line = 'help' elif line == '!': if hasattr(self, 'do_shell'): line = 'shell' else: self.default(line) return elif not line: self.emptyline() return self.lastcmd = line i, n = 0, len(line) while i < n and line[i] in self.identchars: i = i+1 cmd, arg = line[:i], string.strip(line[i:]) if cmd == '': return self.default(line) else: try: func = getattr(self, 'do_' + cmd) except AttributeError: return self.default(line) return func(arg)
ebc50ab318d8f90298757368f4820ef8b3565e41 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ebc50ab318d8f90298757368f4820ef8b3565e41/cmd.py
self.emptyline() return
return self.emptyline()
def onecmd(self, line): line = string.strip(line) if line == '?': line = 'help' elif line == '!': if hasattr(self, 'do_shell'): line = 'shell' else: self.default(line) return elif not line: self.emptyline() return self.lastcmd = line i, n = 0, len(line) while i < n and line[i] in self.identchars: i = i+1 cmd, arg = line[:i], string.strip(line[i:]) if cmd == '': return self.default(line) else: try: func = getattr(self, 'do_' + cmd) except AttributeError: return self.default(line) return func(arg)
ebc50ab318d8f90298757368f4820ef8b3565e41 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ebc50ab318d8f90298757368f4820ef8b3565e41/cmd.py
left = resp.find('(') if left < 0: raise error_proto, resp right = resp.find(')', left + 1) if right < 0: raise error_proto, resp numbers = resp[left+1:right].split(',') if len(numbers) != 6:
global _227_re if _227_re is None: import re _227_re = re.compile(r'(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)') m = _227_re.search(resp) if not m:
def parse227(resp): '''Parse the '227' response for a PASV request. Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)' Return ('host.addr.as.numbers', port#) tuple.''' if resp[:3] != '227': raise error_reply, resp left = resp.find('(') if left < 0: raise error_proto, resp right = resp.find(')', left + 1) if right < 0: raise error_proto, resp # should contain '(h1,h2,h3,h4,p1,p2)' numbers = resp[left+1:right].split(',') if len(numbers) != 6: raise error_proto, resp host = '.'.join(numbers[:4]) port = (int(numbers[4]) << 8) + int(numbers[5]) return host, port
5055beaffa50b5e4b08a43a2fe350d9a9e286f3d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5055beaffa50b5e4b08a43a2fe350d9a9e286f3d/ftplib.py
contents = doc and doc + '\n' methods = allmethods(object).items() methods.sort() for key, value in methods: contents = contents + '\n' + self.document(value, key, mod, object) if not contents: return title + '\n'
contents = doc and [doc + '\n'] or [] push = contents.append def spill(msg, attrs, predicate): ok, attrs = _split_class_attrs(attrs, predicate) if ok: push(msg) for name, kind, homecls, value in ok: push(self.document(getattr(object, name), name, mod, object)) return attrs def spillproperties(msg, attrs): ok, attrs = _split_class_attrs(attrs, lambda t: t[1] == 'property') if ok: push(msg) for name, kind, homecls, value in ok: push(name + '\n') return attrs def spilldata(msg, attrs): ok, attrs = _split_class_attrs(attrs, lambda t: t[1] == 'data') if ok: push(msg) for name, kind, homecls, value in ok: doc = getattr(value, "__doc__", None) push(self.docother(getattr(object, name), name, mod, 70, doc) + '\n') return attrs attrs = inspect.classify_class_attrs(object) attrs, inherited = _split_class_attrs(attrs, lambda t: t[2] is object) inherited.sort(lambda t1, t2: cmp(t1[2].__name__, t2[2].__name__)) thisclass = object while attrs or inherited: if thisclass is object: tag = "defined here" else: tag = "inherited from class %s" % classname(thisclass, object.__module__) attrs.sort(lambda t1, t2: cmp(t1[0], t2[0])) attrs = spill("Methods %s:\n" % tag, attrs, lambda t: t[1] == 'method') attrs = spill("Class methods %s:\n" % tag, attrs, lambda t: t[1] == 'class method') attrs = spill("Static methods %s:\n" % tag, attrs, lambda t: t[1] == 'static method') attrs = spillproperties("Properties %s:\n" % tag, attrs) attrs = spilldata("Data %s:\n" % tag, attrs) assert attrs == [] if inherited: attrs = inherited thisclass = attrs[0][2] attrs, inherited = _split_class_attrs(attrs, lambda t: t[2] is thisclass) contents = '\n'.join(contents) if not contents: return title + '\n'
def makename(c, m=object.__module__): return classname(c, m)
25913a37ae3a843a6d57db9f5e63ed9ca58a7c7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/25913a37ae3a843a6d57db9f5e63ed9ca58a7c7a/pydoc.py
def docother(self, object, name=None, mod=None, maxlen=None):
def docother(self, object, name=None, mod=None, maxlen=None, doc=None):
def docother(self, object, name=None, mod=None, maxlen=None): """Produce text documentation for a data object.""" repr = self.repr(object) if maxlen: line = (name and name + ' = ' or '') + repr chop = maxlen - len(line) if chop < 0: repr = repr[:chop] + '...' line = (name and self.bold(name) + ' = ' or '') + repr return line
25913a37ae3a843a6d57db9f5e63ed9ca58a7c7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/25913a37ae3a843a6d57db9f5e63ed9ca58a7c7a/pydoc.py
return ExpatParser()
return xml.sax.make_parser()
def _getParser(): return ExpatParser()
b9e19d5c827436e5230b569c98578273c3c70bb8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b9e19d5c827436e5230b569c98578273c3c70bb8/pulldom.py
def pickle_complex(c): return complex, (c.real, c.imag)
try: complex except NameError: pass else:
def pickle_complex(c): return complex, (c.real, c.imag)
86d5c79b1c47e9a06cb941db0133658083fdcc2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/86d5c79b1c47e9a06cb941db0133658083fdcc2f/copy_reg.py
pickle(type(1j), pickle_complex, complex)
def pickle_complex(c): return complex, (c.real, c.imag) pickle(complex, pickle_complex, complex)
def pickle_complex(c): return complex, (c.real, c.imag)
86d5c79b1c47e9a06cb941db0133658083fdcc2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/86d5c79b1c47e9a06cb941db0133658083fdcc2f/copy_reg.py
print "testing complex args"
if verbose: print "testing complex args"
exec 'def f(a): global a; a = 1'
18bc5c5b6c1936c74baff43f1ef05f794ac69130 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18bc5c5b6c1936c74baff43f1ef05f794ac69130/test_compile.py
def __init__(self, name, mode=RTLD_LOCAL, handle=None):
def __init__(self, name, mode=DEFAULT_MODE, handle=None):
def __init__(self, name, mode=RTLD_LOCAL, handle=None): self._name = name if handle is None: self._handle = _dlopen(self._name, mode) else: self._handle = handle
34572bc258685868d9d1430eb56d0a2e4f11b3e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/34572bc258685868d9d1430eb56d0a2e4f11b3e5/__init__.py
streamservers = [UnixStreamServer, ThreadingUnixStreamServer, ForkingUnixStreamServer]
streamservers = [UnixStreamServer, ThreadingUnixStreamServer] if hasattr(os, 'fork') and os.name not in ('os2',): streamservers.append(ForkingUnixStreamServer)
def testloop(proto, servers, hdlrcls, testfunc): for svrcls in servers: addr = pickaddr(proto) if verbose: print "ADDR =", addr print "CLASS =", svrcls t = ServerThread(addr, svrcls, hdlrcls) if verbose: print "server created" t.start() if verbose: print "server running" for i in range(NREQ): time.sleep(DELAY) if verbose: print "test client", i testfunc(proto, addr) if verbose: print "waiting for server" t.join() if verbose: print "done"
fc404ffca54cf3ad7ff2f378554f4d638e969082 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fc404ffca54cf3ad7ff2f378554f4d638e969082/test_socketserver.py
dgramservers = [UnixDatagramServer, ThreadingUnixDatagramServer, ForkingUnixDatagramServer]
dgramservers = [UnixDatagramServer, ThreadingUnixDatagramServer] if hasattr(os, 'fork') and os.name not in ('os2',): dgramservers.append(ForkingUnixDatagramServer)
def testloop(proto, servers, hdlrcls, testfunc): for svrcls in servers: addr = pickaddr(proto) if verbose: print "ADDR =", addr print "CLASS =", svrcls t = ServerThread(addr, svrcls, hdlrcls) if verbose: print "server created" t.start() if verbose: print "server running" for i in range(NREQ): time.sleep(DELAY) if verbose: print "test client", i testfunc(proto, addr) if verbose: print "waiting for server" t.join() if verbose: print "done"
fc404ffca54cf3ad7ff2f378554f4d638e969082 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fc404ffca54cf3ad7ff2f378554f4d638e969082/test_socketserver.py
except ImportError:
gzip.GzipFile except (ImportError, AttributeError):
def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9): """Open gzip compressed tar archive name for reading or writing. Appending is not allowed. """ if len(mode) > 1 or mode not in "rw": raise ValueError, "mode must be 'r' or 'w'"
56924b2f09bddb628749a038a437fbfa33e82349 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/56924b2f09bddb628749a038a437fbfa33e82349/tarfile.py
db_incs = find_file('db_185.h', inc_dirs, []) if (db_incs is not None and self.compiler.find_library_file(lib_dirs, 'db') ):
dblib = [] if self.compiler.find_library_file(lib_dirs, 'db'): dblib = ['db'] db185_incs = find_file('db_185.h', inc_dirs, ['/usr/include/db3', '/usr/include/db2']) db_inc = find_file('db.h', inc_dirs, ['/usr/include/db1']) if db185_incs is not None:
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' )
ddc84c8bc150a4eec7964962970504dd33674549 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ddc84c8bc150a4eec7964962970504dd33674549/setup.py
include_dirs = db_incs, libraries = ['db'] ) ) else: db_incs = find_file('db.h', inc_dirs, []) if db_incs is not None: exts.append( Extension('bsddb', ['bsddbmodule.c'], include_dirs = db_incs) )
include_dirs = db185_incs, define_macros=[('HAVE_DB_185_H',1)], libraries = dblib ) ) elif db_inc is not None: exts.append( Extension('bsddb', ['bsddbmodule.c'], include_dirs = db_inc, libraries = dblib) )
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' )
ddc84c8bc150a4eec7964962970504dd33674549 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ddc84c8bc150a4eec7964962970504dd33674549/setup.py
return Carbon.Files.ResolveAliasFile(fss, chain)
return Carbon.File.ResolveAliasFile(fss, chain)
def ResolveAliasFile(fss, chain=1): return Carbon.Files.ResolveAliasFile(fss, chain)
db37ede9b4dffa371b6078c275f8cab39d005885 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db37ede9b4dffa371b6078c275f8cab39d005885/macfs.py