rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
if doc: doc = '<small><tt>' + doc + '<br> </tt></small>' | if doc: doc = '<small><tt>' + doc + '</tt></small>' | def docclass(self, object, funcs={}, classes={}): """Produce HTML documentation for a class object.""" name = object.__name__ bases = object.__bases__ contents = '' | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
def docmethod(self, object, funcs={}, classes={}, methods={}, clname=''): """Produce HTML documentation for a method object.""" return self.document( object.im_func, funcs, classes, methods, clname) | def docclass(self, object, funcs={}, classes={}): """Produce HTML documentation for a class object.""" name = object.__name__ bases = object.__bases__ contents = '' | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
|
def docfunction(self, object, funcs={}, classes={}, methods={}, clname=''): """Produce HTML documentation for a function object.""" args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) if object.__name__ == '<lambda>': decl = '<em>lambda</em> ' + argspec[1:-1] | def docroutine(self, object, funcs={}, classes={}, methods={}, clname=''): """Produce HTML documentation for a function or method object.""" if inspect.ismethod(object): object = object.im_func if inspect.isbuiltin(object): decl = '<a name="%s"><strong>%s</strong>(...)</a>\n' % ( clname + '-' + object.__name__, object.__name__) | def docfunction(self, object, funcs={}, classes={}, methods={}, clname=''): """Produce HTML documentation for a function object.""" args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
anchor = clname + '-' + object.__name__ decl = '<a name="%s"\n><strong>%s</strong>%s</a>\n' % ( anchor, object.__name__, argspec) | args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) if object.__name__ == '<lambda>': decl = '<em>lambda</em> ' + argspec[1:-1] else: anchor = clname + '-' + object.__name__ decl = '<a name="%s"\n><strong>%s</strong>%s</a>\n' % ( anchor, object.__name__, argspec) | def docfunction(self, object, funcs={}, classes={}, methods={}, clname=''): """Produce HTML documentation for a function object.""" args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
def docbuiltin(self, object, *extras): """Produce HTML documentation for a built-in function.""" return '<dl><dt><strong>%s</strong>(...)</dl>' % object.__name__ | def docbuiltin(self, object, *extras): """Produce HTML documentation for a built-in function.""" return '<dl><dt><strong>%s</strong>(...)</dl>' % object.__name__ | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
|
return '''<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><title>Python: %s</title> <body bgcolor=" | return ''' <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><title>Python: %s</title><body bgcolor=" | def page(self, object): """Produce a complete HTML page of documentation for an object.""" return '''<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
def docmethod(self, object): """Produce text documentation for a method object.""" return self.document(object.im_func) | def docmethod(self, object): """Produce text documentation for a method object.""" return self.document(object.im_func) | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
|
def docfunction(self, object): """Produce text documentation for a function object.""" try: | def docroutine(self, object): """Produce text documentation for a function or method object.""" if inspect.ismethod(object): object = object.im_func if inspect.isbuiltin(object): decl = self.bold(object.__name__) + '(...)' else: | def docfunction(self, object): """Produce text documentation for a function object.""" try: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) except TypeError: argspec = '(...)' | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
except TypeError: argspec = '(...)' if object.__name__ == '<lambda>': decl = '<lambda> ' + argspec[1:-1] else: decl = self.bold(object.__name__) + argspec | if object.__name__ == '<lambda>': decl = '<lambda> ' + argspec[1:-1] else: decl = self.bold(object.__name__) + argspec | def docfunction(self, object): """Produce text documentation for a function object.""" try: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) except TypeError: argspec = '(...)' | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
def docbuiltin(self, object): """Produce text documentation for a built-in function object.""" return (self.bold(object.__name__) + '(...)\n' + rstrip(self.indent(object.__doc__)) + '\n') | def docfunction(self, object): """Produce text documentation for a function object.""" try: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) except TypeError: argspec = '(...)' | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
|
if hasattr(__builtins__, path): return None, getattr(__builtins__, path) | def locate(path): """Locate an object by name (or dotted path), importing as necessary.""" if not path: # special case: imp.find_module('') strangely succeeds return None, None if type(path) is not types.StringType: return None, path if hasattr(__builtins__, path): return None, getattr(__builtins__, path) parts = split(path, '.') n = 1 while n <= len(parts): path = join(parts[:n], '.') try: module = __import__(path) module = reload(module) except: # Did the error occur before or after we found the module? if sys.modules.has_key(path): filename = sys.modules[path].__file__ elif sys.exc_type is SyntaxError: filename = sys.exc_value.filename else: # module not found, so stop looking break # error occurred in the imported module, so report it raise DocImportError(filename, sys.exc_type, sys.exc_value) try: x = module for p in parts[1:]: x = getattr(x, p) return join(parts[:-1], '.'), x except AttributeError: n = n + 1 continue return None, None | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
|
def locate(path): """Locate an object by name (or dotted path), importing as necessary.""" if not path: # special case: imp.find_module('') strangely succeeds return None, None if type(path) is not types.StringType: return None, path if hasattr(__builtins__, path): return None, getattr(__builtins__, path) parts = split(path, '.') n = 1 while n <= len(parts): path = join(parts[:n], '.') try: module = __import__(path) module = reload(module) except: # Did the error occur before or after we found the module? if sys.modules.has_key(path): filename = sys.modules[path].__file__ elif sys.exc_type is SyntaxError: filename = sys.exc_value.filename else: # module not found, so stop looking break # error occurred in the imported module, so report it raise DocImportError(filename, sys.exc_type, sys.exc_value) try: x = module for p in parts[1:]: x = getattr(x, p) return join(parts[:-1], '.'), x except AttributeError: n = n + 1 continue return None, None | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
||
print 'problem in %s - %s' % (value.filename, value.args) | print 'Problem in %s - %s' % (value.filename, value.args) | def doc(thing): """Display documentation on an object (for interactive use).""" if type(thing) is type(""): try: path, x = locate(thing) except DocImportError, value: print 'problem in %s - %s' % (value.filename, value.args) return if x: thing = x else: print 'could not find or import %s' % repr(thing) return desc = describe(thing) module = inspect.getmodule(thing) if module and module is not thing: desc = desc + ' in module ' + module.__name__ pager('Help on %s:\n\n' % desc + text.document(thing)) | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
print 'could not find or import %s' % repr(thing) | print 'No Python documentation found for %s.' % repr(thing) | def doc(thing): """Display documentation on an object (for interactive use).""" if type(thing) is type(""): try: path, x = locate(thing) except DocImportError, value: print 'problem in %s - %s' % (value.filename, value.args) return if x: thing = x else: print 'could not find or import %s' % repr(thing) return desc = describe(thing) module = inspect.getmodule(thing) if module and module is not thing: desc = desc + ' in module ' + module.__name__ pager('Help on %s:\n\n' % desc + text.document(thing)) | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
def writedocs(path, pkgpath=''): if os.path.isdir(path): dir = path for file in os.listdir(dir): path = os.path.join(dir, file) if os.path.isdir(path): writedocs(path, file + '.' + pkgpath) if os.path.isfile(path): writedocs(path, pkgpath) if os.path.isfile(path): modname = modulename(path) if modname: writedoc(pkgpath + modname) | def doc(thing): """Display documentation on an object (for interactive use).""" if type(thing) is type(""): try: path, x = locate(thing) except DocImportError, value: print 'problem in %s - %s' % (value.filename, value.args) return if x: thing = x else: print 'could not find or import %s' % repr(thing) return desc = describe(thing) module = inspect.getmodule(thing) if module and module is not thing: desc = desc + ' in module ' + module.__name__ pager('Help on %s:\n\n' % desc + text.document(thing)) | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
|
print 'could not find or import %s' % repr(key) | print 'No Python documentation found for %s.' % repr(key) class Scanner: """A generic tree iterator.""" def __init__(self, roots, children, recurse): self.roots = roots[:] self.state = [] self.children = children self.recurse = recurse def next(self): if not self.state: if not self.roots: return None root = self.roots.pop(0) self.state = [(root, self.children(root))] node, children = self.state[-1] if not children: self.state.pop() return self.next() child = children.pop(0) if self.recurse(child): self.state.append((child, self.children(child))) return child class ModuleScanner(Scanner): """An interruptible scanner that searches module synopses.""" def __init__(self): roots = map(lambda dir: (dir, ''), pathdirs()) Scanner.__init__(self, roots, self.submodules, self.ispackage) def submodules(self, (dir, package)): children = [] for file in os.listdir(dir): path = os.path.join(dir, file) if ispackage(path): children.append((path, package + (package and '.') + file)) else: children.append((path, package)) children.sort() return children def ispackage(self, (dir, package)): return ispackage(dir) def run(self, key, callback, completer=None): self.quit = 0 seen = {} for modname in sys.builtin_module_names: seen[modname] = 1 desc = split(__import__(modname).__doc__ or '', '\n')[0] if find(lower(modname + ' - ' + desc), lower(key)) >= 0: callback(None, modname, desc) while not self.quit: node = self.next() if not node: break path, package = node modname = modulename(path) if os.path.isfile(path) and modname: modname = package + (package and '.') + modname if not seen.has_key(modname): seen[modname] = 1 desc = synopsis(path) or '' if find(lower(modname + ' - ' + desc), lower(key)) >= 0: callback(path, modname, desc) if completer: completer() | def man(key): """Display documentation on an object in a form similar to man(1).""" path, object = locate(key) if object: title = 'Python Library Documentation: ' + describe(object) if path: title = title + ' in ' + path pager('\n' + title + '\n\n' + text.document(object)) found = 1 else: print 'could not find or import %s' % repr(key) | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
key = lower(key) for module in sys.builtin_module_names: desc = __import__(module).__doc__ or '' desc = split(desc, '\n')[0] if find(lower(module + ' ' + desc), key) >= 0: print module, '-', desc or '(no description)' modules = [] for dir in pathdirs(): for module, desc in index(dir): desc = desc or '' if module not in modules: modules.append(module) if find(lower(module + ' ' + desc), key) >= 0: desc = desc or '(no description)' if module[-9:] == '.__init__': print module[:-9], '(package) -', desc else: print module, '-', desc | def callback(path, modname, desc): if modname[-9:] == '.__init__': modname = modname[:-9] + ' (package)' print modname, '-', desc or '(no description)' ModuleScanner().run(key, callback) | def apropos(key): """Print all the one-line module summaries that contain a substring.""" key = lower(key) for module in sys.builtin_module_names: desc = __import__(module).__doc__ or '' desc = split(desc, '\n')[0] if find(lower(module + ' ' + desc), key) >= 0: print module, '-', desc or '(no description)' modules = [] for dir in pathdirs(): for module, desc in index(dir): desc = desc or '' if module not in modules: modules.append(module) if find(lower(module + ' ' + desc), key) >= 0: desc = desc or '(no description)' if module[-9:] == '.__init__': print module[:-9], '(package) -', desc else: print module, '-', desc | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
def serve(address, callback=None): import BaseHTTPServer, mimetools | def serve(port, callback=None): import BaseHTTPServer, mimetools, select | def serve(address, callback=None): import BaseHTTPServer, mimetools # Patch up mimetools.Message so it doesn't break if rfc822 is reloaded. class Message(mimetools.Message): def __init__(self, fp, seekable=1): Message = self.__class__ Message.__bases__[0].__bases__[0].__init__(self, fp, seekable) self.encodingheader = self.getheader('content-transfer-encoding') self.typeheader = self.getheader('content-type') self.parsetype() self.parseplist() class DocHandler(BaseHTTPServer.BaseHTTPRequestHandler): def send_document(self, title, contents): self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() self.wfile.write( | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() self.wfile.write( '''<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><title>Python: %s</title><body bgcolor=" self.wfile.write(contents) self.wfile.write('</body></html>') | try: self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() self.wfile.write(''' <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><title>Python: %s</title><body bgcolor=" %s </body></html>''' % (title, contents)) except IOError: pass | def send_document(self, title, contents): self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() self.wfile.write( | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
'problem with %s - %s' % (value.filename, value.args))) | 'Problem in %s - %s' % (value.filename, value.args))) | def do_GET(self): path = self.path if path[-5:] == '.html': path = path[:-5] if path[:1] == '/': path = path[1:] if path and path != '.': try: p, x = locate(path) except DocImportError, value: self.send_document(path, html.escape( 'problem with %s - %s' % (value.filename, value.args))) return if x: self.send_document(describe(x), html.document(x)) else: self.send_document(path, | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
'There is no Python module or object named "%s".' % path) | 'No Python documentation found for %s.' % repr(path)) | def do_GET(self): path = self.path if path[-5:] == '.html': path = path[:-5] if path[:1] == '/': path = path[1:] if path and path != '.': try: p, x = locate(path) except DocImportError, value: self.send_document(path, html.escape( 'problem with %s - %s' % (value.filename, value.args))) return if x: self.send_document(describe(x), html.document(x)) else: self.send_document(path, | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
'<br><big><big><strong> ' 'Python: Index of Modules' '</strong></big></big>', ' | '<big><big><strong>Python: Index of Modules</strong></big></big>', ' | def do_GET(self): path = self.path if path[-5:] == '.html': path = path[:-5] if path[:1] == '/': path = path[1:] if path and path != '.': try: p, x = locate(path) except DocImportError, value: self.send_document(path, html.escape( 'problem with %s - %s' % (value.filename, value.args))) return if x: self.send_document(describe(x), html.document(x)) else: self.send_document(path, | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
self.send_document('Index of Modules', heading + join(indices)) | contents = heading + join(indices) + """<p align=right> <small><small><font color=" pydoc</strong> by Ka-Ping Yee <[email protected]></font></small></small>""" self.send_document('Index of Modules', contents) | def do_GET(self): path = self.path if path[-5:] == '.html': path = path[:-5] if path[:1] == '/': path = path[1:] if path and path != '.': try: p, x = locate(path) except DocImportError, value: self.send_document(path, html.escape( 'problem with %s - %s' % (value.filename, value.args))) return if x: self.send_document(describe(x), html.document(x)) else: self.send_document(path, | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
def __init__(self, address, callback): | def __init__(self, port, callback): self.address = ('127.0.0.1', port) self.url = 'http://127.0.0.1:%d/' % port | def __init__(self, address, callback): self.callback = callback self.base.__init__(self, address, self.handler) | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
self.base.__init__(self, address, self.handler) | self.base.__init__(self, self.address, self.handler) def serve_until_quit(self): import select self.quit = 0 while not self.quit: rd, wr, ex = select.select([self.socket.fileno()], [], [], 1) if rd: self.handle_request() | def __init__(self, address, callback): self.callback = callback self.base.__init__(self, address, self.handler) | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
if self.callback: self.callback() | if self.callback: self.callback(self) | def server_activate(self): self.base.server_activate(self) if self.callback: self.callback() | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
DocServer(address, callback).serve_forever() | DocServer(port, callback).serve_until_quit() except (KeyboardInterrupt, select.error): pass print 'server stopped' def gui(): """Graphical interface (starts web server and pops up a control window).""" class GUI: def __init__(self, window, port=7464): self.window = window self.server = None self.scanner = None import Tkinter self.server_frm = Tkinter.Frame(window) self.title_lbl = Tkinter.Label(self.server_frm, text='Starting server...\n ') self.open_btn = Tkinter.Button(self.server_frm, text='open browser', command=self.open, state='disabled') self.quit_btn = Tkinter.Button(self.server_frm, text='quit serving', command=self.quit, state='disabled') self.search_frm = Tkinter.Frame(window) self.search_lbl = Tkinter.Label(self.search_frm, text='Search for') self.search_ent = Tkinter.Entry(self.search_frm) self.search_ent.bind('<Return>', self.search) self.stop_btn = Tkinter.Button(self.search_frm, text='stop', pady=0, command=self.stop, state='disabled') if sys.platform == 'win32': self.stop_btn.pack(side='right') self.window.title('pydoc') self.window.protocol('WM_DELETE_WINDOW', self.quit) self.title_lbl.pack(side='top', fill='x') self.open_btn.pack(side='left', fill='x', expand=1) self.quit_btn.pack(side='right', fill='x', expand=1) self.server_frm.pack(side='top', fill='x') self.search_lbl.pack(side='left') self.search_ent.pack(side='right', fill='x', expand=1) self.search_frm.pack(side='top', fill='x') self.search_ent.focus_set() self.result_lst = Tkinter.Listbox(window, font=('helvetica', 8), height=6) self.result_lst.bind('<Button-1>', self.select) self.result_lst.bind('<Double-Button-1>', self.goto) self.result_scr = Tkinter.Scrollbar(window, orient='vertical', command=self.result_lst.yview) self.result_lst.config(yscrollcommand=self.result_scr.set) self.result_frm = Tkinter.Frame(window) self.goto_btn = Tkinter.Button(self.result_frm, text='go to selected', command=self.goto) self.hide_btn = Tkinter.Button(self.result_frm, text='hide results', command=self.hide) self.goto_btn.pack(side='left', fill='x', expand=1) self.hide_btn.pack(side='right', fill='x', expand=1) self.window.update() self.minwidth = self.window.winfo_width() self.minheight = self.window.winfo_height() self.bigminheight = (self.server_frm.winfo_reqheight() + self.search_frm.winfo_reqheight() + self.result_lst.winfo_reqheight() + self.result_frm.winfo_reqheight()) self.bigwidth, self.bigheight = self.minwidth, self.bigminheight self.expanded = 0 self.window.wm_geometry('%dx%d' % (self.minwidth, self.minheight)) self.window.wm_minsize(self.minwidth, self.minheight) import threading threading.Thread(target=serve, args=(port, self.ready)).start() def ready(self, server): self.server = server self.title_lbl.config( text='Python documentation server at\n' + server.url) self.open_btn.config(state='normal') self.quit_btn.config(state='normal') def open(self, event=None): import webbrowser webbrowser.open(self.server.url) def quit(self, event=None): if self.server: self.server.quit = 1 self.window.quit() def search(self, event=None): key = self.search_ent.get() self.stop_btn.pack(side='right') self.stop_btn.config(state='normal') self.search_lbl.config(text='Searching for "%s"...' % key) self.search_ent.forget() self.search_lbl.pack(side='left') self.result_lst.delete(0, 'end') self.goto_btn.config(state='disabled') self.expand() import threading if self.scanner: self.scanner.quit = 1 self.scanner = ModuleScanner() threading.Thread(target=self.scanner.run, args=(key, self.update, self.done)).start() def update(self, path, modname, desc): if modname[-9:] == '.__init__': modname = modname[:-9] + ' (package)' self.result_lst.insert('end', modname + ' - ' + (desc or '(no description)')) def stop(self, event=None): if self.scanner: self.scanner.quit = 1 self.scanner = None def done(self): self.scanner = None self.search_lbl.config(text='Search for') self.search_lbl.pack(side='left') self.search_ent.pack(side='right', fill='x', expand=1) if sys.platform != 'win32': self.stop_btn.forget() self.stop_btn.config(state='disabled') def select(self, event=None): self.goto_btn.config(state='normal') def goto(self, event=None): selection = self.result_lst.curselection() if selection: import webbrowser modname = split(self.result_lst.get(selection[0]))[0] webbrowser.open(self.server.url + modname + '.html') def collapse(self): if not self.expanded: return self.result_frm.forget() self.result_scr.forget() self.result_lst.forget() self.bigwidth = self.window.winfo_width() self.bigheight = self.window.winfo_height() self.window.wm_geometry('%dx%d' % (self.minwidth, self.minheight)) self.window.wm_minsize(self.minwidth, self.minheight) self.expanded = 0 def expand(self): if self.expanded: return self.result_frm.pack(side='bottom', fill='x') self.result_scr.pack(side='right', fill='y') self.result_lst.pack(side='top', fill='both', expand=1) self.window.wm_geometry('%dx%d' % (self.bigwidth, self.bigheight)) self.window.wm_minsize(self.minwidth, self.bigminheight) self.expanded = 1 def hide(self, event=None): self.stop() self.collapse() import Tkinter try: gui = GUI(Tkinter.Tk()) Tkinter.mainloop() | def server_activate(self): self.base.server_activate(self) if self.callback: self.callback() | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
print 'server stopped' | pass | def server_activate(self): self.base.server_activate(self) if self.callback: self.callback() | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
opts, args = getopt.getopt(sys.argv[1:], 'k:p:w') | if sys.platform in ['mac', 'win', 'win32', 'nt'] and not sys.argv[1:]: gui() return opts, args = getopt.getopt(sys.argv[1:], 'gk:p:w') | def cli(): import getopt class BadUsage: pass try: opts, args = getopt.getopt(sys.argv[1:], 'k:p:w') writing = 0 for opt, val in opts: if opt == '-k': apropos(lower(val)) break if opt == '-p': try: port = int(val) except ValueError: raise BadUsage def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port serve(('127.0.0.1', port), ready) break if opt == '-w': if not args: raise BadUsage writing = 1 else: if args: for arg in args: try: if os.path.isfile(arg): arg = importfile(arg) if writing: if os.path.isdir(arg): writedocs(arg) else: writedoc(arg) else: man(arg) except DocImportError, value: print 'problem in %s - %s' % ( value.filename, value.args) else: if sys.platform in ['mac', 'win', 'win32', 'nt']: # GUI platforms with threading import threading ready = threading.Event() address = ('127.0.0.1', 12346) threading.Thread( target=serve, args=(address, ready.set)).start() ready.wait() import webbrowser webbrowser.open('http://127.0.0.1:12346/') else: raise BadUsage except (getopt.error, BadUsage): print """%s <name> ... Show documentation on something. <name> may be the name of a Python function, module, or package, or a dotted reference to a class or function within a module or module in a package, or the filename of a Python module to import. | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
apropos(lower(val)) break | apropos(val) return | def cli(): import getopt class BadUsage: pass try: opts, args = getopt.getopt(sys.argv[1:], 'k:p:w') writing = 0 for opt, val in opts: if opt == '-k': apropos(lower(val)) break if opt == '-p': try: port = int(val) except ValueError: raise BadUsage def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port serve(('127.0.0.1', port), ready) break if opt == '-w': if not args: raise BadUsage writing = 1 else: if args: for arg in args: try: if os.path.isfile(arg): arg = importfile(arg) if writing: if os.path.isdir(arg): writedocs(arg) else: writedoc(arg) else: man(arg) except DocImportError, value: print 'problem in %s - %s' % ( value.filename, value.args) else: if sys.platform in ['mac', 'win', 'win32', 'nt']: # GUI platforms with threading import threading ready = threading.Event() address = ('127.0.0.1', 12346) threading.Thread( target=serve, args=(address, ready.set)).start() ready.wait() import webbrowser webbrowser.open('http://127.0.0.1:12346/') else: raise BadUsage except (getopt.error, BadUsage): print """%s <name> ... Show documentation on something. <name> may be the name of a Python function, module, or package, or a dotted reference to a class or function within a module or module in a package, or the filename of a Python module to import. | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port serve(('127.0.0.1', port), ready) break | def ready(server): print 'server ready at %s' % server.url serve(port, ready) return | def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
if not args: raise BadUsage | def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
|
else: if args: for arg in args: try: if os.path.isfile(arg): arg = importfile(arg) if writing: if os.path.isdir(arg): writedocs(arg) else: writedoc(arg) else: man(arg) except DocImportError, value: print 'problem in %s - %s' % ( value.filename, value.args) else: if sys.platform in ['mac', 'win', 'win32', 'nt']: import threading ready = threading.Event() address = ('127.0.0.1', 12346) threading.Thread( target=serve, args=(address, ready.set)).start() ready.wait() import webbrowser webbrowser.open('http://127.0.0.1:12346/') else: raise BadUsage | if not args: raise BadUsage for arg in args: try: if find(arg, os.sep) >= 0 and os.path.isfile(arg): arg = importfile(arg) if writing: writedoc(arg) else: man(arg) except DocImportError, value: print 'Problem in %s - %s' % (value.filename, value.args) | def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
print """%s <name> ... Show documentation on something. <name> may be the name of a Python function, module, or package, or a dotted reference to a class or function within a module or module in a package, or the filename of a Python module to import. | cmd = sys.argv[0] print """pydoc - the Python documentation tool %s <name> ... Show text documentation on something. <name> may be the name of a function, module, or package, or a dotted reference to a class or function within a module or module in a package. If <name> contains a '%s', it is used as the path to a Python source file to document. | def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
Search for a keyword in the synopsis lines of all modules. | Search for a keyword in the synopsis lines of all available modules. | def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
%s -w <module> ... Write out the HTML documentation for a module to a file. %s -w <moduledir> Write out the HTML documentation for all modules in the tree under a given directory to files in the current directory. """ % ((sys.argv[0],) * 5) if __name__ == '__main__': cli() | %s -g Pop up a graphical interface for serving and finding documentation. %s -w <name> ... Write out the HTML documentation for a module to a file in the current directory. If <name> contains a '%s', it is treated as a filename. """ % (cmd, os.sep, cmd, cmd, cmd, cmd, os.sep) if __name__ == '__main__': cli() | def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port | 66efbc74811f153a02728942adbbfc549bf10398 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66efbc74811f153a02728942adbbfc549bf10398/pydoc.py |
def find_module(self, name, path): if name in self.excludes: self.msgout(3, "find_module -> Excluded") raise ImportError, name | 773c83be048ae66b7ed5329095d43e3321ac1780 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/773c83be048ae66b7ed5329095d43e3321ac1780/modulefinder.py |
||
import _winreg from _winreg import HKEY_LOCAL_MACHINE try: pathname = _winreg.QueryValueEx(HKEY_LOCAL_MACHINE, \ "Software\\Python\\PythonCore\\%s\\Modules\\%s" % (sys.winver, name)) fp = open(pathname, "rb") stuff = "", "rb", imp.C_EXTENSION return fp, pathname, stuff except _winreg.error: pass | result = _try_registry(name) if result: return result | def find_module(self, name, path): if name in self.excludes: self.msgout(3, "find_module -> Excluded") raise ImportError, name | 773c83be048ae66b7ed5329095d43e3321ac1780 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/773c83be048ae66b7ed5329095d43e3321ac1780/modulefinder.py |
fullurl = unwrap(fullurl) | fullurl = unwrap(toBytes(fullurl)) | def open(self, fullurl, data=None): """Use URLopener().open(file) instead of open(file, 'r').""" fullurl = unwrap(fullurl) if self.tempcache and self.tempcache.has_key(fullurl): filename, headers = self.tempcache[fullurl] fp = open(filename, 'rb') return addinfourl(fp, headers, fullurl) type, url = splittype(fullurl) if not type: type = 'file' if self.proxies.has_key(type): proxy = self.proxies[type] type, proxyhost = splittype(proxy) host, selector = splithost(proxyhost) url = (host, fullurl) # Signal special case to open_*() else: proxy = None name = 'open_' + type self.type = type if '-' in name: # replace - with _ name = string.join(string.split(name, '-'), '_') if not hasattr(self, name): if proxy: return self.open_unknown_proxy(proxy, fullurl, data) else: return self.open_unknown(fullurl, data) try: if data is None: return getattr(self, name)(url) else: return getattr(self, name)(url, data) except socket.error, msg: raise IOError, ('socket error', msg), sys.exc_info()[2] | 1d99433a58c8c69caa734acb884f274663885a17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1d99433a58c8c69caa734acb884f274663885a17/urllib.py |
type, url = splittype(fullurl) if not type: type = 'file' if self.proxies.has_key(type): proxy = self.proxies[type] type, proxyhost = splittype(proxy) | urltype, url = splittype(fullurl) if not urltype: urltype = 'file' if self.proxies.has_key(urltype): proxy = self.proxies[urltype] urltype, proxyhost = splittype(proxy) | def open(self, fullurl, data=None): """Use URLopener().open(file) instead of open(file, 'r').""" fullurl = unwrap(fullurl) if self.tempcache and self.tempcache.has_key(fullurl): filename, headers = self.tempcache[fullurl] fp = open(filename, 'rb') return addinfourl(fp, headers, fullurl) type, url = splittype(fullurl) if not type: type = 'file' if self.proxies.has_key(type): proxy = self.proxies[type] type, proxyhost = splittype(proxy) host, selector = splithost(proxyhost) url = (host, fullurl) # Signal special case to open_*() else: proxy = None name = 'open_' + type self.type = type if '-' in name: # replace - with _ name = string.join(string.split(name, '-'), '_') if not hasattr(self, name): if proxy: return self.open_unknown_proxy(proxy, fullurl, data) else: return self.open_unknown(fullurl, data) try: if data is None: return getattr(self, name)(url) else: return getattr(self, name)(url, data) except socket.error, msg: raise IOError, ('socket error', msg), sys.exc_info()[2] | 1d99433a58c8c69caa734acb884f274663885a17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1d99433a58c8c69caa734acb884f274663885a17/urllib.py |
name = 'open_' + type self.type = type | name = 'open_' + urltype self.type = urltype | def open(self, fullurl, data=None): """Use URLopener().open(file) instead of open(file, 'r').""" fullurl = unwrap(fullurl) if self.tempcache and self.tempcache.has_key(fullurl): filename, headers = self.tempcache[fullurl] fp = open(filename, 'rb') return addinfourl(fp, headers, fullurl) type, url = splittype(fullurl) if not type: type = 'file' if self.proxies.has_key(type): proxy = self.proxies[type] type, proxyhost = splittype(proxy) host, selector = splithost(proxyhost) url = (host, fullurl) # Signal special case to open_*() else: proxy = None name = 'open_' + type self.type = type if '-' in name: # replace - with _ name = string.join(string.split(name, '-'), '_') if not hasattr(self, name): if proxy: return self.open_unknown_proxy(proxy, fullurl, data) else: return self.open_unknown(fullurl, data) try: if data is None: return getattr(self, name)(url) else: return getattr(self, name)(url, data) except socket.error, msg: raise IOError, ('socket error', msg), sys.exc_info()[2] | 1d99433a58c8c69caa734acb884f274663885a17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1d99433a58c8c69caa734acb884f274663885a17/urllib.py |
url = unwrap(url) | url = unwrap(toBytes(url)) | def retrieve(self, url, filename=None, reporthook=None, data=None): """retrieve(url) returns (filename, None) for a local object or (tempfilename, headers) for a remote object.""" url = unwrap(url) if self.tempcache and self.tempcache.has_key(url): return self.tempcache[url] type, url1 = splittype(url) if not filename and (not type or type == 'file'): try: fp = self.open_local_file(url1) hdrs = fp.info() del fp return url2pathname(splithost(url1)[1]), hdrs except IOError, msg: pass fp = self.open(url, data) headers = fp.info() if not filename: import tempfile garbage, path = splittype(url) garbage, path = splithost(path or "") path, garbage = splitquery(path or "") path, garbage = splitattr(path or "") suffix = os.path.splitext(path)[1] filename = tempfile.mktemp(suffix) self.__tempfiles.append(filename) result = filename, headers if self.tempcache is not None: self.tempcache[url] = result tfp = open(filename, 'wb') bs = 1024*8 size = -1 blocknum = 1 if reporthook: if headers.has_key("content-length"): size = int(headers["Content-Length"]) reporthook(0, bs, size) block = fp.read(bs) if reporthook: reporthook(1, bs, size) while block: tfp.write(block) block = fp.read(bs) blocknum = blocknum + 1 if reporthook: reporthook(blocknum, bs, size) fp.close() tfp.close() del fp del tfp return result | 1d99433a58c8c69caa734acb884f274663885a17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1d99433a58c8c69caa734acb884f274663885a17/urllib.py |
if type(url) is type(""): | if type(url) is types.StringType: | def open_http(self, url, data=None): """Use HTTP protocol.""" import httplib user_passwd = None if type(url) is type(""): host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest user_passwd = None if string.lower(urltype) != 'http': realhost = None else: realhost, rest = splithost(rest) if realhost: user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) #print "proxy via http:", host, selector if not host: raise IOError, ('http error', 'no host given') if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) else: auth = None h = httplib.HTTP(host) if data is not None: h.putrequest('POST', selector) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', selector) if auth: h.putheader('Authorization', 'Basic %s' % auth) if realhost: h.putheader('Host', realhost) for args in self.addheaders: apply(h.putheader, args) h.endheaders() if data is not None: h.send(data + '\r\n') errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, "http:" + url) else: if data is None: return self.http_error(url, fp, errcode, errmsg, headers) else: return self.http_error(url, fp, errcode, errmsg, headers, data) | 1d99433a58c8c69caa734acb884f274663885a17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1d99433a58c8c69caa734acb884f274663885a17/urllib.py |
if type(url) is type(""): | if type(url) in types.StringTypes: | def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib user_passwd = None if type(url) is type(""): host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest user_passwd = None if string.lower(urltype) != 'https': realhost = None else: realhost, rest = splithost(rest) if realhost: user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) #print "proxy via https:", host, selector if not host: raise IOError, ('https error', 'no host given') if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) else: auth = None h = httplib.HTTPS(host, 0, key_file=self.key_file, cert_file=self.cert_file) if data is not None: h.putrequest('POST', selector) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', selector) if auth: h.putheader('Authorization: Basic %s' % auth) if realhost: h.putheader('Host', realhost) for args in self.addheaders: apply(h.putheader, args) h.endheaders() if data is not None: h.send(data + '\r\n') errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, url) else: if data is None: return self.http_error(url, fp, errcode, errmsg, headers) else: return self.http_error(url, fp, errcode, errmsg, headers, data) | 1d99433a58c8c69caa734acb884f274663885a17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1d99433a58c8c69caa734acb884f274663885a17/urllib.py |
ref = Res.FSpOpenResFile(dst, 1) | ref = Res.FSpOpenResFile(dst, 2) | def buildone(template, wrapper, src, dst): buildtools.process(template, wrapper, dst, 1) # write source as a PYC resource into dst ref = Res.FSpOpenResFile(dst, 1) try: Res.UseResFile(ref) py_resource.frompyfile(src, "CGI_MAIN", preload=1) finally: Res.CloseResFile(ref) | c72d4cddc989a66da1f56f59bc3fc7c37df28915 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c72d4cddc989a66da1f56f59bc3fc7c37df28915/BuildCGIApplet.py |
cmdclass = {'build_ext':PyBuildExt}, | cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall}, | def main(): setup(name = 'Python standard library', version = '%d.%d' % sys.version_info[:2], cmdclass = {'build_ext':PyBuildExt}, # The struct module is defined here, because build_ext won't be # called unless there's at least one extension module defined. ext_modules=[Extension('struct', ['structmodule.c'])], # Scripts to install scripts = ['Tools/scripts/pydoc'] ) | f52d27e52d289b99837b4555fb3f757f2c89f4ad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f52d27e52d289b99837b4555fb3f757f2c89f4ad/setup.py |
vereq(x.a, None) | verify(not hasattr(x, "a")) | def slots(): if verbose: print "Testing __slots__..." class C0(object): __slots__ = [] x = C0() verify(not hasattr(x, "__dict__")) verify(not hasattr(x, "foo")) class C1(object): __slots__ = ['a'] x = C1() verify(not hasattr(x, "__dict__")) vereq(x.a, None) x.a = 1 vereq(x.a, 1) del x.a vereq(x.a, None) class C3(object): __slots__ = ['a', 'b', 'c'] x = C3() verify(not hasattr(x, "__dict__")) verify(x.a is None) verify(x.b is None) verify(x.c is None) x.a = 1 x.b = 2 x.c = 3 vereq(x.a, 1) vereq(x.b, 2) vereq(x.c, 3) | 6b70599450777a8b911f0eff44b18cd22f1c1e1e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6b70599450777a8b911f0eff44b18cd22f1c1e1e/test_descr.py |
vereq(x.a, None) | verify(not hasattr(x, "a")) | def slots(): if verbose: print "Testing __slots__..." class C0(object): __slots__ = [] x = C0() verify(not hasattr(x, "__dict__")) verify(not hasattr(x, "foo")) class C1(object): __slots__ = ['a'] x = C1() verify(not hasattr(x, "__dict__")) vereq(x.a, None) x.a = 1 vereq(x.a, 1) del x.a vereq(x.a, None) class C3(object): __slots__ = ['a', 'b', 'c'] x = C3() verify(not hasattr(x, "__dict__")) verify(x.a is None) verify(x.b is None) verify(x.c is None) x.a = 1 x.b = 2 x.c = 3 vereq(x.a, 1) vereq(x.b, 2) vereq(x.c, 3) | 6b70599450777a8b911f0eff44b18cd22f1c1e1e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6b70599450777a8b911f0eff44b18cd22f1c1e1e/test_descr.py |
verify(x.a is None) verify(x.b is None) verify(x.c is None) | verify(not hasattr(x, 'a')) verify(not hasattr(x, 'b')) verify(not hasattr(x, 'c')) | def slots(): if verbose: print "Testing __slots__..." class C0(object): __slots__ = [] x = C0() verify(not hasattr(x, "__dict__")) verify(not hasattr(x, "foo")) class C1(object): __slots__ = ['a'] x = C1() verify(not hasattr(x, "__dict__")) vereq(x.a, None) x.a = 1 vereq(x.a, 1) del x.a vereq(x.a, None) class C3(object): __slots__ = ['a', 'b', 'c'] x = C3() verify(not hasattr(x, "__dict__")) verify(x.a is None) verify(x.b is None) verify(x.c is None) x.a = 1 x.b = 2 x.c = 3 vereq(x.a, 1) vereq(x.b, 2) vereq(x.c, 3) | 6b70599450777a8b911f0eff44b18cd22f1c1e1e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6b70599450777a8b911f0eff44b18cd22f1c1e1e/test_descr.py |
self.saved_dbc_key = c.current(0,0,0)[0] | try: self.saved_dbc_key = c.current(0,0,0)[0] except db.DBError: pass | def _closeCursors(self, save=1): if self.dbc: c = self.dbc self.dbc = None if save: self.saved_dbc_key = c.current(0,0,0)[0] c.close() del c for cref in self._cursor_refs.values(): c = cref() if c is not None: c.close() | a223d2cb29a27ea25632cfe695401a4ced96ca06 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a223d2cb29a27ea25632cfe695401a4ced96ca06/__init__.py |
if not __debug__: expected = [ev for ev in expected if ev[0] != LINE] | def check_events(self, expected): events = self.get_events_wotime() if not __debug__: # Running under -O, so we don't get LINE events expected = [ev for ev in expected if ev[0] != LINE] if events != expected: self.fail( "events did not match expectation; got:\n%s\nexpected:\n%s" % (pprint.pformat(events), pprint.pformat(expected))) | 80703c89308a2adbdece4c8c044e7ba4d3069f91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/80703c89308a2adbdece4c8c044e7ba4d3069f91/test_hotshot.py |
|
"'ascii' codec can't encode character '\\xfc' in position 1: ouch" | "'ascii' codec can't encode character u'\\xfc' in position 1: ouch" | def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\u0100x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\u0100' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\uffffx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\uffff' in position 0: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\U00010000x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\U00010000' in position 0: ouch" ) | a54b92b2ebcbaaa4b7f77ff411a73a820522a67b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a54b92b2ebcbaaa4b7f77ff411a73a820522a67b/test_codeccallbacks.py |
"'ascii' codec can't encode character '\\xfc' in position 0: ouch" | "'ascii' codec can't encode character u'\\xfc' in position 0: ouch" | def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\u0100x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\u0100' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\uffffx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\uffff' in position 0: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\U00010000x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\U00010000' in position 0: ouch" ) | a54b92b2ebcbaaa4b7f77ff411a73a820522a67b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a54b92b2ebcbaaa4b7f77ff411a73a820522a67b/test_codeccallbacks.py |
"'ascii' codec can't encode character '\\u0100' in position 0: ouch" | "'ascii' codec can't encode character u'\\u0100' in position 0: ouch" | def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\u0100x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\u0100' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\uffffx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\uffff' in position 0: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\U00010000x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\U00010000' in position 0: ouch" ) | a54b92b2ebcbaaa4b7f77ff411a73a820522a67b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a54b92b2ebcbaaa4b7f77ff411a73a820522a67b/test_codeccallbacks.py |
"'ascii' codec can't encode character '\\uffff' in position 0: ouch" | "'ascii' codec can't encode character u'\\uffff' in position 0: ouch" | def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\u0100x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\u0100' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\uffffx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\uffff' in position 0: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\U00010000x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\U00010000' in position 0: ouch" ) | a54b92b2ebcbaaa4b7f77ff411a73a820522a67b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a54b92b2ebcbaaa4b7f77ff411a73a820522a67b/test_codeccallbacks.py |
"'ascii' codec can't encode character '\\U00010000' in position 0: ouch" | "'ascii' codec can't encode character u'\\U00010000' in position 0: ouch" | def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\u0100x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\u0100' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\uffffx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\uffff' in position 0: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", u"\U00010000x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\U00010000' in position 0: ouch" ) | a54b92b2ebcbaaa4b7f77ff411a73a820522a67b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a54b92b2ebcbaaa4b7f77ff411a73a820522a67b/test_codeccallbacks.py |
"can't translate character '\\xfc' in position 1: ouch" | "can't translate character u'\\xfc' in position 1: ouch" | def test_unicodetranslateerror(self): self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 2, "ouch"], "can't translate character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\u0100rk", 1, 2, "ouch"], "can't translate character '\\u0100' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\uffffrk", 1, 2, "ouch"], "can't translate character '\\uffff' in position 1: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\U00010000rk", 1, 2, "ouch"], "can't translate character '\\U00010000' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 3, "ouch"], "can't translate characters in position 1-2: ouch" ) | a54b92b2ebcbaaa4b7f77ff411a73a820522a67b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a54b92b2ebcbaaa4b7f77ff411a73a820522a67b/test_codeccallbacks.py |
"can't translate character '\\u0100' in position 1: ouch" | "can't translate character u'\\u0100' in position 1: ouch" | def test_unicodetranslateerror(self): self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 2, "ouch"], "can't translate character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\u0100rk", 1, 2, "ouch"], "can't translate character '\\u0100' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\uffffrk", 1, 2, "ouch"], "can't translate character '\\uffff' in position 1: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\U00010000rk", 1, 2, "ouch"], "can't translate character '\\U00010000' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 3, "ouch"], "can't translate characters in position 1-2: ouch" ) | a54b92b2ebcbaaa4b7f77ff411a73a820522a67b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a54b92b2ebcbaaa4b7f77ff411a73a820522a67b/test_codeccallbacks.py |
"can't translate character '\\uffff' in position 1: ouch" | "can't translate character u'\\uffff' in position 1: ouch" | def test_unicodetranslateerror(self): self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 2, "ouch"], "can't translate character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\u0100rk", 1, 2, "ouch"], "can't translate character '\\u0100' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\uffffrk", 1, 2, "ouch"], "can't translate character '\\uffff' in position 1: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\U00010000rk", 1, 2, "ouch"], "can't translate character '\\U00010000' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 3, "ouch"], "can't translate characters in position 1-2: ouch" ) | a54b92b2ebcbaaa4b7f77ff411a73a820522a67b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a54b92b2ebcbaaa4b7f77ff411a73a820522a67b/test_codeccallbacks.py |
"can't translate character '\\U00010000' in position 1: ouch" | "can't translate character u'\\U00010000' in position 1: ouch" | def test_unicodetranslateerror(self): self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 2, "ouch"], "can't translate character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\u0100rk", 1, 2, "ouch"], "can't translate character '\\u0100' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\uffffrk", 1, 2, "ouch"], "can't translate character '\\uffff' in position 1: ouch" ) if sys.maxunicode > 0xffff: self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\U00010000rk", 1, 2, "ouch"], "can't translate character '\\U00010000' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, [u"g\xfcrk", 1, 3, "ouch"], "can't translate characters in position 1-2: ouch" ) | a54b92b2ebcbaaa4b7f77ff411a73a820522a67b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a54b92b2ebcbaaa4b7f77ff411a73a820522a67b/test_codeccallbacks.py |
try: import win32api import win32con except ImportError: | if not _can_read_reg: | def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import win32api import win32con except ImportError: return [] K = 'Software\\Microsoft\\Devstudio' L = [] for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: p = win32api.RegEnumKey(k,i) if p[0] in '123456789' and p not in L: L.append(p) except win32api.error: break i = i + 1 except win32api.error: pass L.sort() L.reverse() return L | 7642f5cf3899d296b111d2a21d531cbd795215fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7642f5cf3899d296b111d2a21d531cbd795215fb/msvccompiler.py |
for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): | for base in (_HKEY_CLASSES_ROOT, _HKEY_LOCAL_MACHINE, _HKEY_CURRENT_USER, _HKEY_USERS): | def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import win32api import win32con except ImportError: return [] K = 'Software\\Microsoft\\Devstudio' L = [] for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: p = win32api.RegEnumKey(k,i) if p[0] in '123456789' and p not in L: L.append(p) except win32api.error: break i = i + 1 except win32api.error: pass L.sort() L.reverse() return L | 7642f5cf3899d296b111d2a21d531cbd795215fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7642f5cf3899d296b111d2a21d531cbd795215fb/msvccompiler.py |
k = win32api.RegOpenKeyEx(base,K) | k = _RegOpenKeyEx(base,K) | def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import win32api import win32con except ImportError: return [] K = 'Software\\Microsoft\\Devstudio' L = [] for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: p = win32api.RegEnumKey(k,i) if p[0] in '123456789' and p not in L: L.append(p) except win32api.error: break i = i + 1 except win32api.error: pass L.sort() L.reverse() return L | 7642f5cf3899d296b111d2a21d531cbd795215fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7642f5cf3899d296b111d2a21d531cbd795215fb/msvccompiler.py |
p = win32api.RegEnumKey(k,i) | p = _RegEnumKey(k,i) | def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import win32api import win32con except ImportError: return [] K = 'Software\\Microsoft\\Devstudio' L = [] for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: p = win32api.RegEnumKey(k,i) if p[0] in '123456789' and p not in L: L.append(p) except win32api.error: break i = i + 1 except win32api.error: pass L.sort() L.reverse() return L | 7642f5cf3899d296b111d2a21d531cbd795215fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7642f5cf3899d296b111d2a21d531cbd795215fb/msvccompiler.py |
except win32api.error: | except _RegError: | def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import win32api import win32con except ImportError: return [] K = 'Software\\Microsoft\\Devstudio' L = [] for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: p = win32api.RegEnumKey(k,i) if p[0] in '123456789' and p not in L: L.append(p) except win32api.error: break i = i + 1 except win32api.error: pass L.sort() L.reverse() return L | 7642f5cf3899d296b111d2a21d531cbd795215fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7642f5cf3899d296b111d2a21d531cbd795215fb/msvccompiler.py |
except win32api.error: | except _RegError: | def get_devstudio_versions (): """Get list of devstudio versions from the Windows registry. Return a list of strings containing version numbers; the list will be empty if we were unable to access the registry (eg. couldn't import a registry-access module) or the appropriate registry keys weren't found.""" try: import win32api import win32con except ImportError: return [] K = 'Software\\Microsoft\\Devstudio' L = [] for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: p = win32api.RegEnumKey(k,i) if p[0] in '123456789' and p not in L: L.append(p) except win32api.error: break i = i + 1 except win32api.error: pass L.sort() L.reverse() return L | 7642f5cf3899d296b111d2a21d531cbd795215fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7642f5cf3899d296b111d2a21d531cbd795215fb/msvccompiler.py |
try: import win32api import win32con except ImportError: | if not _can_read_reg: | def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] if path=='lib': path= 'Library' path = string.upper(path + ' Dirs') K = ('Software\\Microsoft\\Devstudio\\%s\\' + 'Build System\\Components\\Platforms\\Win32 (%s)\\Directories') % \ (version,platform) for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: (p,v,t) = win32api.RegEnumValue(k,i) if string.upper(p) == path: V = string.split(v,';') for v in V: if v == '' or v in L: continue L.append(v) break i = i + 1 except win32api.error: break except win32api.error: pass return L | 7642f5cf3899d296b111d2a21d531cbd795215fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7642f5cf3899d296b111d2a21d531cbd795215fb/msvccompiler.py |
for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): | for base in (_HKEY_CLASSES_ROOT, _HKEY_LOCAL_MACHINE, _HKEY_CURRENT_USER, _HKEY_USERS): | def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] if path=='lib': path= 'Library' path = string.upper(path + ' Dirs') K = ('Software\\Microsoft\\Devstudio\\%s\\' + 'Build System\\Components\\Platforms\\Win32 (%s)\\Directories') % \ (version,platform) for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: (p,v,t) = win32api.RegEnumValue(k,i) if string.upper(p) == path: V = string.split(v,';') for v in V: if v == '' or v in L: continue L.append(v) break i = i + 1 except win32api.error: break except win32api.error: pass return L | 7642f5cf3899d296b111d2a21d531cbd795215fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7642f5cf3899d296b111d2a21d531cbd795215fb/msvccompiler.py |
k = win32api.RegOpenKeyEx(base,K) | k = _RegOpenKeyEx(base,K) | def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] if path=='lib': path= 'Library' path = string.upper(path + ' Dirs') K = ('Software\\Microsoft\\Devstudio\\%s\\' + 'Build System\\Components\\Platforms\\Win32 (%s)\\Directories') % \ (version,platform) for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: (p,v,t) = win32api.RegEnumValue(k,i) if string.upper(p) == path: V = string.split(v,';') for v in V: if v == '' or v in L: continue L.append(v) break i = i + 1 except win32api.error: break except win32api.error: pass return L | 7642f5cf3899d296b111d2a21d531cbd795215fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7642f5cf3899d296b111d2a21d531cbd795215fb/msvccompiler.py |
(p,v,t) = win32api.RegEnumValue(k,i) | (p,v,t) = _RegEnumValue(k,i) | def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] if path=='lib': path= 'Library' path = string.upper(path + ' Dirs') K = ('Software\\Microsoft\\Devstudio\\%s\\' + 'Build System\\Components\\Platforms\\Win32 (%s)\\Directories') % \ (version,platform) for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: (p,v,t) = win32api.RegEnumValue(k,i) if string.upper(p) == path: V = string.split(v,';') for v in V: if v == '' or v in L: continue L.append(v) break i = i + 1 except win32api.error: break except win32api.error: pass return L | 7642f5cf3899d296b111d2a21d531cbd795215fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7642f5cf3899d296b111d2a21d531cbd795215fb/msvccompiler.py |
except win32api.error: | except _RegError: | def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] if path=='lib': path= 'Library' path = string.upper(path + ' Dirs') K = ('Software\\Microsoft\\Devstudio\\%s\\' + 'Build System\\Components\\Platforms\\Win32 (%s)\\Directories') % \ (version,platform) for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: (p,v,t) = win32api.RegEnumValue(k,i) if string.upper(p) == path: V = string.split(v,';') for v in V: if v == '' or v in L: continue L.append(v) break i = i + 1 except win32api.error: break except win32api.error: pass return L | 7642f5cf3899d296b111d2a21d531cbd795215fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7642f5cf3899d296b111d2a21d531cbd795215fb/msvccompiler.py |
except win32api.error: | except _RegError: | def get_msvc_paths (path, version='6.0', platform='x86'): """Get a list of devstudio directories (include, lib or path). Return a list of strings; will be empty list if unable to access the registry or appropriate registry keys not found.""" try: import win32api import win32con except ImportError: return [] L = [] if path=='lib': path= 'Library' path = string.upper(path + ' Dirs') K = ('Software\\Microsoft\\Devstudio\\%s\\' + 'Build System\\Components\\Platforms\\Win32 (%s)\\Directories') % \ (version,platform) for base in (win32con.HKEY_CLASSES_ROOT, win32con.HKEY_LOCAL_MACHINE, win32con.HKEY_CURRENT_USER, win32con.HKEY_USERS): try: k = win32api.RegOpenKeyEx(base,K) i = 0 while 1: try: (p,v,t) = win32api.RegEnumValue(k,i) if string.upper(p) == path: V = string.split(v,';') for v in V: if v == '' or v in L: continue L.append(v) break i = i + 1 except win32api.error: break except win32api.error: pass return L | 7642f5cf3899d296b111d2a21d531cbd795215fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7642f5cf3899d296b111d2a21d531cbd795215fb/msvccompiler.py |
def makefile(self, mode): | def makefile(self, mode, bufsize=None): """Return a readable file-like object with data from socket. This method offers only partial support for the makefile interface of a real socket. It only supports modes 'r' and 'rb' and the bufsize argument is ignored. The returned object contains *all* of the file data """ | def makefile(self, mode): # hopefully, never have to write if mode != 'r' and mode != 'rb': raise UnimplementedFileMode() | 4d746fca3d7f4f5008ec8b0e02c78a2936cddba7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4d746fca3d7f4f5008ec8b0e02c78a2936cddba7/httplib.py |
print >> sys.stderr, _(__doc__) % globals() | print >> sys.stderr, __doc__ % globals() | def usage(code, msg=''): print >> sys.stderr, _(__doc__) % globals() if msg: print >> sys.stderr, msg sys.exit(code) | 0d1fdea8efc48560d90374d8b785aee26ae82b70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0d1fdea8efc48560d90374d8b785aee26ae82b70/pygettext.py |
elif ttype not in [tokenize.COMMENT, token.INDENT, token.DEDENT, token.NEWLINE, tokenize.NL]: print >>sys.stderr, _('*** %(file)s:%(lineno)s: Seen unexpected token "%(token)s"') % { 'token': tstring, 'file': self.__curfile, 'lineno': self.__lineno} self.__state = self.__waiting | def __openseen(self, ttype, tstring, lineno): if ttype == tokenize.OP and tstring == ')': # We've seen the last of the translatable strings. Record the # line number of the first line of the strings and update the list # of messages seen. Reset state for the next batch. If there # were no strings inside _(), then just ignore this entry. if self.__data: self.__addentry(EMPTYSTRING.join(self.__data)) self.__state = self.__waiting elif ttype == tokenize.STRING: self.__data.append(safe_eval(tstring)) # TBD: should we warn if we seen anything else? | 0d1fdea8efc48560d90374d8b785aee26ae82b70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0d1fdea8efc48560d90374d8b785aee26ae82b70/pygettext.py |
|
vr = 0, 0, r[2]-r[0]-15, r[3]-r[1]-15 dr = (0, 0, vr[2], 0) | x0, y0, x1, y1 = self.wid.GetWindowPort().portRect x0 = x0 + 4 y0 = y0 + 4 x1 = x1 - 20 y1 = y1 - 20 vr = dr = x0, y0, x1, y1 | def open(self, path, name, data): self.path = path self.name = name r = windowbounds(400, 400) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w vr = 0, 0, r[2]-r[0]-15, r[3]-r[1]-15 dr = (0, 0, vr[2], 0) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(dr, vr) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() self.scrollbars() self.changed = 0 self.do_postopen() self.do_activate(1, None) | ee8662febda4ac1ee9d3604e452220554c08ab23 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ee8662febda4ac1ee9d3604e452220554c08ab23/ped.py |
self.socket.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1) | self.set_reuse_addr() | def __init__(self, localaddr, remoteaddr): self._localaddr = localaddr self._remoteaddr = remoteaddr asyncore.dispatcher.__init__(self) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) # try to re-use a server port if possible self.socket.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1) self.bind(localaddr) self.listen(5) print >> DEBUGSTREAM, \ '%s started at %s\n\tLocal addr: %s\n\tRemote addr:%s' % ( self.__class__.__name__, time.ctime(time.time()), localaddr, remoteaddr) | 93a6327adff7274cbfb47f3b8c73970f0605e787 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/93a6327adff7274cbfb47f3b8c73970f0605e787/smtpd.py |
def read(self, size=-1, chars=-1): | def read(self, size=-1, chars=-1, firstline=False): | def read(self, size=-1, chars=-1): | 56066d2e554b6b92375d3e276f2f02663526c087 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/56066d2e554b6b92375d3e276f2f02663526c087/codecs.py |
newchars, decodedbytes = self.decode(data, self.errors) | try: newchars, decodedbytes = self.decode(data, self.errors) except UnicodeDecodeError, exc: if firstline: newchars, decodedbytes = self.decode(data[:exc.start], self.errors) lines = newchars.splitlines(True) if len(lines)<=1: raise else: raise | def read(self, size=-1, chars=-1): | 56066d2e554b6b92375d3e276f2f02663526c087 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/56066d2e554b6b92375d3e276f2f02663526c087/codecs.py |
data = self.read(readsize) | data = self.read(readsize, firstline=True) | def readline(self, size=None, keepends=True): | 56066d2e554b6b92375d3e276f2f02663526c087 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/56066d2e554b6b92375d3e276f2f02663526c087/codecs.py |
(ccshared,opt) = sysconfig.get_config_vars('CCSHARED','OPT') args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared | (ccshared,opt,base) = sysconfig.get_config_vars('CCSHARED','OPT','BASECFLAGS') args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared + ' ' + base | def build_extensions(self): | decc6a47df823a988845d3753a4cfb7a85b80828 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/decc6a47df823a988845d3753a4cfb7a85b80828/setup.py |
user_passwd, host = splituser(host) | if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host | def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) else: host, selector = url urltype, rest = splittype(selector) if string.lower(urltype) == 'https': realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) #print "proxy via https:", host, selector if not host: raise IOError, ('https error', 'no host given') if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) else: auth = None h = httplib.HTTPS(host, 0, key_file=self.key_file, cert_file=self.cert_file) if data is not None: h.putrequest('POST', selector) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', selector) if auth: h.putheader('Authorization: Basic %s' % auth) for args in self.addheaders: apply(h.putheader, args) h.endheaders() if data is not None: h.send(data + '\r\n') errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, url) else: return self.http_error(url, fp, errcode, errmsg, headers) | 567ca8e732a75682adfdca08daaf2afa59582ad9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/567ca8e732a75682adfdca08daaf2afa59582ad9/urllib.py |
if string.lower(urltype) == 'https': | url = rest user_passwd = None if string.lower(urltype) != 'https': realhost = None else: | def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) else: host, selector = url urltype, rest = splittype(selector) if string.lower(urltype) == 'https': realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) #print "proxy via https:", host, selector if not host: raise IOError, ('https error', 'no host given') if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) else: auth = None h = httplib.HTTPS(host, 0, key_file=self.key_file, cert_file=self.cert_file) if data is not None: h.putrequest('POST', selector) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', selector) if auth: h.putheader('Authorization: Basic %s' % auth) for args in self.addheaders: apply(h.putheader, args) h.endheaders() if data is not None: h.send(data + '\r\n') errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, url) else: return self.http_error(url, fp, errcode, errmsg, headers) | 567ca8e732a75682adfdca08daaf2afa59582ad9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/567ca8e732a75682adfdca08daaf2afa59582ad9/urllib.py |
user_passwd, realhost = splituser(realhost) | if realhost: user_passwd, realhost = splituser(realhost) | def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) else: host, selector = url urltype, rest = splittype(selector) if string.lower(urltype) == 'https': realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) #print "proxy via https:", host, selector if not host: raise IOError, ('https error', 'no host given') if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) else: auth = None h = httplib.HTTPS(host, 0, key_file=self.key_file, cert_file=self.cert_file) if data is not None: h.putrequest('POST', selector) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', selector) if auth: h.putheader('Authorization: Basic %s' % auth) for args in self.addheaders: apply(h.putheader, args) h.endheaders() if data is not None: h.send(data + '\r\n') errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, url) else: return self.http_error(url, fp, errcode, errmsg, headers) | 567ca8e732a75682adfdca08daaf2afa59582ad9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/567ca8e732a75682adfdca08daaf2afa59582ad9/urllib.py |
return self.http_error(url, fp, errcode, errmsg, headers) | if data is None: return self.http_error(url, fp, errcode, errmsg, headers) else: return self.http_error(url, fp, errcode, errmsg, headers, data) | def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) else: host, selector = url urltype, rest = splittype(selector) if string.lower(urltype) == 'https': realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) #print "proxy via https:", host, selector if not host: raise IOError, ('https error', 'no host given') if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) else: auth = None h = httplib.HTTPS(host, 0, key_file=self.key_file, cert_file=self.cert_file) if data is not None: h.putrequest('POST', selector) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', selector) if auth: h.putheader('Authorization: Basic %s' % auth) for args in self.addheaders: apply(h.putheader, args) h.endheaders() if data is not None: h.send(data + '\r\n') errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, url) else: return self.http_error(url, fp, errcode, errmsg, headers) | 567ca8e732a75682adfdca08daaf2afa59582ad9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/567ca8e732a75682adfdca08daaf2afa59582ad9/urllib.py |
if match: return match.group(1, 2) | if match: return map(unquote, match.group(1, 2)) | def splituser(host): """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" global _userprog if _userprog is None: import re _userprog = re.compile('^([^@]*)@(.*)$') match = _userprog.match(host) if match: return match.group(1, 2) return None, host | 567ca8e732a75682adfdca08daaf2afa59582ad9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/567ca8e732a75682adfdca08daaf2afa59582ad9/urllib.py |
r.append(name, value) | r.append((name, value)) | def parse_qsl(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. Returns a list, as God intended. """ name_value_pairs = string.splitfields(qs, '&') r=[] 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], '+', ' ')) r.append(name, value) return r | 3af7b050a33b4d22260c01ce6b6700e1159edce0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3af7b050a33b4d22260c01ce6b6700e1159edce0/cgi.py |
def randrange(n): """Return a random shuffle of range(n).""" | def randfloats(n): """Return a list of n random floats in [0, 1).""" | def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
result = [] for i in range(n): result.append(random.random()) | r = random.random result = [r() for i in xrange(n)] | def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
||
i = random.randrange(0, n) | i = random.randrange(n) | def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
result[len(result):] = temp | result.extend(temp) | def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
def fl(): | def flush(): | def fl(): sys.stdout.flush() | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
fl() | flush() | def doit(L): t0 = time.clock() L.sort() t1 = time.clock() print "%6.2f" % (t1-t0), fl() | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
-sort: all equal | =sort: all equal | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) | cases = ("*sort", "\\sort", "/sort", "~sort", "=sort", "!sort") fmt = ("%2s %7s" + " %6s"*len(cases)) | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
n = 1<<i L = randrange(n) print "%2d %6d" % (i, n), fl() | n = 1 << i L = randfloats(n) print "%2d %7d" % (i, n), flush() | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
L = L*(n/4) | L = L * (n // 4) | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
L = map(abs, [-0.5]*n) doit(L) L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) | L = map(abs, [-0.5] * n) doit(L) del L half = n // 2 L = range(half - 1, -1, -1) L.extend(range(half)) L = map(float, L) | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
k2 = 19 | k2 = 20 | def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys.argv[2:]: # two arguments: specify range k2 = int(sys.argv[2]) if sys.argv[3:]: # derive random seed from remaining arguments x, y, z = 0, 0, 0 for a in sys.argv[3:]: h = hash(a) h, d = divmod(h, 256) h = h & 0xffffff x = (x^h^d) & 255 h = h>>8 y = (y^h^d) & 255 h = h>>8 z = (z^h^d) & 255 whrandom.seed(x, y, z) r = range(k1, k2+1) # include the end point tabulate(r) | 8b6ec79b74284873696b24ab979fb1cb579b86f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b6ec79b74284873696b24ab979fb1cb579b86f8/sortperf.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.