rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
x, y, z = 0, 0, 0
x = 1
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
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)
x = 69069 * x + hash(a) random.seed(x)
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
displayname = linkname = name = cgi.escape(name)
displayname = linkname = name
def list_directory(self, path): """Helper to produce a directory listing (absent index.html).
6d63a8dd09a3be6b5afd7a327bf86bca6be6ff0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6d63a8dd09a3be6b5afd7a327bf86bca6be6ff0d/SimpleHTTPServer.py
f.write('<li><a href="%s">%s</a>\n' % (linkname, displayname))
f.write('<li><a href="%s">%s</a>\n' % (urllib.quote(linkname), cgi.escape(displayname)))
def list_directory(self, path): """Helper to produce a directory listing (absent index.html).
6d63a8dd09a3be6b5afd7a327bf86bca6be6ff0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6d63a8dd09a3be6b5afd7a327bf86bca6be6ff0d/SimpleHTTPServer.py
def join(a, *p): """Join two or more pathname components, inserting "\\" as needed""" path = a for b in p: if isabs(b): path = b elif path == '' or path[-1:] in '/\\': path = path + b else: path = path + os.sep + b return path
f3c695c4675e61d5c303c96db699184253810306 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f3c695c4675e61d5c303c96db699184253810306/ntpath.py
"""Split a pathname into drive and path specifiers. Return a 2-tuple (drive, path); either part may be empty. This recognizes UNC paths (e.g. '\\\\host\\mountpoint\\dir\\file')"""
"""Split a pathname into drive and path specifiers. Returns a 2-tuple "(drive,path)"; either part may be empty"""
def splitdrive(p): """Split a pathname into drive and path specifiers. Return a 2-tuple (drive, path); either part may be empty. This recognizes UNC paths (e.g. '\\\\host\\mountpoint\\dir\\file')""" if p[1:2] == ':': return p[0:2], p[2:] firstTwo = p[0:2] if firstTwo == '//' or firstTwo == '\\\\': # is a UNC path: # vvvvvvvvvvvvvvvvvvvv equivalent to drive letter # \\machine\mountpoint\directories... # directory ^^^^^^^^^^^^^^^ normp = normcase(p) index = string.find(normp, '\\', 2) if index == -1: ##raise RuntimeError, 'illegal UNC path: "' + p + '"' return ("", p) index = string.find(normp, '\\', index + 1) if index == -1: index = len(p) return p[:index], p[index:] return '', p
f3c695c4675e61d5c303c96db699184253810306 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f3c695c4675e61d5c303c96db699184253810306/ntpath.py
def isfile(path): """Test whether a path is a regular file""" try: st = os.stat(path) except os.error: return 0 return stat.S_ISREG(st[stat.ST_MODE])
f3c695c4675e61d5c303c96db699184253810306 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f3c695c4675e61d5c303c96db699184253810306/ntpath.py
def send(self, str): """Send `str' to the server.""" if self.sock is None: if self.auto_open: self.connect() else: raise NotConnected()
e3252ec6cf3e590ebec3df1a7d564b42d7e47847 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e3252ec6cf3e590ebec3df1a7d564b42d7e47847/httplib.py
Aassumes that the line does *not* end with \r\n.
Assumes that the line does *not* end with \\r\\n.
def _output(self, s): """Add a line of output to the current request buffer. Aassumes that the line does *not* end with \r\n. """ self._buffer.append(s)
e3252ec6cf3e590ebec3df1a7d564b42d7e47847 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e3252ec6cf3e590ebec3df1a7d564b42d7e47847/httplib.py
Appends an extra \r\n to the buffer.
Appends an extra \\r\\n to the buffer.
def _send_output(self): """Send the currently buffered request and clear the buffer.
e3252ec6cf3e590ebec3df1a7d564b42d7e47847 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e3252ec6cf3e590ebec3df1a7d564b42d7e47847/httplib.py
def splitdrive(p): """Split a pathname into drive and path. On Posix, drive is always empty.""" return '', p
65ad043ea3c331ee41b19746f3a15b19bef2dab1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/65ad043ea3c331ee41b19746f3a15b19bef2dab1/posixpath.py
return split(p)[1]
i = p.rfind('/') + 1 return p[i:]
def basename(p): """Returns the final component of a pathname""" return split(p)[1]
65ad043ea3c331ee41b19746f3a15b19bef2dab1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/65ad043ea3c331ee41b19746f3a15b19bef2dab1/posixpath.py
return split(p)[0]
i = p.rfind('/') + 1 head = p[:i] if head and head != '/'*len(head): head = head.rstrip('/') return head
def dirname(p): """Returns the directory component of a pathname""" return split(p)[0]
65ad043ea3c331ee41b19746f3a15b19bef2dab1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/65ad043ea3c331ee41b19746f3a15b19bef2dab1/posixpath.py
def __init__(self, root, flist, stack=None): self.top = top = ListedToplevel(root) top.protocol("WM_DELETE_WINDOW", self.close) top.bind("<Key-Escape>", self.close) top.wm_title("Stack viewer") top.wm_iconname("Stack") self.helplabel = Label(top, text="Click once to view variables; twice for source", borderwidth=2, relief="groove") self.helplabel.pack(fill="x") self.sv = StackViewer(top, flist, self) if stack is None: stack = get_stack() self.sv.load_stack(stack)
def __init__(self, flist=None): self.flist = flist self.stack = get_stack() self.text = get_exception()
def __init__(self, root, flist, stack=None): self.top = top = ListedToplevel(root) top.protocol("WM_DELETE_WINDOW", self.close) top.bind("<Key-Escape>", self.close) top.wm_title("Stack viewer") top.wm_iconname("Stack") # Create help label self.helplabel = Label(top, text="Click once to view variables; twice for source", borderwidth=2, relief="groove") self.helplabel.pack(fill="x") # self.sv = StackViewer(top, flist, self) if stack is None: stack = get_stack() self.sv.load_stack(stack)
b6584698733766b2028decd435ed2160f3557124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b6584698733766b2028decd435ed2160f3557124/StackViewer.py
def close(self, event=None): self.top.destroy()
def GetText(self): return self.text
def close(self, event=None): self.top.destroy()
b6584698733766b2028decd435ed2160f3557124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b6584698733766b2028decd435ed2160f3557124/StackViewer.py
localsframe = None localsviewer = None localsdict = None globalsframe = None globalsviewer = None globalsdict = None curframe = None
def GetSubList(self): sublist = [] for info in self.stack: item = FrameTreeItem(info, self.flist) sublist.append(item) return sublist
def close(self, event=None): self.top.destroy()
b6584698733766b2028decd435ed2160f3557124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b6584698733766b2028decd435ed2160f3557124/StackViewer.py
def show_frame(self, (frame, lineno)): if frame is self.curframe: return self.curframe = None if frame.f_globals is not self.globalsdict: self.show_globals(frame) self.show_locals(frame) self.curframe = frame
class FrameTreeItem(TreeItem):
def show_frame(self, (frame, lineno)): if frame is self.curframe: return self.curframe = None if frame.f_globals is not self.globalsdict: self.show_globals(frame) self.show_locals(frame) self.curframe = frame
b6584698733766b2028decd435ed2160f3557124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b6584698733766b2028decd435ed2160f3557124/StackViewer.py
def show_globals(self, frame): title = "Global Variables" if frame.f_globals.has_key("__name__"): try: name = str(frame.f_globals["__name__"]) + "" except: name = "" if name: title = title + " in module " + name self.globalsdict = None if self.globalsviewer: self.globalsviewer.close() self.globalsviewer = None if not self.globalsframe: self.globalsframe = Frame(self.top) self.globalsdict = frame.f_globals self.globalsviewer = NamespaceViewer( self.globalsframe, title, self.globalsdict) self.globalsframe.pack(fill="both", side="bottom")
def __init__(self, info, flist): self.info = info self.flist = flist
def show_globals(self, frame): title = "Global Variables" if frame.f_globals.has_key("__name__"): try: name = str(frame.f_globals["__name__"]) + "" except: name = "" if name: title = title + " in module " + name self.globalsdict = None if self.globalsviewer: self.globalsviewer.close() self.globalsviewer = None if not self.globalsframe: self.globalsframe = Frame(self.top) self.globalsdict = frame.f_globals self.globalsviewer = NamespaceViewer( self.globalsframe, title, self.globalsdict) self.globalsframe.pack(fill="both", side="bottom")
b6584698733766b2028decd435ed2160f3557124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b6584698733766b2028decd435ed2160f3557124/StackViewer.py
def show_locals(self, frame): self.localsdict = None if self.localsviewer: self.localsviewer.close() self.localsviewer = None if frame.f_locals is not frame.f_globals: title = "Local Variables" code = frame.f_code funcname = code.co_name if funcname not in ("?", "", None): title = title + " in " + funcname if not self.localsframe: self.localsframe = Frame(self.top) self.localsdict = frame.f_locals self.localsviewer = NamespaceViewer( self.localsframe, title, self.localsdict) self.localsframe.pack(fill="both", side="top") else: if self.localsframe: self.localsframe.forget() class StackViewer(ScrolledList): def __init__(self, master, flist, browser): ScrolledList.__init__(self, master, width=80) self.flist = flist self.browser = browser self.stack = [] def load_stack(self, stack, index=None): self.stack = stack self.clear() for i in range(len(stack)): frame, lineno = stack[i] try: modname = frame.f_globals["__name__"] except: modname = "?" code = frame.f_code filename = code.co_filename funcname = code.co_name sourceline = linecache.getline(filename, lineno) sourceline = string.strip(sourceline) if funcname in ("?", "", None): item = "%s, line %d: %s" % (modname, lineno, sourceline) else: item = "%s.%s(), line %d: %s" % (modname, funcname, lineno, sourceline) if i == index: item = "> " + item self.append(item) if index is not None: self.select(index) def popup_event(self, event): if self.stack: return ScrolledList.popup_event(self, event) def fill_menu(self): menu = self.menu menu.add_command(label="Go to source line", command=self.goto_source_line) menu.add_command(label="Show stack frame", command=self.show_stack_frame) def on_select(self, index): if 0 <= index < len(self.stack): self.browser.show_frame(self.stack[index]) def on_double(self, index): self.show_source(index) def goto_source_line(self): index = self.listbox.index("active") self.show_source(index) def show_stack_frame(self): index = self.listbox.index("active") if 0 <= index < len(self.stack): self.browser.show_frame(self.stack[index]) def show_source(self, index): if not (0 <= index < len(self.stack)): return frame, lineno = self.stack[index]
def GetText(self): frame, lineno = self.info try: modname = frame.f_globals["__name__"] except: modname = "?"
def show_locals(self, frame): self.localsdict = None if self.localsviewer: self.localsviewer.close() self.localsviewer = None if frame.f_locals is not frame.f_globals: title = "Local Variables" code = frame.f_code funcname = code.co_name if funcname not in ("?", "", None): title = title + " in " + funcname if not self.localsframe: self.localsframe = Frame(self.top) self.localsdict = frame.f_locals self.localsviewer = NamespaceViewer( self.localsframe, title, self.localsdict) self.localsframe.pack(fill="both", side="top") else: if self.localsframe: self.localsframe.forget()
b6584698733766b2028decd435ed2160f3557124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b6584698733766b2028decd435ed2160f3557124/StackViewer.py
if os.path.isfile(filename):
funcname = code.co_name sourceline = linecache.getline(filename, lineno) sourceline = string.strip(sourceline) if funcname in ("?", "", None): item = "%s, line %d: %s" % (modname, lineno, sourceline) else: item = "%s.%s(...), line %d: %s" % (modname, funcname, lineno, sourceline) return item def GetSubList(self): frame, lineno = self.info sublist = [] if frame.f_globals is not frame.f_locals: item = VariablesTreeItem("<locals>", frame.f_locals, self.flist) sublist.append(item) item = VariablesTreeItem("<globals>", frame.f_globals, self.flist) sublist.append(item) return sublist def OnDoubleClick(self): if self.flist: frame, lineno = self.info filename = frame.f_code.co_filename
def show_source(self, index): if not (0 <= index < len(self.stack)): return frame, lineno = self.stack[index] code = frame.f_code filename = code.co_filename if os.path.isfile(filename): edit = self.flist.open(filename) if edit: edit.gotoline(lineno)
b6584698733766b2028decd435ed2160f3557124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b6584698733766b2028decd435ed2160f3557124/StackViewer.py
if edit: edit.gotoline(lineno)
edit.gotoline(lineno)
def show_source(self, index): if not (0 <= index < len(self.stack)): return frame, lineno = self.stack[index] code = frame.f_code filename = code.co_filename if os.path.isfile(filename): edit = self.flist.open(filename) if edit: edit.gotoline(lineno)
b6584698733766b2028decd435ed2160f3557124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b6584698733766b2028decd435ed2160f3557124/StackViewer.py
def getexception(type=None, value=None):
def get_exception(type=None, value=None):
def get_stack(t=None, f=None): if t is None: t = sys.last_traceback stack = [] if t and t.tb_frame is f: t = t.tb_next while f is not None: stack.append((f, f.f_lineno)) if f is self.botframe: break f = f.f_back stack.reverse() while t is not None: stack.append((t.tb_frame, t.tb_lineno)) t = t.tb_next return stack
b6584698733766b2028decd435ed2160f3557124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b6584698733766b2028decd435ed2160f3557124/StackViewer.py
class NamespaceViewer: def __init__(self, master, title, dict=None): width = 0 height = 40 if dict: height = 20*len(dict) self.master = master self.title = title self.repr = Repr() self.repr.maxstring = 60 self.repr.maxother = 60 self.frame = frame = Frame(master) self.frame.pack(expand=1, fill="both") self.label = Label(frame, text=title, borderwidth=2, relief="groove") self.label.pack(fill="x") self.vbar = vbar = Scrollbar(frame, name="vbar") vbar.pack(side="right", fill="y") self.canvas = canvas = Canvas(frame, height=min(300, max(40, height)), scrollregion=(0, 0, width, height)) canvas.pack(side="left", fill="both", expand=1) vbar["command"] = canvas.yview canvas["yscrollcommand"] = vbar.set self.subframe = subframe = Frame(canvas) self.sfid = canvas.create_window(0, 0, window=subframe, anchor="nw") self.load_dict(dict) dict = -1 def load_dict(self, dict, force=0): if dict is self.dict and not force: return subframe = self.subframe frame = self.frame for c in subframe.children.values(): c.destroy() self.dict = None if not dict: l = Label(subframe, text="None") l.grid(row=0, column=0) else: names = dict.keys() names.sort() row = 0 for name in names: value = dict[name] svalue = self.repr.repr(value) l = Label(subframe, text=name) l.grid(row=row, column=0, sticky="nw") l = Entry(subframe, width=0, borderwidth=0) l.insert(0, svalue) l.grid(row=row, column=1, sticky="nw") row = row+1 self.dict = dict subframe.update_idletasks() width = subframe.winfo_reqwidth() height = subframe.winfo_reqheight() canvas = self.canvas self.canvas["scrollregion"] = (0, 0, width, height) if height > 300: canvas["height"] = 300 frame.pack(expand=1) else: canvas["height"] = height frame.pack(expand=0) def close(self): self.frame.destroy()
if __name__ == "__main__": root = Tk() root.withdraw() StackBrowser(root)
def getexception(type=None, value=None): if type is None: type = sys.last_type value = sys.last_value if hasattr(type, "__name__"): type = type.__name__ s = str(type) if value is not None: s = s + ": " + str(value) return s
b6584698733766b2028decd435ed2160f3557124 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b6584698733766b2028decd435ed2160f3557124/StackViewer.py
verify(cf.get('Long Line', 'foo', raw=1) == 'this line is much, much longer than my editor\nlikes it.') def write(src): print "Testing writing of files..." cf = ConfigParser.ConfigParser() sio = StringIO.StringIO(src) cf.readfp(sio) output = StringIO.StringIO() cf.write(output) verify(output, """[DEFAULT] foo = another very long line [Long Line] foo = this line is much, much longer than my editor likes it. """)
def basic(src): print "Testing basic accessors..." cf = ConfigParser.ConfigParser() sio = StringIO.StringIO(src) cf.readfp(sio) L = cf.sections() L.sort() verify(L == [r'Commented Bar', r'Foo Bar', r'Internationalized Stuff', r'Section\with$weird%characters[' '\t', r'Spacey Bar', ], "unexpected list of section names") # The use of spaces in the section names serves as a regression test for # SourceForge bug #115357. # http://sourceforge.net/bugs/?func=detailbug&group_id=5470&bug_id=115357 verify(cf.get('Foo Bar', 'foo', raw=1) == 'bar') verify(cf.get('Spacey Bar', 'foo', raw=1) == 'bar') verify(cf.get('Commented Bar', 'foo', raw=1) == 'bar') verify('__name__' not in cf.options("Foo Bar"), '__name__ "option" should not be exposed by the API!') # Make sure the right things happen for remove_option(); # added to include check for SourceForge bug #123324: verify(cf.remove_option('Foo Bar', 'foo'), "remove_option() failed to report existance of option") verify(not cf.has_option('Foo Bar', 'foo'), "remove_option() failed to remove option") verify(not cf.remove_option('Foo Bar', 'foo'), "remove_option() failed to report non-existance of option" " that was removed") try: cf.remove_option('No Such Section', 'foo') except ConfigParser.NoSectionError: pass else: raise TestFailed( "remove_option() failed to report non-existance of option" " that never existed")
1bf71172f8e1acfce05d8443e3998c425974aeef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1bf71172f8e1acfce05d8443e3998c425974aeef/test_cfgparser.py
makedirs(head, mode)
try: makedirs(head, mode) except OSError, e: if e.errno != EEXIST: raise
def makedirs(name, mode=0777): """makedirs(path [, mode=0777]) Super-mkdir; create a leaf directory and all intermediate ones. Works like mkdir, except that any intermediate path segment (not just the rightmost) will be created if it does not exist. This is recursive. """ head, tail = path.split(name) if not tail: head, tail = path.split(head) if head and tail and not path.exists(head): makedirs(head, mode) if tail == curdir: # xxx/newdir/. exists if xxx/newdir exists return mkdir(name, mode)
b130743e97410ba2b6c23d69df80e2ecea9d652b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b130743e97410ba2b6c23d69df80e2ecea9d652b/os.py
from errno import ENOENT, ENOTDIR
def _execvpe(file, args, env=None): from errno import ENOENT, ENOTDIR if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ head, tail = path.split(file) if head: func(file, *argrest) return if 'PATH' in env: envpath = env['PATH'] else: envpath = defpath PATH = envpath.split(pathsep) saved_exc = None saved_tb = None for dir in PATH: fullname = path.join(dir, file) try: func(fullname, *argrest) except error, e: tb = sys.exc_info()[2] if (e.errno != ENOENT and e.errno != ENOTDIR and saved_exc is None): saved_exc = e saved_tb = tb if saved_exc: raise error, saved_exc, saved_tb raise error, e, tb
b130743e97410ba2b6c23d69df80e2ecea9d652b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b130743e97410ba2b6c23d69df80e2ecea9d652b/os.py
if not strm:
if strm is None:
def __init__(self, strm=None): """ Initialize the handler.
502348d010be73a20cd5d6ce5512746198baa711 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/502348d010be73a20cd5d6ce5512746198baa711/__init__.py
file = open(filename)
try: file = open(filename) except IOError: return None
def synopsis(filename, cache={}): """Get the one-line summary out of a module file.""" mtime = os.stat(filename).st_mtime lastupdate, result = cache.get(filename, (0, None)) if lastupdate < mtime: info = inspect.getmoduleinfo(filename) file = open(filename) if info and 'b' in info[2]: # binary modules have to be imported try: module = imp.load_module('__temp__', file, filename, info[1:]) except: return None result = split(module.__doc__ or '', '\n')[0] del sys.modules['__temp__'] else: # text modules can be directly examined line = file.readline() while line[:1] == '#' or not strip(line): line = file.readline() if not line: break line = strip(line) if line[:4] == 'r"""': line = line[1:] if line[:3] == '"""': line = line[3:] if line[-1:] == '\\': line = line[:-1] while not strip(line): line = file.readline() if not line: break result = strip(split(line, '"""')[0]) else: result = None file.close() cache[filename] = (mtime, result) return result
26fd2e1dcc6f07f6c58127a790312850849c1c60 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26fd2e1dcc6f07f6c58127a790312850849c1c60/pydoc.py
def configure(self, cnf=None, **kw): """Configure resources of a widget. The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys. """
def _configure(self, cmd, cnf, kw): """Internal function."""
def _report_exception(self): """Internal function.""" import sys exc, val, tb = sys.exc_type, sys.exc_value, sys.exc_traceback root = self._root() root.report_callback_exception(exc, val, tb)
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
self.tk.call(self._w, 'configure')):
self.tk.call(_flatten((self._w, cmd)))):
def configure(self, cnf=None, **kw): """Configure resources of a widget.
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
x = self.tk.split(self.tk.call( self._w, 'configure', '-'+cnf))
x = self.tk.split( self.tk.call(_flatten((self._w, cmd, '-'+cnf))))
def configure(self, cnf=None, **kw): """Configure resources of a widget.
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
self.tk.call((self._w, 'configure') + self._options(cnf))
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf)) def configure(self, cnf=None, **kw): """Configure resources of a widget. The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments call the method keys. """ return self._configure('configure', cnf, kw)
def configure(self, cnf=None, **kw): """Configure resources of a widget.
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
if cnf is None and not kw: cnf = {} for x in self.tk.split( self.tk.call(self._w, 'itemconfigure', tagOrId)): cnf[x[0][1:]] = (x[0][1:],) + x[1:] return cnf if type(cnf) == StringType and not kw: x = self.tk.split(self.tk.call( self._w, 'itemconfigure', tagOrId, '-'+cnf)) return (x[0][1:],) + x[1:] self.tk.call((self._w, 'itemconfigure', tagOrId) + self._options(cnf, kw))
return self._configure(('itemconfigure', tagOrId), cnf, kw)
def itemconfigure(self, tagOrId, cnf=None, **kw): """Configure resources of an item TAGORID.
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
if cnf is None and not kw: cnf = {} for x in self.tk.split( self.tk.call(self._w, 'itemconfigure', index)): cnf[x[0][1:]] = (x[0][1:],) + x[1:] return cnf if type(cnf) == StringType and not kw: x = self.tk.split(self.tk.call( self._w, 'itemconfigure', index, '-'+cnf)) return (x[0][1:],) + x[1:] self.tk.call((self._w, 'itemconfigure', index) + self._options(cnf, kw))
return self._configure(('itemconfigure', index), cnf, kw)
def itemconfigure(self, index, cnf=None, **kw): """Configure resources of an ITEM.
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
if cnf is None and not kw: cnf = {} for x in self.tk.split(self.tk.call( (self._w, 'entryconfigure', index))): cnf[x[0][1:]] = (x[0][1:],) + x[1:] return cnf if type(cnf) == StringType and not kw: x = self.tk.split(self.tk.call( (self._w, 'entryconfigure', index, '-'+cnf))) return (x[0][1:],) + x[1:] self.tk.call((self._w, 'entryconfigure', index) + self._options(cnf, kw))
return self._configure(('entryconfigure', index), cnf, kw)
def entryconfigure(self, index, cnf=None, **kw): """Configure a menu item at INDEX.""" if cnf is None and not kw: cnf = {} for x in self.tk.split(self.tk.call( (self._w, 'entryconfigure', index))): cnf[x[0][1:]] = (x[0][1:],) + x[1:] return cnf if type(cnf) == StringType and not kw: x = self.tk.split(self.tk.call( (self._w, 'entryconfigure', index, '-'+cnf))) return (x[0][1:],) + x[1:] self.tk.call((self._w, 'entryconfigure', index) + self._options(cnf, kw))
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
def image_configure(self, index, cnf={}, **kw):
def image_configure(self, index, cnf=None, **kw):
def image_configure(self, index, cnf={}, **kw): """Configure an embedded image at INDEX.""" if not cnf and not kw: cnf = {} for x in self.tk.split( self.tk.call( self._w, "image", "configure", index)): cnf[x[0][1:]] = (x[0][1:],) + x[1:] return cnf apply(self.tk.call, (self._w, "image", "configure", index) + self._options(cnf, kw))
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
if not cnf and not kw: cnf = {} for x in self.tk.split( self.tk.call( self._w, "image", "configure", index)): cnf[x[0][1:]] = (x[0][1:],) + x[1:] return cnf apply(self.tk.call, (self._w, "image", "configure", index) + self._options(cnf, kw))
return self._configure(('image', 'configure', index), cnf, kw)
def image_configure(self, index, cnf={}, **kw): """Configure an embedded image at INDEX.""" if not cnf and not kw: cnf = {} for x in self.tk.split( self.tk.call( self._w, "image", "configure", index)): cnf[x[0][1:]] = (x[0][1:],) + x[1:] return cnf apply(self.tk.call, (self._w, "image", "configure", index) + self._options(cnf, kw))
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
def tag_configure(self, tagName, cnf={}, **kw):
def tag_configure(self, tagName, cnf=None, **kw):
def tag_configure(self, tagName, cnf={}, **kw): """Configure a tag TAGNAME.""" if type(cnf) == StringType: x = self.tk.split(self.tk.call( self._w, 'tag', 'configure', tagName, '-'+cnf)) return (x[0][1:],) + x[1:] self.tk.call( (self._w, 'tag', 'configure', tagName) + self._options(cnf, kw))
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
if type(cnf) == StringType: x = self.tk.split(self.tk.call( self._w, 'tag', 'configure', tagName, '-'+cnf)) return (x[0][1:],) + x[1:] self.tk.call( (self._w, 'tag', 'configure', tagName) + self._options(cnf, kw))
return self._configure(('tag', 'configure', tagName), cnf, kw)
def tag_configure(self, tagName, cnf={}, **kw): """Configure a tag TAGNAME.""" if type(cnf) == StringType: x = self.tk.split(self.tk.call( self._w, 'tag', 'configure', tagName, '-'+cnf)) return (x[0][1:],) + x[1:] self.tk.call( (self._w, 'tag', 'configure', tagName) + self._options(cnf, kw))
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
def window_configure(self, index, cnf={}, **kw):
def window_configure(self, index, cnf=None, **kw):
def window_configure(self, index, cnf={}, **kw): """Configure an embedded window at INDEX.""" if type(cnf) == StringType: x = self.tk.split(self.tk.call( self._w, 'window', 'configure', index, '-'+cnf)) return (x[0][1:],) + x[1:] self.tk.call( (self._w, 'window', 'configure', index) + self._options(cnf, kw))
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
if type(cnf) == StringType: x = self.tk.split(self.tk.call( self._w, 'window', 'configure', index, '-'+cnf)) return (x[0][1:],) + x[1:] self.tk.call( (self._w, 'window', 'configure', index) + self._options(cnf, kw))
return self._configure(('window', 'configure', index), cnf, kw)
def window_configure(self, index, cnf={}, **kw): """Configure an embedded window at INDEX.""" if type(cnf) == StringType: x = self.tk.split(self.tk.call( self._w, 'window', 'configure', index, '-'+cnf)) return (x[0][1:],) + x[1:] self.tk.call( (self._w, 'window', 'configure', index) + self._options(cnf, kw))
6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6ce1315bd35b6114abf8a59d0e9b9f7dce0bcd7d/Tkinter.py
otherwise return - (the signal that killed it). """
otherwise return -SIG, where SIG is the signal that killed it. """
def spawnv(mode, file, args): """spawnv(mode, file, args) -> integer
7da3cc5dfbbc722238a6140acccba469f66e7fac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7da3cc5dfbbc722238a6140acccba469f66e7fac/os.py
exception = ['<p>%s: %s' % (strong(str(etype)), str(evalue))]
exception = ['<p>%s: %s' % (strong(pydoc.html.escape(str(etype))), pydoc.html.escape(str(evalue)))]
def reader(lnum=[lnum]): highlight[lnum[0]] = 1 try: return linecache.getline(file, lnum[0]) finally: lnum[0] += 1
b67c94318ec85722ce01c03955d6fbf50e3f7aa9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b67c94318ec85722ce01c03955d6fbf50e3f7aa9/cgitb.py
(msg is None or mod.match(module)) and
(mod is None or mod.match(module)) and
def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} if isinstance(message, Warning): text = str(message) category = message.__class__ else: text = message message = category(message) key = (text, category, lineno) # Quick test for common case if registry.get(key): return # Search the filters for item in filters: action, msg, cat, mod, ln = item if ((msg is None or msg.match(text)) and issubclass(category, cat) and (msg is None or mod.match(module)) and (ln == 0 or lineno == ln)): break else: action = defaultaction # Early exit actions if action == "ignore": registry[key] = 1 return if action == "error": raise message # Other actions if action == "once": registry[key] = 1 oncekey = (text, category) if onceregistry.get(oncekey): return onceregistry[oncekey] = 1 elif action == "always": pass elif action == "module": registry[key] = 1 altkey = (text, category, 0) if registry.get(altkey): return registry[altkey] = 1 elif action == "default": registry[key] = 1 else: # Unrecognized actions are errors raise RuntimeError( "Unrecognized action (%r) in warnings.filters:\n %s" % (action, item)) # Print message and context showwarning(message, category, filename, lineno)
6cea6933625910298c5fb156f365814eb3600494 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6cea6933625910298c5fb156f365814eb3600494/warnings.py
buffering. Sublcasses should however, if possible, try to
buffering. Subclasses should however, if possible, try to
def readline(self, size=None):
7f3ed74643dd87ef9b6f54c235e4c562179cfb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7f3ed74643dd87ef9b6f54c235e4c562179cfb33/codecs.py
was specified. Thisis done to avoid data loss due to encodings
was specified. This is done to avoid data loss due to encodings
def open(filename, mode='rb', encoding=None, errors='strict', buffering=1): """ Open an encoded file using the given mode and return a wrapped version providing transparent encoding/decoding. Note: The wrapped version will only accept the object format defined by the codecs, i.e. Unicode objects for most builtin codecs. Output is also codec dependent and will usually by Unicode as well. Files are always opened in binary mode, even if no binary mode was specified. Thisis done to avoid data loss due to encodings using 8-bit values. The default file mode is 'rb' meaning to open the file in binary read mode. encoding specifies the encoding which is to be used for the the file. errors may be given to define the error handling. It defaults to 'strict' which causes ValueErrors to be raised in case an encoding error occurs. buffering has the same meaning as for the builtin open() API. It defaults to line buffered. The returned wrapped file object provides an extra attribute .encoding which allows querying the used encoding. This attribute is only available if an encoding was specified as parameter. """ if encoding is not None and \ 'b' not in mode: # Force opening of the file in binary mode mode = mode + 'b' file = __builtin__.open(filename, mode, buffering) if encoding is None: return file (e, d, sr, sw) = lookup(encoding) srw = StreamReaderWriter(file, sr, sw, errors) # Add attributes to simplify introspection srw.encoding = encoding return srw
7f3ed74643dd87ef9b6f54c235e4c562179cfb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7f3ed74643dd87ef9b6f54c235e4c562179cfb33/codecs.py
the file.
file.
def open(filename, mode='rb', encoding=None, errors='strict', buffering=1): """ Open an encoded file using the given mode and return a wrapped version providing transparent encoding/decoding. Note: The wrapped version will only accept the object format defined by the codecs, i.e. Unicode objects for most builtin codecs. Output is also codec dependent and will usually by Unicode as well. Files are always opened in binary mode, even if no binary mode was specified. Thisis done to avoid data loss due to encodings using 8-bit values. The default file mode is 'rb' meaning to open the file in binary read mode. encoding specifies the encoding which is to be used for the the file. errors may be given to define the error handling. It defaults to 'strict' which causes ValueErrors to be raised in case an encoding error occurs. buffering has the same meaning as for the builtin open() API. It defaults to line buffered. The returned wrapped file object provides an extra attribute .encoding which allows querying the used encoding. This attribute is only available if an encoding was specified as parameter. """ if encoding is not None and \ 'b' not in mode: # Force opening of the file in binary mode mode = mode + 'b' file = __builtin__.open(filename, mode, buffering) if encoding is None: return file (e, d, sr, sw) = lookup(encoding) srw = StreamReaderWriter(file, sr, sw, errors) # Add attributes to simplify introspection srw.encoding = encoding return srw
7f3ed74643dd87ef9b6f54c235e4c562179cfb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7f3ed74643dd87ef9b6f54c235e4c562179cfb33/codecs.py
If a target mapping in the decoding map occurrs multiple
If a target mapping in the decoding map occurs multiple
def make_encoding_map(decoding_map): """ Creates an encoding map from a decoding map. If a target mapping in the decoding map occurrs multiple times, then that target is mapped to None (undefined mapping), causing an exception when encountered by the charmap codec during translation. One example where this happens is cp875.py which decodes multiple character to \u001a. """ m = {} for k,v in decoding_map.items(): if not v in m: m[v] = k else: m[v] = None return m
7f3ed74643dd87ef9b6f54c235e4c562179cfb33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7f3ed74643dd87ef9b6f54c235e4c562179cfb33/codecs.py
import Plist builder.plist = Plist.fromFile(plistname)
import plistlib builder.plist = plistlib.Plist.fromFile(plistname)
def process_common_macho(template, progress, code, rsrcname, destname, is_update, raw=0, others=[], filename=None): # Check that we have a filename if filename is None: raise BuildError, "Need source filename on MacOSX" # First make sure the name ends in ".app" if destname[-4:] != '.app': destname = destname + '.app' # Now deduce the short name destdir, shortname = os.path.split(destname) if shortname[-4:] == '.app': # Strip the .app suffix shortname = shortname[:-4] # And deduce the .plist and .icns names plistname = None icnsname = None if rsrcname and rsrcname[-5:] == '.rsrc': tmp = rsrcname[:-5] plistname = tmp + '.plist' if os.path.exists(plistname): icnsname = tmp + '.icns' if not os.path.exists(icnsname): icnsname = None else: plistname = None if not os.path.exists(rsrcname): rsrcname = None if progress: progress.label('Creating bundle...') import bundlebuilder builder = bundlebuilder.AppBuilder(verbosity=0) builder.mainprogram = filename builder.builddir = destdir builder.name = shortname if rsrcname: builder.resources.append(rsrcname) for o in others: builder.resources.append(o) if plistname: import Plist builder.plist = Plist.fromFile(plistname) if icnsname: builder.iconfile = icnsname builder.setup() builder.build() if progress: progress.label('Done.') progress.inc(0)
9f59d528c5a9bfbcc93fdf8bd42d8738105b675c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9f59d528c5a9bfbcc93fdf8bd42d8738105b675c/buildtools.py
expected = longx // longy got = x // y
expected = longx / longy got = x / y
def checkit(*args): # Heavy use of nested scopes here! verify(got == expected, "for %r expected %r got %r" % (args, expected, got))
0dad0f763cfad1d387db91053f50f289732e0011 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0dad0f763cfad1d387db91053f50f289732e0011/test_long.py
def seek(self, pos, mode = 0):
def seek(self, pos, whence = 0):
def seek(self, pos, mode = 0): """Seek to specified position into the chunk. Default position is 0 (start of chunk). If the file is not seekable, this will result in an error.
624a1915121f60350984049a9f942d941ee14fbe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/624a1915121f60350984049a9f942d941ee14fbe/chunk.py
if mode == 1:
if whence == 1:
def seek(self, pos, mode = 0): """Seek to specified position into the chunk. Default position is 0 (start of chunk). If the file is not seekable, this will result in an error.
624a1915121f60350984049a9f942d941ee14fbe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/624a1915121f60350984049a9f942d941ee14fbe/chunk.py
elif mode == 2:
elif whence == 2:
def seek(self, pos, mode = 0): """Seek to specified position into the chunk. Default position is 0 (start of chunk). If the file is not seekable, this will result in an error.
624a1915121f60350984049a9f942d941ee14fbe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/624a1915121f60350984049a9f942d941ee14fbe/chunk.py
def read(self, n = -1): """Read at most n bytes from the chunk. If n is omitted or negative, read until the end
def read(self, size = -1): """Read at most size bytes from the chunk. If size is omitted or negative, read until the end
def read(self, n = -1): """Read at most n bytes from the chunk. If n is omitted or negative, read until the end of the chunk.
624a1915121f60350984049a9f942d941ee14fbe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/624a1915121f60350984049a9f942d941ee14fbe/chunk.py
if n < 0: n = self.chunksize - self.size_read if n > self.chunksize - self.size_read: n = self.chunksize - self.size_read data = self.file.read(n)
if size < 0: size = self.chunksize - self.size_read if size > self.chunksize - self.size_read: size = self.chunksize - self.size_read data = self.file.read(size)
def read(self, n = -1): """Read at most n bytes from the chunk. If n is omitted or negative, read until the end of the chunk.
624a1915121f60350984049a9f942d941ee14fbe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/624a1915121f60350984049a9f942d941ee14fbe/chunk.py
if os.name in ('nt', 'os2'):
if os.name in ('nt', 'os2') or sys.platform == 'cygwin':
def setUp(self): TestMailbox.setUp(self) if os.name in ('nt', 'os2'): self._box.colon = '!'
003c9e29520a24da7177f16fe26e758c6baeaaca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/003c9e29520a24da7177f16fe26e758c6baeaaca/test_mailbox.py
self.assertRaises(mailbox.ExternalClashError, self._box.lock) exited_pid, status = os.waitpid(pid, 0)
try: self.assertRaises(mailbox.ExternalClashError, self._box.lock) finally: exited_pid, status = os.waitpid(pid, 0)
def test_lock_conflict(self): # Fork off a subprocess that will lock the file for 2 seconds, # unlock it, and then exit. if not hasattr(os, 'fork'): return pid = os.fork() if pid == 0: # In the child, lock the mailbox. self._box.lock() time.sleep(2) self._box.unlock() os._exit(0)
003c9e29520a24da7177f16fe26e758c6baeaaca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/003c9e29520a24da7177f16fe26e758c6baeaaca/test_mailbox.py
" LettError, Erik van Blokland, for the \n" " Python for Windows graphic.\n" " http://www.letterror.com/\n" "\n"
def add_ui(db): x = y = 50 w = 370 h = 300 title = "[ProductName] Setup" # see "Dialog Style Bits" modal = 3 # visible | modal modeless = 1 # visible track_disk_space = 32 add_data(db, 'ActionText', uisample.ActionText) add_data(db, 'UIText', uisample.UIText) # Bitmaps if not os.path.exists(srcdir+r"\PC\python_icon.exe"): raise "Run icons.mak in PC directory" add_data(db, "Binary", [("PythonWin", msilib.Binary(srcdir+r"\PCbuild\installer.bmp")), # 152x328 pixels ("py.ico",msilib.Binary(srcdir+r"\PC\py.ico")), ]) add_data(db, "Icon", [("python_icon.exe", msilib.Binary(srcdir+r"\PC\python_icon.exe"))]) # Scripts # CheckDir sets TargetExists if TARGETDIR exists. # UpdateEditIDLE sets the REGISTRY.tcl component into # the installed/uninstalled state according to both the # Extensions and TclTk features. if os.system("nmake /nologo /c /f msisupport.mak") != 0: raise "'nmake /f msisupport.mak' failed" add_data(db, "Binary", [("Script", msilib.Binary("msisupport.dll"))]) # See "Custom Action Type 1" if msilib.Win64: CheckDir = "CheckDir" UpdateEditIDLE = "UpdateEditIDLE" else: CheckDir = "_CheckDir@4" UpdateEditIDLE = "_UpdateEditIDLE@4" add_data(db, "CustomAction", [("CheckDir", 1, "Script", CheckDir)]) if have_tcl: add_data(db, "CustomAction", [("UpdateEditIDLE", 1, "Script", UpdateEditIDLE)]) # UI customization properties add_data(db, "Property", # See "DefaultUIFont Property" [("DefaultUIFont", "DlgFont8"), # See "ErrorDialog Style Bit" ("ErrorDialog", "ErrorDlg"), ("Progress1", "Install"), # modified in maintenance type dlg ("Progress2", "installs"), ("MaintenanceForm_Action", "Repair")]) # Fonts, see "TextStyle Table" add_data(db, "TextStyle", [("DlgFont8", "Tahoma", 9, None, 0), ("DlgFontBold8", "Tahoma", 8, None, 1), #bold ("VerdanaBold10", "Verdana", 10, None, 1), ("VerdanaRed9", "Verdana", 9, 255, 0), ]) compileargs = r"-Wi [TARGETDIR]Lib\compileall.py -f -x bad_coding|badsyntax|site-packages [TARGETDIR]Lib" # See "CustomAction Table" add_data(db, "CustomAction", [ # msidbCustomActionTypeFirstSequence + msidbCustomActionTypeTextData + msidbCustomActionTypeProperty # See "Custom Action Type 51", # "Custom Action Execution Scheduling Options" ("InitialTargetDir", 307, "TARGETDIR", "[WindowsVolume]Python%s%s" % (major, minor)), ("SetDLLDirToTarget", 307, "DLLDIR", "[TARGETDIR]"), ("SetDLLDirToSystem32", 307, "DLLDIR", SystemFolderName), # msidbCustomActionTypeExe + msidbCustomActionTypeSourceFile # See "Custom Action Type 18" ("CompilePyc", 18, "python.exe", compileargs), ("CompilePyo", 18, "python.exe", "-O "+compileargs), ]) # UI Sequences, see "InstallUISequence Table", "Using a Sequence Table" # Numbers indicate sequence; see sequence.py for how these action integrate add_data(db, "InstallUISequence", [("PrepareDlg", "Not Privileged or Windows9x or Installed", 140), ("WhichUsersDlg", "Privileged and not Windows9x and not Installed", 141), ("InitialTargetDir", 'TARGETDIR=""', 750), # In the user interface, assume all-users installation if privileged. ("SetDLLDirToSystem32", 'DLLDIR="" and ' + sys32cond, 751), ("SetDLLDirToTarget", 'DLLDIR="" and not ' + sys32cond, 752), ("SelectDirectoryDlg", "Not Installed", 1230), # XXX no support for resume installations yet #("ResumeDlg", "Installed AND (RESUME OR Preselected)", 1240), ("MaintenanceTypeDlg", "Installed AND NOT RESUME AND NOT Preselected", 1250), ("ProgressDlg", None, 1280)]) add_data(db, "AdminUISequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToTarget", 'DLLDIR=""', 751), ]) # Execute Sequences add_data(db, "InstallExecuteSequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToSystem32", 'DLLDIR="" and ' + sys32cond, 751), ("SetDLLDirToTarget", 'DLLDIR="" and not ' + sys32cond, 752), ("UpdateEditIDLE", None, 1050), ("CompilePyc", "COMPILEALL", 6800), ("CompilePyo", "COMPILEALL", 6801), ]) add_data(db, "AdminExecuteSequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToTarget", 'DLLDIR=""', 751), ("CompilePyc", "COMPILEALL", 6800), ("CompilePyo", "COMPILEALL", 6801), ]) ##################################################################### # Standard dialogs: FatalError, UserExit, ExitDialog fatal=PyDialog(db, "FatalError", x, y, w, h, modal, title, "Finish", "Finish", "Finish") fatal.title("[ProductName] Installer ended prematurely") fatal.back("< Back", "Finish", active = 0) fatal.cancel("Cancel", "Back", active = 0) fatal.text("Description1", 135, 70, 220, 80, 0x30003, "[ProductName] setup ended prematurely because of an error. Your system has not been modified. To install this program at a later time, please run the installation again.") fatal.text("Description2", 135, 155, 220, 20, 0x30003, "Click the Finish button to exit the Installer.") c=fatal.next("Finish", "Cancel", name="Finish") # See "ControlEvent Table". Parameters are the event, the parameter # to the action, and optionally the condition for the event, and the order # of events. c.event("EndDialog", "Exit") user_exit=PyDialog(db, "UserExit", x, y, w, h, modal, title, "Finish", "Finish", "Finish") user_exit.title("[ProductName] Installer was interrupted") user_exit.back("< Back", "Finish", active = 0) user_exit.cancel("Cancel", "Back", active = 0) user_exit.text("Description1", 135, 70, 220, 80, 0x30003, "[ProductName] setup was interrupted. Your system has not been modified. " "To install this program at a later time, please run the installation again.") user_exit.text("Description2", 135, 155, 220, 20, 0x30003, "Click the Finish button to exit the Installer.") c = user_exit.next("Finish", "Cancel", name="Finish") c.event("EndDialog", "Exit") exit_dialog = PyDialog(db, "ExitDialog", x, y, w, h, modal, title, "Finish", "Finish", "Finish") exit_dialog.title("Completing the [ProductName] Installer") exit_dialog.back("< Back", "Finish", active = 0) exit_dialog.cancel("Cancel", "Back", active = 0) exit_dialog.text("Acknowledgements", 135, 95, 220, 120, 0x30003, "Special Windows thanks to:\n" " LettError, Erik van Blokland, for the \n" " Python for Windows graphic.\n" " http://www.letterror.com/\n" "\n" " Mark Hammond, without whose years of freely \n" " shared Windows expertise, Python for Windows \n" " would still be Python for DOS.") c = exit_dialog.text("warning", 135, 200, 220, 40, 0x30003, "{\\VerdanaRed9}Warning: Python 2.5.x is the last " "Python release for Windows 9x.") c.condition("Hide", "NOT Version9X") exit_dialog.text("Description", 135, 235, 220, 20, 0x30003, "Click the Finish button to exit the Installer.") c = exit_dialog.next("Finish", "Cancel", name="Finish") c.event("EndDialog", "Return") ##################################################################### # Required dialog: FilesInUse, ErrorDlg inuse = PyDialog(db, "FilesInUse", x, y, w, h, 19, # KeepModeless|Modal|Visible title, "Retry", "Retry", "Retry", bitmap=False) inuse.text("Title", 15, 6, 200, 15, 0x30003, r"{\DlgFontBold8}Files in Use") inuse.text("Description", 20, 23, 280, 20, 0x30003, "Some files that need to be updated are currently in use.") inuse.text("Text", 20, 55, 330, 50, 3, "The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.") inuse.control("List", "ListBox", 20, 107, 330, 130, 7, "FileInUseProcess", None, None, None) c=inuse.back("Exit", "Ignore", name="Exit") c.event("EndDialog", "Exit") c=inuse.next("Ignore", "Retry", name="Ignore") c.event("EndDialog", "Ignore") c=inuse.cancel("Retry", "Exit", name="Retry") c.event("EndDialog","Retry") # See "Error Dialog". See "ICE20" for the required names of the controls. error = Dialog(db, "ErrorDlg", 50, 10, 330, 101, 65543, # Error|Minimize|Modal|Visible title, "ErrorText", None, None) error.text("ErrorText", 50,9,280,48,3, "") error.control("ErrorIcon", "Icon", 15, 9, 24, 24, 5242881, None, "py.ico", None, None) error.pushbutton("N",120,72,81,21,3,"No",None).event("EndDialog","ErrorNo") error.pushbutton("Y",240,72,81,21,3,"Yes",None).event("EndDialog","ErrorYes") error.pushbutton("A",0,72,81,21,3,"Abort",None).event("EndDialog","ErrorAbort") error.pushbutton("C",42,72,81,21,3,"Cancel",None).event("EndDialog","ErrorCancel") error.pushbutton("I",81,72,81,21,3,"Ignore",None).event("EndDialog","ErrorIgnore") error.pushbutton("O",159,72,81,21,3,"Ok",None).event("EndDialog","ErrorOk") error.pushbutton("R",198,72,81,21,3,"Retry",None).event("EndDialog","ErrorRetry") ##################################################################### # Global "Query Cancel" dialog cancel = Dialog(db, "CancelDlg", 50, 10, 260, 85, 3, title, "No", "No", "No") cancel.text("Text", 48, 15, 194, 30, 3, "Are you sure you want to cancel [ProductName] installation?") cancel.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None, "py.ico", None, None) c=cancel.pushbutton("Yes", 72, 57, 56, 17, 3, "Yes", "No") c.event("EndDialog", "Exit") c=cancel.pushbutton("No", 132, 57, 56, 17, 3, "No", "Yes") c.event("EndDialog", "Return") ##################################################################### # Global "Wait for costing" dialog costing = Dialog(db, "WaitForCostingDlg", 50, 10, 260, 85, modal, title, "Return", "Return", "Return") costing.text("Text", 48, 15, 194, 30, 3, "Please wait while the installer finishes determining your disk space requirements.") costing.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None, "py.ico", None, None) c = costing.pushbutton("Return", 102, 57, 56, 17, 3, "Return", None) c.event("EndDialog", "Exit") ##################################################################### # Preparation dialog: no user input except cancellation prep = PyDialog(db, "PrepareDlg", x, y, w, h, modeless, title, "Cancel", "Cancel", "Cancel") prep.text("Description", 135, 70, 220, 40, 0x30003, "Please wait while the Installer prepares to guide you through the installation.") prep.title("Welcome to the [ProductName] Installer") c=prep.text("ActionText", 135, 110, 220, 20, 0x30003, "Pondering...") c.mapping("ActionText", "Text") c=prep.text("ActionData", 135, 135, 220, 30, 0x30003, None) c.mapping("ActionData", "Text") prep.back("Back", None, active=0) prep.next("Next", None, active=0) c=prep.cancel("Cancel", None) c.event("SpawnDialog", "CancelDlg") ##################################################################### # Target directory selection seldlg = PyDialog(db, "SelectDirectoryDlg", x, y, w, h, modal, title, "Next", "Next", "Cancel") seldlg.title("Select Destination Directory") c = seldlg.text("Existing", 135, 25, 235, 30, 0x30003, "{\VerdanaRed9}This update will replace your existing [ProductLine] installation.") c.condition("Hide", 'REMOVEOLDVERSION="" and REMOVEOLDSNAPSHOT=""') seldlg.text("Description", 135, 50, 220, 40, 0x30003, "Please select a directory for the [ProductName] files.") seldlg.back("< Back", None, active=0) c = seldlg.next("Next >", "Cancel") c.event("DoAction", "CheckDir", "TargetExistsOk<>1", order=1) # If the target exists, but we found that we are going to remove old versions, don't bother # confirming that the target directory exists. Strictly speaking, we should determine that # the target directory is indeed the target of the product that we are going to remove, but # I don't know how to do that. c.event("SpawnDialog", "ExistingDirectoryDlg", 'TargetExists=1 and REMOVEOLDVERSION="" and REMOVEOLDSNAPSHOT=""', 2) c.event("SetTargetPath", "TARGETDIR", 'TargetExists=0 or REMOVEOLDVERSION<>"" or REMOVEOLDSNAPSHOT<>""', 3) c.event("SpawnWaitDialog", "WaitForCostingDlg", "CostingComplete=1", 4) c.event("NewDialog", "SelectFeaturesDlg", 'TargetExists=0 or REMOVEOLDVERSION<>"" or REMOVEOLDSNAPSHOT<>""', 5) c = seldlg.cancel("Cancel", "DirectoryCombo") c.event("SpawnDialog", "CancelDlg") seldlg.control("DirectoryCombo", "DirectoryCombo", 135, 70, 172, 80, 393219, "TARGETDIR", None, "DirectoryList", None) seldlg.control("DirectoryList", "DirectoryList", 135, 90, 208, 136, 3, "TARGETDIR", None, "PathEdit", None) seldlg.control("PathEdit", "PathEdit", 135, 230, 206, 16, 3, "TARGETDIR", None, "Next", None) c = seldlg.pushbutton("Up", 306, 70, 18, 18, 3, "Up", None) c.event("DirectoryListUp", "0") c = seldlg.pushbutton("NewDir", 324, 70, 30, 18, 3, "New", None) c.event("DirectoryListNew", "0") ##################################################################### # SelectFeaturesDlg features = PyDialog(db, "SelectFeaturesDlg", x, y, w, h, modal|track_disk_space, title, "Tree", "Next", "Cancel") features.title("Customize [ProductName]") features.text("Description", 135, 35, 220, 15, 0x30003, "Select the way you want features to be installed.") features.text("Text", 135,45,220,30, 3, "Click on the icons in the tree below to change the way features will be installed.") c=features.back("< Back", "Next") c.event("NewDialog", "SelectDirectoryDlg") c=features.next("Next >", "Cancel") c.mapping("SelectionNoItems", "Enabled") c.event("SpawnDialog", "DiskCostDlg", "OutOfDiskSpace=1", order=1) c.event("EndDialog", "Return", "OutOfDiskSpace<>1", order=2) c=features.cancel("Cancel", "Tree") c.event("SpawnDialog", "CancelDlg") # The browse property is not used, since we have only a single target path (selected already) features.control("Tree", "SelectionTree", 135, 75, 220, 95, 7, "_BrowseProperty", "Tree of selections", "Back", None) #c=features.pushbutton("Reset", 42, 243, 56, 17, 3, "Reset", "DiskCost") #c.mapping("SelectionNoItems", "Enabled") #c.event("Reset", "0") features.control("Box", "GroupBox", 135, 170, 225, 90, 1, None, None, None, None) c=features.xbutton("DiskCost", "Disk &Usage", None, 0.10) c.mapping("SelectionNoItems","Enabled") c.event("SpawnDialog", "DiskCostDlg") c=features.xbutton("Advanced", "Advanced", None, 0.30) c.event("SpawnDialog", "AdvancedDlg") c=features.text("ItemDescription", 140, 180, 210, 30, 3, "Multiline description of the currently selected item.") c.mapping("SelectionDescription","Text") c=features.text("ItemSize", 140, 210, 210, 45, 3, "The size of the currently selected item.") c.mapping("SelectionSize", "Text") ##################################################################### # Disk cost cost = PyDialog(db, "DiskCostDlg", x, y, w, h, modal, title, "OK", "OK", "OK", bitmap=False) cost.text("Title", 15, 6, 200, 15, 0x30003, "{\DlgFontBold8}Disk Space Requirements") cost.text("Description", 20, 20, 280, 20, 0x30003, "The disk space required for the installation of the selected features.") cost.text("Text", 20, 53, 330, 60, 3, "The highlighted volumes (if any) do not have enough disk space " "available for the currently selected features. You can either " "remove some files from the highlighted volumes, or choose to " "install less features onto local drive(s), or select different " "destination drive(s).") cost.control("VolumeList", "VolumeCostList", 20, 100, 330, 150, 393223, None, "{120}{70}{70}{70}{70}", None, None) cost.xbutton("OK", "Ok", None, 0.5).event("EndDialog", "Return") ##################################################################### # WhichUsers Dialog. Only available on NT, and for privileged users. # This must be run before FindRelatedProducts, because that will # take into account whether the previous installation was per-user # or per-machine. We currently don't support going back to this # dialog after "Next" was selected; to support this, we would need to # find how to reset the ALLUSERS property, and how to re-run # FindRelatedProducts. # On Windows9x, the ALLUSERS property is ignored on the command line # and in the Property table, but installer fails according to the documentation # if a dialog attempts to set ALLUSERS. whichusers = PyDialog(db, "WhichUsersDlg", x, y, w, h, modal, title, "AdminInstall", "Next", "Cancel") whichusers.title("Select whether to install [ProductName] for all users of this computer.") # A radio group with two options: allusers, justme g = whichusers.radiogroup("AdminInstall", 135, 60, 160, 50, 3, "WhichUsers", "", "Next") g.add("ALL", 0, 5, 150, 20, "Install for all users") g.add("JUSTME", 0, 25, 150, 20, "Install just for me") whichusers.back("Back", None, active=0) c = whichusers.next("Next >", "Cancel") c.event("[ALLUSERS]", "1", 'WhichUsers="ALL"', 1) c.event("EndDialog", "Return", order = 2) c = whichusers.cancel("Cancel", "AdminInstall") c.event("SpawnDialog", "CancelDlg") ##################################################################### # Advanced Dialog. advanced = PyDialog(db, "AdvancedDlg", x, y, w, h, modal, title, "CompilePyc", "Next", "Cancel") advanced.title("Advanced Options for [ProductName]") # A radio group with two options: allusers, justme advanced.checkbox("CompilePyc", 135, 60, 230, 50, 3, "COMPILEALL", "Compile .py files to byte code after installation", "Next") c = advanced.next("Finish", "Cancel") c.event("EndDialog", "Return") c = advanced.cancel("Cancel", "CompilePyc") c.event("SpawnDialog", "CancelDlg") ##################################################################### # Existing Directory dialog dlg = Dialog(db, "ExistingDirectoryDlg", 50, 30, 200, 80, modal, title, "No", "No", "No") dlg.text("Title", 10, 20, 180, 40, 3, "[TARGETDIR] exists. Are you sure you want to overwrite existing files?") c=dlg.pushbutton("Yes", 30, 60, 55, 17, 3, "Yes", "No") c.event("[TargetExists]", "0", order=1) c.event("[TargetExistsOk]", "1", order=2) c.event("EndDialog", "Return", order=3) c=dlg.pushbutton("No", 115, 60, 55, 17, 3, "No", "Yes") c.event("EndDialog", "Return") ##################################################################### # Installation Progress dialog (modeless) progress = PyDialog(db, "ProgressDlg", x, y, w, h, modeless, title, "Cancel", "Cancel", "Cancel", bitmap=False) progress.text("Title", 20, 15, 200, 15, 0x30003, "{\DlgFontBold8}[Progress1] [ProductName]") progress.text("Text", 35, 65, 300, 30, 3, "Please wait while the Installer [Progress2] [ProductName]. " "This may take several minutes.") progress.text("StatusLabel", 35, 100, 35, 20, 3, "Status:") c=progress.text("ActionText", 70, 100, w-70, 20, 3, "Pondering...") c.mapping("ActionText", "Text") #c=progress.text("ActionData", 35, 140, 300, 20, 3, None) #c.mapping("ActionData", "Text") c=progress.control("ProgressBar", "ProgressBar", 35, 120, 300, 10, 65537, None, "Progress done", None, None) c.mapping("SetProgress", "Progress") progress.back("< Back", "Next", active=False) progress.next("Next >", "Cancel", active=False) progress.cancel("Cancel", "Back").event("SpawnDialog", "CancelDlg") # Maintenance type: repair/uninstall maint = PyDialog(db, "MaintenanceTypeDlg", x, y, w, h, modal, title, "Next", "Next", "Cancel") maint.title("Welcome to the [ProductName] Setup Wizard") maint.text("BodyText", 135, 63, 230, 42, 3, "Select whether you want to repair or remove [ProductName].") g=maint.radiogroup("RepairRadioGroup", 135, 108, 230, 60, 3, "MaintenanceForm_Action", "", "Next") g.add("Change", 0, 0, 200, 17, "&Change [ProductName]") g.add("Repair", 0, 18, 200, 17, "&Repair [ProductName]") g.add("Remove", 0, 36, 200, 17, "Re&move [ProductName]") maint.back("< Back", None, active=False) c=maint.next("Finish", "Cancel") # Change installation: Change progress dialog to "Change", then ask # for feature selection c.event("[Progress1]", "Change", 'MaintenanceForm_Action="Change"', 1) c.event("[Progress2]", "changes", 'MaintenanceForm_Action="Change"', 2) # Reinstall: Change progress dialog to "Repair", then invoke reinstall # Also set list of reinstalled features to "ALL" c.event("[REINSTALL]", "ALL", 'MaintenanceForm_Action="Repair"', 5) c.event("[Progress1]", "Repairing", 'MaintenanceForm_Action="Repair"', 6) c.event("[Progress2]", "repairs", 'MaintenanceForm_Action="Repair"', 7) c.event("Reinstall", "ALL", 'MaintenanceForm_Action="Repair"', 8) # Uninstall: Change progress to "Remove", then invoke uninstall # Also set list of removed features to "ALL" c.event("[REMOVE]", "ALL", 'MaintenanceForm_Action="Remove"', 11) c.event("[Progress1]", "Removing", 'MaintenanceForm_Action="Remove"', 12) c.event("[Progress2]", "removes", 'MaintenanceForm_Action="Remove"', 13) c.event("Remove", "ALL", 'MaintenanceForm_Action="Remove"', 14) # Close dialog when maintenance action scheduled c.event("EndDialog", "Return", 'MaintenanceForm_Action<>"Change"', 20) c.event("NewDialog", "SelectFeaturesDlg", 'MaintenanceForm_Action="Change"', 21) maint.cancel("Cancel", "RepairRadioGroup").event("SpawnDialog", "CancelDlg")
8301c7923ddc90b23b8ab37c29eba6cd5df06669 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8301c7923ddc90b23b8ab37c29eba6cd5df06669/msi.py
ServerClass = SocketServer.TCPServer):
ServerClass = BaseHTTPServer.HTTPServer):
def test(HandlerClass = SimpleHTTPRequestHandler, ServerClass = SocketServer.TCPServer): BaseHTTPServer.test(HandlerClass, ServerClass)
5c3b384a851b5f8f9a4f9a39a6869528d4444658 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5c3b384a851b5f8f9a4f9a39a6869528d4444658/SimpleHTTPServer.py
if timer is None: if os.name == 'mac':
if not timer: if _has_res: self.timer = resgetrusage self.dispatcher = self.trace_dispatch self.get_time = _get_time_resource elif os.name == 'mac':
def __init__(self, timer=None, bias=None): self.timings = {} self.cur = None self.cmd = "" self.c_func_name = ""
a4dac4094acd35810b1497bbf99642fc98afd475 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a4dac4094acd35810b1497bbf99642fc98afd475/profile.py
print 'source', `class_tcl`
def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir class_tcl = os.path.join(home, '.%s.tcl' % className) class_py = os.path.join(home, '.%s.py' % className) base_tcl = os.path.join(home, '.%s.tcl' % baseName) base_py = os.path.join(home, '.%s.py' % baseName) dir = {'self': self} exec 'from Tkinter import *' in dir if os.path.isfile(class_tcl): print 'source', `class_tcl` self.tk.call('source', class_tcl) if os.path.isfile(class_py): print 'execfile', `class_py` execfile(class_py, dir) if os.path.isfile(base_tcl): print 'source', `base_tcl` self.tk.call('source', base_tcl) if os.path.isfile(base_py): print 'execfile', `base_py` execfile(base_py, dir)
d2a5ad25d5f6734c919bd40ee26c3e11b98d6bc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d2a5ad25d5f6734c919bd40ee26c3e11b98d6bc3/Tkinter.py
print 'execfile', `class_py`
def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir class_tcl = os.path.join(home, '.%s.tcl' % className) class_py = os.path.join(home, '.%s.py' % className) base_tcl = os.path.join(home, '.%s.tcl' % baseName) base_py = os.path.join(home, '.%s.py' % baseName) dir = {'self': self} exec 'from Tkinter import *' in dir if os.path.isfile(class_tcl): print 'source', `class_tcl` self.tk.call('source', class_tcl) if os.path.isfile(class_py): print 'execfile', `class_py` execfile(class_py, dir) if os.path.isfile(base_tcl): print 'source', `base_tcl` self.tk.call('source', base_tcl) if os.path.isfile(base_py): print 'execfile', `base_py` execfile(base_py, dir)
d2a5ad25d5f6734c919bd40ee26c3e11b98d6bc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d2a5ad25d5f6734c919bd40ee26c3e11b98d6bc3/Tkinter.py
print 'source', `base_tcl`
def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir class_tcl = os.path.join(home, '.%s.tcl' % className) class_py = os.path.join(home, '.%s.py' % className) base_tcl = os.path.join(home, '.%s.tcl' % baseName) base_py = os.path.join(home, '.%s.py' % baseName) dir = {'self': self} exec 'from Tkinter import *' in dir if os.path.isfile(class_tcl): print 'source', `class_tcl` self.tk.call('source', class_tcl) if os.path.isfile(class_py): print 'execfile', `class_py` execfile(class_py, dir) if os.path.isfile(base_tcl): print 'source', `base_tcl` self.tk.call('source', base_tcl) if os.path.isfile(base_py): print 'execfile', `base_py` execfile(base_py, dir)
d2a5ad25d5f6734c919bd40ee26c3e11b98d6bc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d2a5ad25d5f6734c919bd40ee26c3e11b98d6bc3/Tkinter.py
print 'execfile', `base_py`
def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir class_tcl = os.path.join(home, '.%s.tcl' % className) class_py = os.path.join(home, '.%s.py' % className) base_tcl = os.path.join(home, '.%s.tcl' % baseName) base_py = os.path.join(home, '.%s.py' % baseName) dir = {'self': self} exec 'from Tkinter import *' in dir if os.path.isfile(class_tcl): print 'source', `class_tcl` self.tk.call('source', class_tcl) if os.path.isfile(class_py): print 'execfile', `class_py` execfile(class_py, dir) if os.path.isfile(base_tcl): print 'source', `base_tcl` self.tk.call('source', base_tcl) if os.path.isfile(base_py): print 'execfile', `base_py` execfile(base_py, dir)
d2a5ad25d5f6734c919bd40ee26c3e11b98d6bc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d2a5ad25d5f6734c919bd40ee26c3e11b98d6bc3/Tkinter.py
def getinfo(self): return (self.format, self.width, self.height, self.packfactor,\ self.c0bits, self.c1bits, self.c2bits, self.offset, \ self.chrompack)
9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a/VFile.py
def rewind(self):
def reopen(self):
def rewind(self): self.fp.seek(0) x = self.initfp(self.fp, self.filename)
9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a/VFile.py
def getnextframedata(self, (size, chromsize)):
def getnextframedata(self, size, chromsize):
def getnextframedata(self, (size, chromsize)): if self.hascache: self.position() self.frameno = self.frameno + 1 data = self.fp.read(size) if len(data) <> size: raise EOFError if chromsize: chromdata = self.fp.read(chromsize) if len(chromdata) <> chromsize: raise EOFError else: chromdata = None # return data, chromdata
9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a/VFile.py
def skipnextframedata(self, (size, chromsize)):
def skipnextframedata(self, size, chromsize):
def skipnextframedata(self, (size, chromsize)): if self.hascache: self.frameno = self.frameno + 1 return # Note that this won't raise EOFError for a partial frame. try: self.fp.seek(size + chromsize, 1) # Relative seek except: # Assume it's a pipe -- read the data to discard it dummy = self.fp.read(size + chromsize)
9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a/VFile.py
def showframe(self, (data, chromdata)):
def showframe(self, data, chromdata):
def showframe(self, (data, chromdata)): w, h, pf = self.width, self.height, self.packfactor if not self.colormapinited: self.initcolormap() factor = self.magnify if pf: factor = factor * pf if chromdata and not self.skipchrom: cp = self.chrompack cw = (w+cp-1)/cp ch = (h+cp-1)/cp gl.rectzoom(factor*cp, factor*cp) gl.pixmode(GL.PM_SIZE, 16) gl.writemask(self.mask - ((1 << self.c0bits) - 1)) gl.lrectwrite(self.xorigin, self.yorigin, \ self.xorigin + cw - 1, self.yorigin + ch - 1, \ chromdata) # if pf: gl.writemask((1 << self.c0bits) - 1) gl.pixmode(GL.PM_SIZE, 8) gl.rectzoom(factor, factor) w = w/pf h = h/pf gl.lrectwrite(self.xorigin, self.yorigin, \ self.xorigin + w - 1, self.yorigin + h - 1, data)
9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a/VFile.py
sys.stderr.write('Initializing color map...')
if not self.quiet: sys.stderr.write('Initializing color map...')
def initcolormap(self): self.colormapinited = 1 if self.format == 'rgb': gl.RGBmode() gl.gconfig() return gl.cmode() gl.gconfig() self.skipchrom = 0 sys.stderr.write('Initializing color map...') self.initcmap() sys.stderr.write(' Done.\n') if self.offset == 0: gl.color(0x800) gl.clear() self.mask = 0x7ff else: self.mask = 0xfff gl.clear()
9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a/VFile.py
sys.stderr.write(' Done.\n')
if not self.quiet: sys.stderr.write(' Done.\n')
def initcolormap(self): self.colormapinited = 1 if self.format == 'rgb': gl.RGBmode() gl.gconfig() return gl.cmode() gl.gconfig() self.skipchrom = 0 sys.stderr.write('Initializing color map...') self.initcmap() sys.stderr.write(' Done.\n') if self.offset == 0: gl.color(0x800) gl.clear() self.mask = 0x7ff else: self.mask = 0xfff gl.clear()
9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a/VFile.py
data = ('grey', 0)
data = ('grey', self.c0bits)
def writeheader(self): self.headerwritten = 1 if self.format == 'rgb': self.packfactor = 0 elif self.packfactor == 0: self.packfactor = 1 self.fp.write('CMIF video 3.0\n') if self.format == 'rgb': data = ('rgb', 0) elif self.format == 'grey': data = ('grey', 0) else: data = (self.format, (self.c0bits, self.c1bits, \ self.c2bits, self.chrompack, self.offset)) self.fp.write(`data`+'\n') data = (self.width, self.height, self.packfactor) self.fp.write(`data`+'\n') try: self._grabber = eval('grab_' + self.format) except: raise Error, 'unknown colorsys: ' + self.format
9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a35d57ab2d1f2a8eafd0d487ac8166c93db0a5a/VFile.py
except error_proto(val):
except error_proto, val:
def quit(self): """Signoff: commit changes on server, unlock mailbox, close connection.""" try: resp = self._shortcmd('QUIT') except error_proto(val): resp = val self.file.close() self.sock.close() del self.file, self.sock return resp
de23cb0e7e1a5181e6102c4f32ab8a24886f27af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/de23cb0e7e1a5181e6102c4f32ab8a24886f27af/poplib.py
try: temp = open(tempname, 'w') except IOError: print '*** Cannot create temp file', `tempname` return
temp = open(tempname, 'w')
def pipethrough(input, command, output): tempname = tempfile.mktemp() try: temp = open(tempname, 'w') except IOError: print '*** Cannot create temp file', `tempname` return copyliteral(input, temp) temp.close() pipe = os.popen(command + ' <' + tempname, 'r') copybinary(pipe, output) pipe.close() os.unlink(tempname)
6fd08baddc899d342129d646058ff921650b8573 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fd08baddc899d342129d646058ff921650b8573/mimetools.py
def resolve_dotted_attribute(obj, attr): """resolve_dotted_attribute(math, 'cos.__doc__') => math.cos.__doc__ Resolves a dotted attribute name to an object. Raises an AttributeError if any attribute in the chain starts with a '_'. """ for i in attr.split('.'): if i.startswith('_'): raise AttributeError( 'attempt to access private attribute "%s"' % i ) else: obj = getattr(obj,i) return obj
def resolve_dotted_attribute(obj, attr): """resolve_dotted_attribute(math, 'cos.__doc__') => math.cos.__doc__
787fd8cdeb72bea74a79e5acf61debfd11683502 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/787fd8cdeb72bea74a79e5acf61debfd11683502/SimpleXMLRPCServer.py
return apply( getattr(self.server.instance,'_dispatch'), (method, params) )
return self.server.instance._dispatch(method, params)
def resolve_dotted_attribute(obj, attr): """resolve_dotted_attribute(math, 'cos.__doc__') => math.cos.__doc__
787fd8cdeb72bea74a79e5acf61debfd11683502 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/787fd8cdeb72bea74a79e5acf61debfd11683502/SimpleXMLRPCServer.py
func = resolve_dotted_attribute(
func = _resolve_dotted_attribute(
def resolve_dotted_attribute(obj, attr): """resolve_dotted_attribute(math, 'cos.__doc__') => math.cos.__doc__
787fd8cdeb72bea74a79e5acf61debfd11683502 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/787fd8cdeb72bea74a79e5acf61debfd11683502/SimpleXMLRPCServer.py
s = string.rjust(`vin.packfactor`, 2) if vin.packfactor and vin.format not in ('rgb', 'jpeg') and \ (vin.width/vin.packfactor) % 4 <> 0: s = s + '!'
if type(vin.packfactor) == type(()): xpf, ypf = vin.packfactor s = string.rjust(`xpf`, 2) + ',' + \ string.rjust(`ypf`, 2)
def process(filename): try: vin = VFile.RandomVinFile().init(filename) except IOError, msg: sys.stderr.write(filename + ': I/O error: ' + `msg` + '\n') return 1 except VFile.Error, msg: sys.stderr.write(msg + '\n') return 1 except EOFError: sys.stderr.write(filename + ': EOF in video file\n') return 1 if terse: print string.ljust(filename, maxwidth), kbytes = (VFile.getfilesize(filename) + 1023) / 1024 print string.rjust(`kbytes`, 5) + 'K', print ' ', string.ljust(`vin.version`, 5), print string.ljust(vin.format, 8), print string.rjust(`vin.width`, 4), print string.rjust(`vin.height`, 4), s = string.rjust(`vin.packfactor`, 2) if vin.packfactor and vin.format not in ('rgb', 'jpeg') and \ (vin.width/vin.packfactor) % 4 <> 0: s = s + '!' else: s = s + ' ' print s, sys.stdout.flush() else: vin.printinfo() if quick: if terse: print vin.close() return 0 try: vin.readcache() if not terse: print '[Using cached index]' except VFile.Error: if not terse: print '[Constructing index on the fly]' if not short: if delta: print 'Frame time deltas:', else: print 'Frame times:', n = 0 t = 0 told = 0 datasize = 0 while 1: try: t, ds, cs = vin.getnextframeheader() vin.skipnextframedata(ds, cs) except EOFError: break datasize = datasize + ds if cs: datasize = datasize + cs if not short: if n%8 == 0: sys.stdout.write('\n') if delta: sys.stdout.write('\t' + `t - told`) told = t else: sys.stdout.write('\t' + `t`) n = n+1 if not short: print if terse: print string.rjust(`n`, 6), print string.rjust(`int(n*10000.0/t)*0.1`, 5) else: print 'Total', n, 'frames in', t*0.001, 'sec.', if t: print '-- average', int(n*10000.0/t)*0.1, 'frames/sec', print print 'Total data', 0.1 * int(datasize / 102.4), 'Kbytes', if t: print '-- average', print 0.1 * int(datasize / 0.1024 / t), 'Kbytes/sec', print vin.close() return 0
83c81448b1db067a8eeea140afbde525499f507b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/83c81448b1db067a8eeea140afbde525499f507b/Vinfo.py
s = s + ' '
s = string.rjust(`vin.packfactor`, 2) if type(vin.packfactor) == type(0) and \ vin.format not in ('rgb', 'jpeg') and \ (vin.width/vin.packfactor) % 4 <> 0: s = s + '! ' else: s = s + ' '
def process(filename): try: vin = VFile.RandomVinFile().init(filename) except IOError, msg: sys.stderr.write(filename + ': I/O error: ' + `msg` + '\n') return 1 except VFile.Error, msg: sys.stderr.write(msg + '\n') return 1 except EOFError: sys.stderr.write(filename + ': EOF in video file\n') return 1 if terse: print string.ljust(filename, maxwidth), kbytes = (VFile.getfilesize(filename) + 1023) / 1024 print string.rjust(`kbytes`, 5) + 'K', print ' ', string.ljust(`vin.version`, 5), print string.ljust(vin.format, 8), print string.rjust(`vin.width`, 4), print string.rjust(`vin.height`, 4), s = string.rjust(`vin.packfactor`, 2) if vin.packfactor and vin.format not in ('rgb', 'jpeg') and \ (vin.width/vin.packfactor) % 4 <> 0: s = s + '!' else: s = s + ' ' print s, sys.stdout.flush() else: vin.printinfo() if quick: if terse: print vin.close() return 0 try: vin.readcache() if not terse: print '[Using cached index]' except VFile.Error: if not terse: print '[Constructing index on the fly]' if not short: if delta: print 'Frame time deltas:', else: print 'Frame times:', n = 0 t = 0 told = 0 datasize = 0 while 1: try: t, ds, cs = vin.getnextframeheader() vin.skipnextframedata(ds, cs) except EOFError: break datasize = datasize + ds if cs: datasize = datasize + cs if not short: if n%8 == 0: sys.stdout.write('\n') if delta: sys.stdout.write('\t' + `t - told`) told = t else: sys.stdout.write('\t' + `t`) n = n+1 if not short: print if terse: print string.rjust(`n`, 6), print string.rjust(`int(n*10000.0/t)*0.1`, 5) else: print 'Total', n, 'frames in', t*0.001, 'sec.', if t: print '-- average', int(n*10000.0/t)*0.1, 'frames/sec', print print 'Total data', 0.1 * int(datasize / 102.4), 'Kbytes', if t: print '-- average', print 0.1 * int(datasize / 0.1024 / t), 'Kbytes/sec', print vin.close() return 0
83c81448b1db067a8eeea140afbde525499f507b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/83c81448b1db067a8eeea140afbde525499f507b/Vinfo.py
print string.rjust(`int(n*10000.0/t)*0.1`, 5)
if t: print string.rjust(`int(n*10000.0/t)*0.1`, 5), print
def process(filename): try: vin = VFile.RandomVinFile().init(filename) except IOError, msg: sys.stderr.write(filename + ': I/O error: ' + `msg` + '\n') return 1 except VFile.Error, msg: sys.stderr.write(msg + '\n') return 1 except EOFError: sys.stderr.write(filename + ': EOF in video file\n') return 1 if terse: print string.ljust(filename, maxwidth), kbytes = (VFile.getfilesize(filename) + 1023) / 1024 print string.rjust(`kbytes`, 5) + 'K', print ' ', string.ljust(`vin.version`, 5), print string.ljust(vin.format, 8), print string.rjust(`vin.width`, 4), print string.rjust(`vin.height`, 4), s = string.rjust(`vin.packfactor`, 2) if vin.packfactor and vin.format not in ('rgb', 'jpeg') and \ (vin.width/vin.packfactor) % 4 <> 0: s = s + '!' else: s = s + ' ' print s, sys.stdout.flush() else: vin.printinfo() if quick: if terse: print vin.close() return 0 try: vin.readcache() if not terse: print '[Using cached index]' except VFile.Error: if not terse: print '[Constructing index on the fly]' if not short: if delta: print 'Frame time deltas:', else: print 'Frame times:', n = 0 t = 0 told = 0 datasize = 0 while 1: try: t, ds, cs = vin.getnextframeheader() vin.skipnextframedata(ds, cs) except EOFError: break datasize = datasize + ds if cs: datasize = datasize + cs if not short: if n%8 == 0: sys.stdout.write('\n') if delta: sys.stdout.write('\t' + `t - told`) told = t else: sys.stdout.write('\t' + `t`) n = n+1 if not short: print if terse: print string.rjust(`n`, 6), print string.rjust(`int(n*10000.0/t)*0.1`, 5) else: print 'Total', n, 'frames in', t*0.001, 'sec.', if t: print '-- average', int(n*10000.0/t)*0.1, 'frames/sec', print print 'Total data', 0.1 * int(datasize / 102.4), 'Kbytes', if t: print '-- average', print 0.1 * int(datasize / 0.1024 / t), 'Kbytes/sec', print vin.close() return 0
83c81448b1db067a8eeea140afbde525499f507b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/83c81448b1db067a8eeea140afbde525499f507b/Vinfo.py
args['linker_so'] = linker_so + ' -shared'
if platform == 'darwin1': args['linker_so'] = linker_so else: args['linker_so'] = linker_so + ' -shared'
def build_extensions(self):
df82e58cd516ea1dcd9d0bfc5622a5239af0392d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df82e58cd516ea1dcd9d0bfc5622a5239af0392d/setup.py
The optional second argument can specify an alternative default."""
The optional second argument can specify an alternate default."""
def getenv(key, default=None): """Get an environment variable, return None if it doesn't exist. The optional second argument can specify an alternative default.""" return environ.get(key, default)
20af3172ce46a13789dbb4087e1115c95cfa9227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/20af3172ce46a13789dbb4087e1115c95cfa9227/os.py
assert mode[:1] in ("b", "t")
def popen2(cmd, mode="t", bufsize=-1): assert mode[:1] in ("b", "t") import popen2 stdout, stdin = popen2.popen2(cmd, bufsize) return stdin, stdout
20af3172ce46a13789dbb4087e1115c95cfa9227 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/20af3172ce46a13789dbb4087e1115c95cfa9227/os.py
if not hasattr(socket, "ssl"): raise test_support.TestSkipped("socket module has no ssl support")
def test_basic(): test_support.requires('network') if not hasattr(socket, "ssl"): raise test_support.TestSkipped("socket module has no ssl support") import urllib socket.RAND_status() try: socket.RAND_egd(1) except TypeError: pass else: print "didn't raise TypeError" socket.RAND_add("this is a random string", 75.0) f = urllib.urlopen('https://sf.net') buf = f.read() f.close()
1787a0b1cc9679791a2fe775f63c322491c6767a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1787a0b1cc9679791a2fe775f63c322491c6767a/test_socket_ssl.py
('cygwin.*', 'cygwin'),
('cygwin.*', 'unix'),
def mkpath (self, name, mode=0777): mkpath (name, mode, self.verbose, self.dry_run)
a34dbe0fdcfd7cf75c8d339542183d58cacfce8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a34dbe0fdcfd7cf75c8d339542183d58cacfce8b/ccompiler.py
def storbinary(self, cmd, fp, blocksize):
def storbinary(self, cmd, fp, blocksize=8192):
def storbinary(self, cmd, fp, blocksize): '''Store a file in binary mode.''' self.voidcmd('TYPE I') conn = self.transfercmd(cmd) while 1: buf = fp.read(blocksize) if not buf: break conn.send(buf) conn.close() return self.voidresp()
4ac83474a3201394ea668d624729883d85f9304a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4ac83474a3201394ea668d624729883d85f9304a/ftplib.py
prefix = None exec_prefix = None extensions = [] path = sys.path odir = '' frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' makefile = 'Makefile' try: opts, args = getopt.getopt(sys.argv[1:], 'he:o:p:P:') except getopt.error, msg: usage('getopt error: ' + str(msg)) for o, a in opts: if o == '-h': print __doc__ return if o == '-e': extensions.append(a) if o == '-o': odir = a if o == '-p': prefix = a if o == '-P': exec_prefix = a if not exec_prefix: if prefix: exec_prefix = prefix else: exec_prefix = sys.exec_prefix if not prefix: prefix = sys.prefix ishome = os.path.exists(os.path.join(prefix, 'Include', 'pythonrun.h')) version = sys.version[:3] if ishome: print "(Using Python source directory)" binlib = exec_prefix incldir = os.path.join(prefix, 'Include') config_c_in = os.path.join(prefix, 'Modules', 'config.c.in') frozenmain_c = os.path.join(prefix, 'Modules', 'frozenmain.c') makefile_in = os.path.join(exec_prefix, 'Modules', 'Makefile') else: binlib = os.path.join(exec_prefix, 'lib', 'python%s' % version, 'config') incldir = os.path.join(prefix, 'include', 'python%s' % version) config_c_in = os.path.join(binlib, 'config.c.in') frozenmain_c = os.path.join(binlib, 'frozenmain.c') makefile_in = os.path.join(binlib, 'Makefile') supp_sources = [] defines = [] includes = ['-I' + incldir, '-I' + binlib] for dir in [prefix, exec_prefix, binlib, incldir] + extensions: if not os.path.exists(dir): usage('needed directory %s not found' % dir) if not os.path.isdir(dir): usage('%s: not a directory' % dir) for file in [config_c_in, makefile_in] + supp_sources: if not os.path.exists(file): usage('needed file %s not found' % file) if not os.path.isfile(file): usage('%s: not a plain file' % file) for dir in extensions: setup = os.path.join(dir, 'Setup') if not os.path.exists(setup): usage('needed file %s not found' % setup) if not os.path.isfile(setup): usage('%s: not a plain file' % setup) if not args: usage('at least one filename argument required') if args[0][-3:] != ".py": usage('the script name must have a .py suffix') for arg in args: if not os.path.exists(arg): usage('argument %s not found' % arg) if not os.path.isfile(arg): usage('%s: not a plain file' % arg) scriptfile = args[0] modules = args[1:] base = os.path.basename(scriptfile) base, ext = os.path.splitext(base) if base: if base != scriptfile: target = base else: target = base + '.bin' base_frozen_c = frozen_c base_config_c = config_c base_target = target if odir and not os.path.isdir(odir): try: os.mkdir(odir) print "Created output directory", odir except os.error, msg: usage('%s: mkdir failed (%s)' % (odir, str(msg))) if odir: frozen_c = os.path.join(odir, frozen_c) config_c = os.path.join(odir, config_c) target = os.path.join(odir, target) makefile = os.path.join(odir,makefile) dict = findmodules.findmodules(scriptfile, modules, path) names = dict.keys() names.sort() print "Modules being frozen:" for name in names: print '\t', name backup = frozen_c + '~' try: os.rename(frozen_c, backup) except os.error: backup = None outfp = open(frozen_c, 'w') try: makefreeze.makefreeze(outfp, dict) finally: outfp.close() if backup: if cmp.cmp(backup, frozen_c): sys.stderr.write('%s not changed, not written\n' % frozen_c) os.rename(backup, frozen_c) builtins = [] unknown = [] mods = dict.keys() mods.sort() for mod in mods: if dict[mod] == '<builtin>': builtins.append(mod) elif dict[mod] == '<unknown>': unknown.append(mod) addfiles = [] if unknown: addfiles, addmods = \ checkextensions.checkextensions(unknown, extensions) for mod in addmods: unknown.remove(mod) builtins = builtins + addmods if unknown: sys.stderr.write('Warning: unknown modules remain: %s\n' % string.join(unknown)) builtins.sort() infp = open(config_c_in) backup = config_c + '~' try: os.rename(config_c, backup) except os.error: backup = None outfp = open(config_c, 'w') try: makeconfig.makeconfig(infp, outfp, builtins) finally: outfp.close() infp.close() if backup: if cmp.cmp(backup, config_c): sys.stderr.write('%s not changed, not written\n' % config_c) os.rename(backup, config_c) cflags = defines + includes + ['$(OPT)'] libs = [os.path.join(binlib, 'libpython$(VERSION).a')] makevars = parsesetup.getmakevars(makefile_in) somevars = {} for key in makevars.keys(): somevars[key] = makevars[key] somevars['CFLAGS'] = string.join(cflags) files = ['$(OPT)', '$(LDFLAGS)', base_config_c, base_frozen_c] + \ supp_sources + addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] backup = makefile + '~' try: os.rename(makefile, backup) except os.error: backup = None outfp = open(makefile, 'w') try: makemakefile.makemakefile(outfp, somevars, files, base_target) finally: outfp.close() if backup: if not cmp.cmp(backup, makefile): print 'previous Makefile saved as', backup else: sys.stderr.write('%s not changed, not written\n' % makefile) os.rename(backup, makefile) if odir: print 'Now run "make" in', odir, print 'to build the target:', base_target else: print 'Now run "make" to build the target:', base_target
prefix = None exec_prefix = None extensions = [] path = sys.path odir = '' frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' makefile = 'Makefile' try: opts, args = getopt.getopt(sys.argv[1:], 'he:o:p:P:') except getopt.error, msg: usage('getopt error: ' + str(msg)) for o, a in opts: if o == '-h': print __doc__ return if o == '-e': extensions.append(a) if o == '-o': odir = a if o == '-p': prefix = a if o == '-P': exec_prefix = a if not exec_prefix: if prefix: exec_prefix = prefix else: exec_prefix = sys.exec_prefix if not prefix: prefix = sys.prefix ishome = os.path.exists(os.path.join(prefix, 'Include', 'pythonrun.h')) version = sys.version[:3] if ishome: print "(Using Python source directory)" binlib = exec_prefix incldir = os.path.join(prefix, 'Include') config_c_in = os.path.join(prefix, 'Modules', 'config.c.in') frozenmain_c = os.path.join(prefix, 'Modules', 'frozenmain.c') makefile_in = os.path.join(exec_prefix, 'Modules', 'Makefile') else: binlib = os.path.join(exec_prefix, 'lib', 'python%s' % version, 'config') incldir = os.path.join(prefix, 'include', 'python%s' % version) config_c_in = os.path.join(binlib, 'config.c.in') frozenmain_c = os.path.join(binlib, 'frozenmain.c') makefile_in = os.path.join(binlib, 'Makefile') supp_sources = [] defines = [] includes = ['-I' + incldir, '-I' + binlib] for dir in [prefix, exec_prefix, binlib, incldir] + extensions: if not os.path.exists(dir): usage('needed directory %s not found' % dir) if not os.path.isdir(dir): usage('%s: not a directory' % dir) for file in [config_c_in, makefile_in] + supp_sources: if not os.path.exists(file): usage('needed file %s not found' % file) if not os.path.isfile(file): usage('%s: not a plain file' % file) for dir in extensions: setup = os.path.join(dir, 'Setup') if not os.path.exists(setup): usage('needed file %s not found' % setup) if not os.path.isfile(setup): usage('%s: not a plain file' % setup) if not args: usage('at least one filename argument required') if args[0][-3:] != ".py": usage('the script name must have a .py suffix') for arg in args: if not os.path.exists(arg): usage('argument %s not found' % arg) if not os.path.isfile(arg): usage('%s: not a plain file' % arg) scriptfile = args[0] modules = args[1:] base = os.path.basename(scriptfile) base, ext = os.path.splitext(base) if base: if base != scriptfile: target = base else: target = base + '.bin' base_frozen_c = frozen_c base_config_c = config_c base_target = target if odir and not os.path.isdir(odir): try: os.mkdir(odir) print "Created output directory", odir except os.error, msg: usage('%s: mkdir failed (%s)' % (odir, str(msg))) if odir: frozen_c = os.path.join(odir, frozen_c) config_c = os.path.join(odir, config_c) target = os.path.join(odir, target) makefile = os.path.join(odir, makefile) dict = findmodules.findmodules(scriptfile, modules, path) names = dict.keys() names.sort() print "Modules being frozen:" for name in names: print '\t', name backup = frozen_c + '~' try: os.rename(frozen_c, backup) except os.error: backup = None outfp = open(frozen_c, 'w') try: makefreeze.makefreeze(outfp, dict) finally: outfp.close() if backup: if cmp.cmp(backup, frozen_c): sys.stderr.write('%s not changed, not written\n' % frozen_c) os.rename(backup, frozen_c) builtins = [] unknown = [] mods = dict.keys() mods.sort() for mod in mods: if dict[mod] == '<builtin>': builtins.append(mod) elif dict[mod] == '<unknown>': unknown.append(mod) addfiles = [] if unknown: addfiles, addmods = \ checkextensions.checkextensions(unknown, extensions) for mod in addmods: unknown.remove(mod) builtins = builtins + addmods if unknown: sys.stderr.write('Warning: unknown modules remain: %s\n' % string.join(unknown)) builtins.sort() infp = open(config_c_in) backup = config_c + '~' try: os.rename(config_c, backup) except os.error: backup = None outfp = open(config_c, 'w') try: makeconfig.makeconfig(infp, outfp, builtins) finally: outfp.close() infp.close() if backup: if cmp.cmp(backup, config_c): sys.stderr.write('%s not changed, not written\n' % config_c) os.rename(backup, config_c) cflags = defines + includes + ['$(OPT)'] libs = [os.path.join(binlib, 'libpython$(VERSION).a')] makevars = parsesetup.getmakevars(makefile_in) somevars = {} for key in makevars.keys(): somevars[key] = makevars[key] somevars['CFLAGS'] = string.join(cflags) files = ['$(OPT)', '$(LDFLAGS)', base_config_c, base_frozen_c] + \ supp_sources + addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] backup = makefile + '~' try: os.rename(makefile, backup) except os.error: backup = None outfp = open(makefile, 'w') try: makemakefile.makemakefile(outfp, somevars, files, base_target) finally: outfp.close() if backup: if not cmp.cmp(backup, makefile): print 'previous Makefile saved as', backup else: sys.stderr.write('%s not changed, not written\n' % makefile) os.rename(backup, makefile) if odir: print 'Now run "make" in', odir, print 'to build the target:', base_target else: print 'Now run "make" to build the target:', base_target
def main(): # overridable context prefix = None # settable with -p option exec_prefix = None # settable with -P option extensions = [] path = sys.path odir = '' # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'he:o:p:P:') except getopt.error, msg: usage('getopt error: ' + str(msg)) # proces option arguments for o, a in opts: if o == '-h': print __doc__ return if o == '-e': extensions.append(a) if o == '-o': odir = a if o == '-p': prefix = a if o == '-P': exec_prefix = a # default prefix and exec_prefix if not exec_prefix: if prefix: exec_prefix = prefix else: exec_prefix = sys.exec_prefix if not prefix: prefix = sys.prefix # determine whether -p points to the Python source tree ishome = os.path.exists(os.path.join(prefix, 'Include', 'pythonrun.h')) # locations derived from options version = sys.version[:3] if ishome: print "(Using Python source directory)" binlib = exec_prefix incldir = os.path.join(prefix, 'Include') config_c_in = os.path.join(prefix, 'Modules', 'config.c.in') frozenmain_c = os.path.join(prefix, 'Modules', 'frozenmain.c') makefile_in = os.path.join(exec_prefix, 'Modules', 'Makefile') else: binlib = os.path.join(exec_prefix, 'lib', 'python%s' % version, 'config') incldir = os.path.join(prefix, 'include', 'python%s' % version) config_c_in = os.path.join(binlib, 'config.c.in') frozenmain_c = os.path.join(binlib, 'frozenmain.c') makefile_in = os.path.join(binlib, 'Makefile') supp_sources = [] defines = [] includes = ['-I' + incldir, '-I' + binlib] # sanity check of directories and files for dir in [prefix, exec_prefix, binlib, incldir] + extensions: if not os.path.exists(dir): usage('needed directory %s not found' % dir) if not os.path.isdir(dir): usage('%s: not a directory' % dir) for file in [config_c_in, makefile_in] + supp_sources: if not os.path.exists(file): usage('needed file %s not found' % file) if not os.path.isfile(file): usage('%s: not a plain file' % file) for dir in extensions: setup = os.path.join(dir, 'Setup') if not os.path.exists(setup): usage('needed file %s not found' % setup) if not os.path.isfile(setup): usage('%s: not a plain file' % setup) # check that enough arguments are passed if not args: usage('at least one filename argument required') # check that the script name ends in ".py" if args[0][-3:] != ".py": usage('the script name must have a .py suffix') # check that file arguments exist for arg in args: if not os.path.exists(arg): usage('argument %s not found' % arg) if not os.path.isfile(arg): usage('%s: not a plain file' % arg) # process non-option arguments scriptfile = args[0] modules = args[1:] # derive target name from script name base = os.path.basename(scriptfile) base, ext = os.path.splitext(base) if base: if base != scriptfile: target = base else: target = base + '.bin' # handle -o option base_frozen_c = frozen_c base_config_c = config_c base_target = target if odir and not os.path.isdir(odir): try: os.mkdir(odir) print "Created output directory", odir except os.error, msg: usage('%s: mkdir failed (%s)' % (odir, str(msg))) if odir: frozen_c = os.path.join(odir, frozen_c) config_c = os.path.join(odir, config_c) target = os.path.join(odir, target) makefile = os.path.join(odir,makefile) # Actual work starts here... dict = findmodules.findmodules(scriptfile, modules, path) names = dict.keys() names.sort() print "Modules being frozen:" for name in names: print '\t', name backup = frozen_c + '~' try: os.rename(frozen_c, backup) except os.error: backup = None outfp = open(frozen_c, 'w') try: makefreeze.makefreeze(outfp, dict) finally: outfp.close() if backup: if cmp.cmp(backup, frozen_c): sys.stderr.write('%s not changed, not written\n' % frozen_c) os.rename(backup, frozen_c) builtins = [] unknown = [] mods = dict.keys() mods.sort() for mod in mods: if dict[mod] == '<builtin>': builtins.append(mod) elif dict[mod] == '<unknown>': unknown.append(mod) addfiles = [] if unknown: addfiles, addmods = \ checkextensions.checkextensions(unknown, extensions) for mod in addmods: unknown.remove(mod) builtins = builtins + addmods if unknown: sys.stderr.write('Warning: unknown modules remain: %s\n' % string.join(unknown)) builtins.sort() infp = open(config_c_in) backup = config_c + '~' try: os.rename(config_c, backup) except os.error: backup = None outfp = open(config_c, 'w') try: makeconfig.makeconfig(infp, outfp, builtins) finally: outfp.close() infp.close() if backup: if cmp.cmp(backup, config_c): sys.stderr.write('%s not changed, not written\n' % config_c) os.rename(backup, config_c) cflags = defines + includes + ['$(OPT)'] libs = [os.path.join(binlib, 'libpython$(VERSION).a')] makevars = parsesetup.getmakevars(makefile_in) somevars = {} for key in makevars.keys(): somevars[key] = makevars[key] somevars['CFLAGS'] = string.join(cflags) # override files = ['$(OPT)', '$(LDFLAGS)', base_config_c, base_frozen_c] + \ supp_sources + addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] backup = makefile + '~' try: os.rename(makefile, backup) except os.error: backup = None outfp = open(makefile, 'w') try: makemakefile.makemakefile(outfp, somevars, files, base_target) finally: outfp.close() if backup: if not cmp.cmp(backup, makefile): print 'previous Makefile saved as', backup else: sys.stderr.write('%s not changed, not written\n' % makefile) os.rename(backup, makefile) # Done! if odir: print 'Now run "make" in', odir, print 'to build the target:', base_target else: print 'Now run "make" to build the target:', base_target
0b4b8a21ce943aa07584c1a6608be6246f214d90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0b4b8a21ce943aa07584c1a6608be6246f214d90/freeze.py
if completekey: try: import readline readline.set_completer(self.complete) readline.parse_and_bind(completekey+": complete") except ImportError: pass
self.completekey = completekey
def __init__(self, completekey='tab'): """Instantiate a line-oriented interpreter framework.
35a92ce9da03a7a8acce565708eba96bf7cc2f1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/35a92ce9da03a7a8acce565708eba96bf7cc2f1c/cmd.py
pass
if self.completekey: try: import readline self.old_completer = readline.get_completer() readline.set_completer(self.complete) readline.parse_and_bind(self.completekey+": complete") except ImportError: pass
def preloop(self): """Hook method executed once when the cmdloop() method is called.""" pass
35a92ce9da03a7a8acce565708eba96bf7cc2f1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/35a92ce9da03a7a8acce565708eba96bf7cc2f1c/cmd.py
pass
if self.completekey: try: import readline readline.set_completer(self.old_completer) except ImportError: pass
def postloop(self): """Hook method executed once when the cmdloop() method is about to return.
35a92ce9da03a7a8acce565708eba96bf7cc2f1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/35a92ce9da03a7a8acce565708eba96bf7cc2f1c/cmd.py
st = self.stream.Status() host = macdnr.AddrToStr(st.localHost) return host, st.localPort
host, port = self.stream.GetSockName() host = macdnr.AddrToStr(host) return host, port
def getsockname(self): st = self.stream.Status() host = macdnr.AddrToStr(st.localHost) return host, st.localPort
f90a113176df262aa7d495a57bdc0d09c8ac09bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f90a113176df262aa7d495a57bdc0d09c8ac09bb/socket.py
if not self.databuf: print '** socket: no data!' print '** recv: got ', len(self.databuf)
def recv(self, bufsize, flags=0): if flags: raise my_error, 'recv flags not yet supported on mac' if not self.databuf: try: self.databuf, urg, mark = self.stream.Rcv(0) if not self.databuf: print '** socket: no data!' print '** recv: got ', len(self.databuf) except mactcp.error, arg: if arg[0] != MACTCP.connectionClosing: raise mactcp.error, arg rv = self.databuf[:bufsize] self.databuf = self.databuf[bufsize:] return rv
f90a113176df262aa7d495a57bdc0d09c8ac09bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f90a113176df262aa7d495a57bdc0d09c8ac09bb/socket.py
print '** Readline:',self, `rv`
def readline(self): import string while not '\n' in self.buf: new = self.sock.recv(0x7fffffff) if not new: break self.buf = self.buf + new if not '\n' in self.buf: rv = self.buf self.buf = '' else: i = string.index(self.buf, '\n') rv = self.buf[:i+1] self.buf = self.buf[i+1:] print '** Readline:',self, `rv` return rv
f90a113176df262aa7d495a57bdc0d09c8ac09bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f90a113176df262aa7d495a57bdc0d09c8ac09bb/socket.py
import sys, os, tempfile
import sys, os, tempfile, time
def test_bug737473(self): import sys, os, tempfile savedpath = sys.path[:] testdir = tempfile.mkdtemp() try: sys.path.insert(0, testdir) testfile = os.path.join(testdir, 'test_bug737473.py') print >> open(testfile, 'w'), """\
f1af9c089634b84c1dbbdabed35cd2d43cf6ff04 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f1af9c089634b84c1dbbdabed35cd2d43cf6ff04/test_traceback.py
os.utime(testfile, (0, 0))
past = time.time() - 3 os.utime(testfile, (past, past))
def test(): raise ValueError""" if hasattr(os, 'utime'): os.utime(testfile, (0, 0)) else: import time time.sleep(3) # not to stay in same mtime. if 'test_bug737473' in sys.modules: del sys.modules['test_bug737473'] import test_bug737473 try: test_bug737473.test() except ValueError: # this loads source code to linecache traceback.extract_tb(sys.exc_traceback) print >> open(testfile, 'w'), """\
f1af9c089634b84c1dbbdabed35cd2d43cf6ff04 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f1af9c089634b84c1dbbdabed35cd2d43cf6ff04/test_traceback.py
"""translate(s,table [,deletechars]) -> string
"""translate(s,table [,deletions]) -> string
def translate(s, table, deletions=""): """translate(s,table [,deletechars]) -> string Return a copy of the string s, where all characters occurring in the optional argument deletechars are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256. """ return s.translate(table, deletions)
5aff7752eb28c6ddaa68738ee77e1947b72e1a58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5aff7752eb28c6ddaa68738ee77e1947b72e1a58/string.py
in the optional argument deletechars are removed, and the
in the optional argument deletions are removed, and the
def translate(s, table, deletions=""): """translate(s,table [,deletechars]) -> string Return a copy of the string s, where all characters occurring in the optional argument deletechars are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256. """ return s.translate(table, deletions)
5aff7752eb28c6ddaa68738ee77e1947b72e1a58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5aff7752eb28c6ddaa68738ee77e1947b72e1a58/string.py
translation table, which must be a string of length 256. """ return s.translate(table, deletions)
translation table, which must be a string of length 256. The deletions argument is not allowed for Unicode strings. """ if deletions: return s.translate(table, deletions) else: return s.translate(table + s[:0])
def translate(s, table, deletions=""): """translate(s,table [,deletechars]) -> string Return a copy of the string s, where all characters occurring in the optional argument deletechars are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256. """ return s.translate(table, deletions)
5aff7752eb28c6ddaa68738ee77e1947b72e1a58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5aff7752eb28c6ddaa68738ee77e1947b72e1a58/string.py
n_lines += 1
def write_results_file(self, path, lines, lnotab, lines_hit): """Return a coverage results file in path."""
546e34b654b03333cee0ba968c9f856a9b0b28d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/546e34b654b03333cee0ba968c9f856a9b0b28d1/trace.py
def search_function(encoding): # Cache lookup entry = _cache.get(encoding,_unknown) if entry is not _unknown: return entry # Import the module modname = encoding.replace('-', '_') modname = aliases.aliases.get(modname,modname) try: mod = __import__(modname,globals(),locals(),'*') except ImportError,why: _cache[encoding] = None return None # Now ask the module for the registry entry try: entry = tuple(mod.getregentry()) except AttributeError: entry = () if len(entry) != 4: raise SystemError,\ 'module "%s.%s" failed to register' % \ (__name__,modname) for obj in entry: if not callable(obj): raise SystemError,\ 'incompatible codecs in module "%s.%s"' % \ (__name__,modname) # Cache the encoding and its aliases _cache[encoding] = entry try: codecaliases = mod.getaliases() except AttributeError: pass else: for alias in codecaliases: _cache[alias] = entry return entry
988ad2bdff836665f004c285fb09182c35775fd6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/988ad2bdff836665f004c285fb09182c35775fd6/__init__.py