rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
traceback.print_exc() | traceback.print_exc() | def handle_error(self, request, client_address): """Handle an error gracefully. May be overridden. | 6ec81d9983655c1decc44a7d9d7195ed1148d6ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6ec81d9983655c1decc44a7d9d7195ed1148d6ba/SocketServer.py |
self.socket.close() | self.server_close() | def process_request(self, request, client_address): """Fork a new subprocess to process the request.""" self.collect_children() pid = os.fork() if pid: # Parent process if self.active_children is None: self.active_children = [] self.active_children.append(pid) return else: # Child process. # This must never return, hence os._exit()! try: self.socket.close() self.finish_request(request, client_address) os._exit(0) except: try: self.handle_error(request, client_address) finally: os._exit(1) | 6ec81d9983655c1decc44a7d9d7195ed1148d6ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6ec81d9983655c1decc44a7d9d7195ed1148d6ba/SocketServer.py |
"""Configure resources of an item. | """Configure resources of an ITEM. | def itemconfigure(self, index, cnf=None, **kw): """Configure resources of an item. | b866941ab00820b51b584c3ec67bfce168797161 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b866941ab00820b51b584c3ec67bfce168797161/Tkinter.py |
hasn't been loaded yet). The file is searched on sys.path.""" | hasn't been loaded yet). The file is searched on sys.path; the .py suffix may be omitted.""" | def help_b(self): print """b(reak) ([file:]lineno | function) [, "condition"] | e6af561e644b3c3d27f74762680a82963535cb3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6af561e644b3c3d27f74762680a82963535cb3b/pdb.py |
print """cl(ear) [lineno] | print """cl(ear) [file:][lineno] | def help_cl(self): print """cl(ear) [lineno] | e6af561e644b3c3d27f74762680a82963535cb3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6af561e644b3c3d27f74762680a82963535cb3b/pdb.py |
hasn't been loaded yet). The file is searched on sys.path.""" | hasn't been loaded yet). The file is searched on sys.path; the .py suffix may be omitted.""" | def help_cl(self): print """cl(ear) [lineno] | e6af561e644b3c3d27f74762680a82963535cb3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6af561e644b3c3d27f74762680a82963535cb3b/pdb.py |
Output("static int %s_init(PyObject *self, PyObject *args, PyObject *kwds)", self.prefix) | Output("static int %s_tp_init(PyObject *self, PyObject *args, PyObject *kwds)", self.prefix) | def output_tp_init(self): if self.output_tp_initBody: Output("static int %s_init(PyObject *self, PyObject *args, PyObject *kwds)", self.prefix) OutLbrace() self.output_tp_initBody() OutRbrace() else: Output("#define %s_tp_init 0", self.prefix) Output() | f719d6ba9e91a494416bc42472d9a4d945672b3f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f719d6ba9e91a494416bc42472d9a4d945672b3f/bgenObjectDefinition.py |
os.environ.update(env) | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%s)" % `scriptname`) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%s)" % `scriptname`) return ispy = self.is_python(scriptname) if not ispy: if not (self.have_fork or self.have_popen2 or self.have_popen3): self.send_error(403, "CGI script is not a Python script (%s)" % `scriptname`) return if not self.is_executable(scriptfile): self.send_error(403, "CGI script is not executable (%s)" % `scriptname`) return | ed3ac1f6fb54732fb22e4dbf537cf8eb804d1761 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ed3ac1f6fb54732fb22e4dbf537cf8eb804d1761/CGIHTTPServer.py |
|
os.environ.update(env) | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%s)" % `scriptname`) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%s)" % `scriptname`) return ispy = self.is_python(scriptname) if not ispy: if not (self.have_fork or self.have_popen2 or self.have_popen3): self.send_error(403, "CGI script is not a Python script (%s)" % `scriptname`) return if not self.is_executable(scriptfile): self.send_error(403, "CGI script is not executable (%s)" % `scriptname`) return | ed3ac1f6fb54732fb22e4dbf537cf8eb804d1761 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ed3ac1f6fb54732fb22e4dbf537cf8eb804d1761/CGIHTTPServer.py |
|
if os.path.isabs(curkeyvalue): | if string.lower(curkeyvalue[:10]) == '{compiler}': curkeyvalue = curkeyvalue[10:] self.dict['pathtype'] = 'CodeWarrior' elif string.lower(curkeyvalue[:9]) == '{project}': curkeyvalue = curkeyvalue[9:] self.dict['pathtype'] = 'Project' elif curkeyvalue[0] == '{': raise Error, "Unknown {} escape in %s"%curkeyvalue elif os.path.isabs(curkeyvalue): | def _generate_one_template(self, tmpl): resultname, datasource, dataname, key = tmpl result = '' if key: # This is a multi-element rule. Run for every item in dict[key] if self.dict.has_key(key): keyvalues = self.dict[key] try: if not type(keyvalues) in (type(()), type([])): raise Error, "List or tuple expected for %s"%key for curkeyvalue in keyvalues: if os.path.isabs(curkeyvalue): self.dict['pathtype'] = 'Absolute' else: self.dict['pathtype'] = 'Project' if curkeyvalue[-2:] == ':*': curkeyvalue = curkeyvalue[:-2] self.dict['recursive'] = 'true' else: self.dict['recursive'] = 'false' self.dict[key] = curkeyvalue curkeyvalueresult = self._generate_one_value(datasource, dataname) result = result + curkeyvalueresult finally: # Restore the list self.dict[key] = keyvalues self.dict['pathtype'] = None del self.dict['pathtype'] self.dict['recursive'] = None del self.dict['recursive'] else: # Not a multi-element rule. Simply generate result = self._generate_one_value(datasource, dataname) # And store the result self.dict[resultname] = result | 4381cff6296f227219b0b364ed22e1d0970ea76d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4381cff6296f227219b0b364ed22e1d0970ea76d/cwxmlgen.py |
def yview(self, *what): | def xview_moveto(self, fraction): """Adjusts the view in the window so that FRACTION of the total width of the canvas is off-screen to the left.""" self.tk.call(self._w, 'xview', 'moveto', fraction) def xview_scroll(self, number, what): """Shift the x-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" self.tk.call(self._w, 'xview', 'scroll', number, what) def yview(self, *args): | def yview(self, *what): """Query and change vertical position of the view.""" if not what: return self._getdoubles(self.tk.call(self._w, 'yview')) self.tk.call((self._w, 'yview') + what) | f22ed0a21188a02a1ed8f474529824e96ad0bdde /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f22ed0a21188a02a1ed8f474529824e96ad0bdde/Tkinter.py |
if not what: | if not args: | def yview(self, *what): """Query and change vertical position of the view.""" if not what: return self._getdoubles(self.tk.call(self._w, 'yview')) self.tk.call((self._w, 'yview') + what) | f22ed0a21188a02a1ed8f474529824e96ad0bdde /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f22ed0a21188a02a1ed8f474529824e96ad0bdde/Tkinter.py |
self.tk.call((self._w, 'yview') + what) | self.tk.call((self._w, 'yview') + args) def yview_moveto(self, fraction): """Adjusts the view in the window so that FRACTION of the total height of the canvas is off-screen to the top.""" self.tk.call(self._w, 'yview', 'moveto', fraction) def yview_scroll(self, number, what): """Shift the y-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" self.tk.call(self._w, 'yview', 'scroll', number, what) | def yview(self, *what): """Query and change vertical position of the view.""" if not what: return self._getdoubles(self.tk.call(self._w, 'yview')) self.tk.call((self._w, 'yview') + what) | f22ed0a21188a02a1ed8f474529824e96ad0bdde /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f22ed0a21188a02a1ed8f474529824e96ad0bdde/Tkinter.py |
self.tabCols=IntVar(self) | def CreatePageFontTab(self): #tkVars self.fontSize=StringVar(self) self.fontBold=BooleanVar(self) self.fontName=StringVar(self) self.spaceNum=IntVar(self) self.tabCols=IntVar(self) self.indentBySpaces=BooleanVar(self) self.editFont=tkFont.Font(self,('courier',12,'normal')) ##widget creation #body frame frame=self.tabPages.pages['Fonts/Tabs']['page'] #body section frames frameFont=Frame(frame,borderwidth=2,relief=GROOVE) frameIndent=Frame(frame,borderwidth=2,relief=GROOVE) #frameFont labelFontTitle=Label(frameFont,text='Set Base Editor Font') frameFontName=Frame(frameFont) frameFontParam=Frame(frameFont) labelFontNameTitle=Label(frameFontName,justify=LEFT, text='Font :') self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE, exportselection=FALSE) self.listFontName.bind('<ButtonRelease-1>',self.OnListFontButtonRelease) scrollFont=Scrollbar(frameFontName) scrollFont.config(command=self.listFontName.yview) self.listFontName.config(yscrollcommand=scrollFont.set) labelFontSizeTitle=Label(frameFontParam,text='Size :') self.optMenuFontSize=DynOptionMenu(frameFontParam,self.fontSize,None, command=self.SetFontSample) checkFontBold=Checkbutton(frameFontParam,variable=self.fontBold, onvalue=1,offvalue=0,text='Bold',command=self.SetFontSample) frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1) self.labelFontSample=Label(frameFontSample, text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]', justify=LEFT,font=self.editFont) #frameIndent labelIndentTitle=Label(frameIndent,text='Set Indentation Defaults') frameIndentType=Frame(frameIndent) frameIndentSize=Frame(frameIndent) labelIndentTypeTitle=Label(frameIndentType, text='Choose indentation type :') radioUseSpaces=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=1,text='Tab key inserts spaces') radioUseTabs=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=0,text='Tab key inserts tabs') labelIndentSizeTitle=Label(frameIndentSize, text='Choose indentation size :') labelSpaceNumTitle=Label(frameIndentSize,justify=LEFT, text='when tab key inserts spaces,\nspaces per indent') self.scaleSpaceNum=Scale(frameIndentSize,variable=self.spaceNum, orient='horizontal',tickinterval=2,from_=2,to=8) #labeltabColsTitle=Label(frameIndentSize,justify=LEFT, # text='when tab key inserts tabs,\ncolumns per tab') #self.scaleTabCols=Scale(frameIndentSize,variable=self.tabCols, # orient='horizontal',tickinterval=2,from_=2,to=8) #widget packing #body frameFont.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH) frameIndent.pack(side=LEFT,padx=5,pady=10,fill=Y) #frameFont labelFontTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameFontName.pack(side=TOP,padx=5,pady=5,fill=X) frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X) labelFontNameTitle.pack(side=TOP,anchor=W) self.listFontName.pack(side=LEFT,expand=TRUE,fill=X) scrollFont.pack(side=LEFT,fill=Y) labelFontSizeTitle.pack(side=LEFT,anchor=W) self.optMenuFontSize.pack(side=LEFT,anchor=W) checkFontBold.pack(side=LEFT,anchor=W,padx=20) frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) self.labelFontSample.pack(expand=TRUE,fill=BOTH) #frameIndent labelIndentTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameIndentType.pack(side=TOP,padx=5,fill=X) frameIndentSize.pack(side=TOP,padx=5,pady=5,fill=BOTH) labelIndentTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) radioUseSpaces.pack(side=TOP,anchor=W,padx=5) radioUseTabs.pack(side=TOP,anchor=W,padx=5) labelIndentSizeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5) self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X) #labeltabColsTitle.pack(side=TOP,anchor=W,padx=5) #self.scaleTabCols.pack(side=TOP,padx=5,fill=X) return frame | 273f638753836ea9e35ef1fa89d88d1a9d1b31fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/273f638753836ea9e35ef1fa89d88d1a9d1b31fe/configDialog.py |
|
orient='horizontal',tickinterval=2,from_=2,to=8) | orient='horizontal',tickinterval=2,from_=2,to=10) | def CreatePageFontTab(self): #tkVars self.fontSize=StringVar(self) self.fontBold=BooleanVar(self) self.fontName=StringVar(self) self.spaceNum=IntVar(self) self.tabCols=IntVar(self) self.indentBySpaces=BooleanVar(self) self.editFont=tkFont.Font(self,('courier',12,'normal')) ##widget creation #body frame frame=self.tabPages.pages['Fonts/Tabs']['page'] #body section frames frameFont=Frame(frame,borderwidth=2,relief=GROOVE) frameIndent=Frame(frame,borderwidth=2,relief=GROOVE) #frameFont labelFontTitle=Label(frameFont,text='Set Base Editor Font') frameFontName=Frame(frameFont) frameFontParam=Frame(frameFont) labelFontNameTitle=Label(frameFontName,justify=LEFT, text='Font :') self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE, exportselection=FALSE) self.listFontName.bind('<ButtonRelease-1>',self.OnListFontButtonRelease) scrollFont=Scrollbar(frameFontName) scrollFont.config(command=self.listFontName.yview) self.listFontName.config(yscrollcommand=scrollFont.set) labelFontSizeTitle=Label(frameFontParam,text='Size :') self.optMenuFontSize=DynOptionMenu(frameFontParam,self.fontSize,None, command=self.SetFontSample) checkFontBold=Checkbutton(frameFontParam,variable=self.fontBold, onvalue=1,offvalue=0,text='Bold',command=self.SetFontSample) frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1) self.labelFontSample=Label(frameFontSample, text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]', justify=LEFT,font=self.editFont) #frameIndent labelIndentTitle=Label(frameIndent,text='Set Indentation Defaults') frameIndentType=Frame(frameIndent) frameIndentSize=Frame(frameIndent) labelIndentTypeTitle=Label(frameIndentType, text='Choose indentation type :') radioUseSpaces=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=1,text='Tab key inserts spaces') radioUseTabs=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=0,text='Tab key inserts tabs') labelIndentSizeTitle=Label(frameIndentSize, text='Choose indentation size :') labelSpaceNumTitle=Label(frameIndentSize,justify=LEFT, text='when tab key inserts spaces,\nspaces per indent') self.scaleSpaceNum=Scale(frameIndentSize,variable=self.spaceNum, orient='horizontal',tickinterval=2,from_=2,to=8) #labeltabColsTitle=Label(frameIndentSize,justify=LEFT, # text='when tab key inserts tabs,\ncolumns per tab') #self.scaleTabCols=Scale(frameIndentSize,variable=self.tabCols, # orient='horizontal',tickinterval=2,from_=2,to=8) #widget packing #body frameFont.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH) frameIndent.pack(side=LEFT,padx=5,pady=10,fill=Y) #frameFont labelFontTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameFontName.pack(side=TOP,padx=5,pady=5,fill=X) frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X) labelFontNameTitle.pack(side=TOP,anchor=W) self.listFontName.pack(side=LEFT,expand=TRUE,fill=X) scrollFont.pack(side=LEFT,fill=Y) labelFontSizeTitle.pack(side=LEFT,anchor=W) self.optMenuFontSize.pack(side=LEFT,anchor=W) checkFontBold.pack(side=LEFT,anchor=W,padx=20) frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) self.labelFontSample.pack(expand=TRUE,fill=BOTH) #frameIndent labelIndentTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameIndentType.pack(side=TOP,padx=5,fill=X) frameIndentSize.pack(side=TOP,padx=5,pady=5,fill=BOTH) labelIndentTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) radioUseSpaces.pack(side=TOP,anchor=W,padx=5) radioUseTabs.pack(side=TOP,anchor=W,padx=5) labelIndentSizeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5) self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X) #labeltabColsTitle.pack(side=TOP,anchor=W,padx=5) #self.scaleTabCols.pack(side=TOP,padx=5,fill=X) return frame | 273f638753836ea9e35ef1fa89d88d1a9d1b31fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/273f638753836ea9e35ef1fa89d88d1a9d1b31fe/configDialog.py |
self.tabCols.trace_variable('w',self.VarChanged_tabCols) | def AttachVarCallbacks(self): self.fontSize.trace_variable('w',self.VarChanged_fontSize) self.fontName.trace_variable('w',self.VarChanged_fontName) self.fontBold.trace_variable('w',self.VarChanged_fontBold) self.spaceNum.trace_variable('w',self.VarChanged_spaceNum) self.tabCols.trace_variable('w',self.VarChanged_tabCols) self.indentBySpaces.trace_variable('w',self.VarChanged_indentBySpaces) self.colour.trace_variable('w',self.VarChanged_colour) self.builtinTheme.trace_variable('w',self.VarChanged_builtinTheme) self.customTheme.trace_variable('w',self.VarChanged_customTheme) self.themeIsBuiltin.trace_variable('w',self.VarChanged_themeIsBuiltin) self.highlightTarget.trace_variable('w',self.VarChanged_highlightTarget) self.keyBinding.trace_variable('w',self.VarChanged_keyBinding) self.builtinKeys.trace_variable('w',self.VarChanged_builtinKeys) self.customKeys.trace_variable('w',self.VarChanged_customKeys) self.keysAreBuiltin.trace_variable('w',self.VarChanged_keysAreBuiltin) self.winWidth.trace_variable('w',self.VarChanged_winWidth) self.winHeight.trace_variable('w',self.VarChanged_winHeight) self.startupEdit.trace_variable('w',self.VarChanged_startupEdit) | 273f638753836ea9e35ef1fa89d88d1a9d1b31fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/273f638753836ea9e35ef1fa89d88d1a9d1b31fe/configDialog.py |
|
def VarChanged_tabCols(self,*params): value=self.tabCols.get() self.AddChangedItem('main','Indent','tab-cols',value) | def VarChanged_tabCols(self,*params): value=self.tabCols.get() self.AddChangedItem('main','Indent','tab-cols',value) | 273f638753836ea9e35ef1fa89d88d1a9d1b31fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/273f638753836ea9e35ef1fa89d88d1a9d1b31fe/configDialog.py |
|
if pw: | if pw is not None: | def retry_http_basic_auth(self, host, req, realm): user,pw = self.passwd.find_user_password(realm, host) if pw: raw = "%s:%s" % (user, pw) auth = 'Basic %s' % base64.encodestring(raw).strip() if req.headers.get(self.auth_header, None) == auth: return None req.add_header(self.auth_header, auth) return self.parent.open(req) else: return None | 7aed4543999ecf820fd35689ae78d4075ccf213a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7aed4543999ecf820fd35689ae78d4075ccf213a/urllib2.py |
vars, lasttoken, parent, prefix = [], None, None, '' | vars, lasttoken, parent, prefix, value = [], None, None, '', __UNDEF__ | def scanvars(reader, frame, locals): """Scan one logical line of Python and look up values of variables used.""" import tokenize, keyword vars, lasttoken, parent, prefix = [], None, None, '' for ttype, token, start, end, line in tokenize.generate_tokens(reader): if ttype == tokenize.NEWLINE: break if ttype == tokenize.NAME and token not in keyword.kwlist: if lasttoken == '.': if parent is not __UNDEF__: value = getattr(parent, token, __UNDEF__) vars.append((prefix + token, prefix, value)) else: where, value = lookup(token, frame, locals) vars.append((token, where, value)) elif token == '.': prefix += lasttoken + '.' parent = value else: parent, prefix = None, '' lasttoken = token return vars | 6168e0a8bd85aa62e38cf9ffb93a175197a177cc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6168e0a8bd85aa62e38cf9ffb93a175197a177cc/cgitb.py |
<<<<<<< Vrec.py | def main(): format = SV.RGB8_FRAMES qsize = 2 audio = 0 rate = 2 width = 0 norecord = 0 drop = 0 mono = 0 grey = 0 monotreshold = -1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:w:ndgmM:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': qsize = string.atoi(arg) elif opt == '-r': rate = string.atoi(arg) if rate < 2: sys.stderr.write('-r rate must be >= 2\n') sys.exit(2) elif opt == '-w': width = string.atoi(arg) elif opt == '-n': norecord = 1 elif opt == '-d': drop = 1 elif opt == '-g': grey = 1 elif opt == '-m': mono = 1 elif opt == '-M': mono = 1 monotreshold = string.atoi(arg) if args[2:]: sys.stderr.write('usage: Vrec [options] [file [audiofile]]\n') sys.exit(2) if args: filename = args[0] else: filename = 'film.video' if args[1:] and not audio: sys.stderr.write('-a turned on by appearance of 2nd file\n') audio = 1 if audio: if args[1:]: audiofilename = args[1] else: audiofilename = 'film.aiff' else: audiofilename = None if norecord: filename = audiofilename = '' v = sv.OpenVideo() # Determine maximum window size based on signal standard param = [SV.BROADCAST, 0] v.GetParam(param) if param[1] == SV.PAL: x = SV.PAL_XMAX y = SV.PAL_YMAX elif param[1] == SV.NTSC: x = SV.NTSC_XMAX y = SV.NTSC_YMAX else: print 'Unknown video standard', param[1] sys.exit(1) gl.foreground() gl.maxsize(x, y) gl.keepaspect(x, y) gl.stepunit(8, 6) if width: gl.prefsize(width, width*3/4) win = gl.winopen(filename) if width: gl.maxsize(x, y) gl.keepaspect(x, y) gl.stepunit(8, 6) gl.winconstraints() x, y = gl.getsize() print x, 'x', y v.SetSize(x, y) | cc4967ad870844fcd568bf1e374c367ab53cff8d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cc4967ad870844fcd568bf1e374c367ab53cff8d/Vrec.py |
|
======= param = [SV.FIELDDROP, 0] v.SetParam(param) >>>>>>> 1.7 | def main(): format = SV.RGB8_FRAMES qsize = 2 audio = 0 rate = 2 width = 0 norecord = 0 drop = 0 mono = 0 grey = 0 monotreshold = -1 opts, args = getopt.getopt(sys.argv[1:], 'aq:r:w:ndgmM:') for opt, arg in opts: if opt == '-a': audio = 1 elif opt == '-q': qsize = string.atoi(arg) elif opt == '-r': rate = string.atoi(arg) if rate < 2: sys.stderr.write('-r rate must be >= 2\n') sys.exit(2) elif opt == '-w': width = string.atoi(arg) elif opt == '-n': norecord = 1 elif opt == '-d': drop = 1 elif opt == '-g': grey = 1 elif opt == '-m': mono = 1 elif opt == '-M': mono = 1 monotreshold = string.atoi(arg) if args[2:]: sys.stderr.write('usage: Vrec [options] [file [audiofile]]\n') sys.exit(2) if args: filename = args[0] else: filename = 'film.video' if args[1:] and not audio: sys.stderr.write('-a turned on by appearance of 2nd file\n') audio = 1 if audio: if args[1:]: audiofilename = args[1] else: audiofilename = 'film.aiff' else: audiofilename = None if norecord: filename = audiofilename = '' v = sv.OpenVideo() # Determine maximum window size based on signal standard param = [SV.BROADCAST, 0] v.GetParam(param) if param[1] == SV.PAL: x = SV.PAL_XMAX y = SV.PAL_YMAX elif param[1] == SV.NTSC: x = SV.NTSC_XMAX y = SV.NTSC_YMAX else: print 'Unknown video standard', param[1] sys.exit(1) gl.foreground() gl.maxsize(x, y) gl.keepaspect(x, y) gl.stepunit(8, 6) if width: gl.prefsize(width, width*3/4) win = gl.winopen(filename) if width: gl.maxsize(x, y) gl.keepaspect(x, y) gl.stepunit(8, 6) gl.winconstraints() x, y = gl.getsize() print x, 'x', y v.SetSize(x, y) | cc4967ad870844fcd568bf1e374c367ab53cff8d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cc4967ad870844fcd568bf1e374c367ab53cff8d/Vrec.py |
|
queue.put(data, int(id*tpf)) | queue.put((data, int(id*tpf))) | def record(v, info, filename, audiofilename, mono, grey, monotreshold): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile.VoutFile().init(filename) if mono: vout.format = 'mono' elif grey: vout.format = 'grey' else: vout.format = 'rgb8' vout.width = x vout.height = y vout.writeheader() MAXSIZE = 20 # XXX should be a user option import Queue queue = Queue.Queue().init(MAXSIZE) done = thread.allocate_lock() done.acquire_lock() thread.start_new_thread(saveframes, \ (vout, queue, done, mono, monotreshold)) if audiofilename: audiodone = thread.allocate_lock() audiodone.acquire_lock() audiostop = [] initaudio(audiofilename, audiostop, audiodone) gl.wintitle('(rec) ' + filename) lastid = 0 t0 = time.millitimer() count = 0 timestamps = [] ids = [] v.InitContinuousCapture(info) while not gl.qtest(): try: cd, id = v.GetCaptureData() except sv.error: time.millisleep(10) # XXX is this necessary? continue timestamps.append(time.millitimer()) ids.append(id) id = id + 2*rate | cc4967ad870844fcd568bf1e374c367ab53cff8d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cc4967ad870844fcd568bf1e374c367ab53cff8d/Vrec.py |
print 'Captured',count*2, 'fields,', 0.1*int(count*20000.0/(t1-t0)), 'f/s', print count*200.0/lastid, '%,', print count*rate*200.0/lastid, '% of wanted rate' | print 'Captured',count*2, 'fields,', print 0.1*int(count*20000.0/(t1-t0)), 'f/s', if lastid: print count*200.0/lastid, '%,', print count*rate*200.0/lastid, '% of wanted rate', print | def record(v, info, filename, audiofilename, mono, grey, monotreshold): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile.VoutFile().init(filename) if mono: vout.format = 'mono' elif grey: vout.format = 'grey' else: vout.format = 'rgb8' vout.width = x vout.height = y vout.writeheader() MAXSIZE = 20 # XXX should be a user option import Queue queue = Queue.Queue().init(MAXSIZE) done = thread.allocate_lock() done.acquire_lock() thread.start_new_thread(saveframes, \ (vout, queue, done, mono, monotreshold)) if audiofilename: audiodone = thread.allocate_lock() audiodone.acquire_lock() audiostop = [] initaudio(audiofilename, audiostop, audiodone) gl.wintitle('(rec) ' + filename) lastid = 0 t0 = time.millitimer() count = 0 timestamps = [] ids = [] v.InitContinuousCapture(info) while not gl.qtest(): try: cd, id = v.GetCaptureData() except sv.error: time.millisleep(10) # XXX is this necessary? continue timestamps.append(time.millitimer()) ids.append(id) id = id + 2*rate | cc4967ad870844fcd568bf1e374c367ab53cff8d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cc4967ad870844fcd568bf1e374c367ab53cff8d/Vrec.py |
print 'ratecv' state = (-8000, ((256, 512),)) if audioop.ratecv(data[0], 1, 1, 8000, 16000, state) != \ ('\001\000\000\001\001\002', state): return 0 | print 'ratecv' state = None d1, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) d2, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) if d1 + d2 != '\000\000\001\001\002\001\000\000\001\001\002': return 0 | def testratecv(data): if verbose: print 'ratecv' state = (-8000, ((256, 512),)) if audioop.ratecv(data[0], 1, 1, 8000, 16000, state) != \ ('\001\000\000\001\001\002', state): return 0 return 1 | 8c511db5a463b1ee6190e846b4b4c33970acee2b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8c511db5a463b1ee6190e846b4b4c33970acee2b/test_audioop.py |
@contextmanager | @contextfactory | def contextfactory(func): """@contextfactory decorator. Typical usage: @contextmanager def some_generator(<arguments>): <setup> try: yield <value> finally: <cleanup> This makes this: with some_generator(<arguments>) as <variable>: <body> equivalent to this: <setup> try: <variable> = <value> <body> finally: <cleanup> """ def helper(*args, **kwds): return GeneratorContext(func(*args, **kwds)) try: helper.__name__ = func.__name__ helper.__doc__ = func.__doc__ helper.__dict__ = func.__dict__ except: pass return helper | e58215e8d2938e0002b5c116711f9b4e619080f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e58215e8d2938e0002b5c116711f9b4e619080f9/contextlib.py |
def read(self,size=None): | def read(self, size=None): | def read(self,size=None): if self.extrasize <= 0 and self.fileobj is None: return '' | aab6114b4ac22af79a626d35d5a460c8cca77f9e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/aab6114b4ac22af79a626d35d5a460c8cca77f9e/gzip.py |
self.extrasize = len(buf) + self.extrasize | self.extrasize = len(self.extrabuf) | def _unread(self, buf): self.extrabuf = buf + self.extrabuf self.extrasize = len(buf) + self.extrasize | aab6114b4ac22af79a626d35d5a460c8cca77f9e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/aab6114b4ac22af79a626d35d5a460c8cca77f9e/gzip.py |
bufs.append(c[:i]) | bufs.append(c[:i+1]) | def readline(self): bufs = [] readsize = 100 while 1: c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2 | aab6114b4ac22af79a626d35d5a460c8cca77f9e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/aab6114b4ac22af79a626d35d5a460c8cca77f9e/gzip.py |
def get_python_version (): | def get_python_version(): | def get_python_version (): """Return a string containing the major and minor Python version, leaving off the patchlevel. Sample return values could be '1.5' or '2.2'. """ return sys.version[:3] | 2356cd82c3490347fc50ac030d0ebcb8dc8543a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2356cd82c3490347fc50ac030d0ebcb8dc8543a5/sysconfig.py |
return os.path.join(prefix, "include", "python" + sys.version[:3]) | return os.path.join(prefix, "include", "python" + get_python_version()) | def get_python_inc(plat_specific=0, prefix=None): """Return the directory containing installed Python header files. If 'plat_specific' is false (the default), this is the path to the non-platform-specific header files, i.e. Python.h and so on; otherwise, this is the path to platform-specific header files (namely pyconfig.h). If 'prefix' is supplied, use it instead of sys.prefix or sys.exec_prefix -- i.e., ignore 'plat_specific'. """ if prefix is None: prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": if python_build: base = os.path.dirname(os.path.abspath(sys.executable)) if plat_specific: inc_dir = base else: inc_dir = os.path.join(base, "Include") if not os.path.exists(inc_dir): inc_dir = os.path.join(os.path.dirname(base), "Include") return inc_dir return os.path.join(prefix, "include", "python" + sys.version[:3]) elif os.name == "nt": return os.path.join(prefix, "include") elif os.name == "mac": if plat_specific: return os.path.join(prefix, "Mac", "Include") else: return os.path.join(prefix, "Include") elif os.name == "os2": return os.path.join(prefix, "Include") else: raise DistutilsPlatformError( "I don't know where Python installs its C header files " "on platform '%s'" % os.name) | 2356cd82c3490347fc50ac030d0ebcb8dc8543a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2356cd82c3490347fc50ac030d0ebcb8dc8543a5/sysconfig.py |
if sys.version < "2.2": | if get_python_version() < "2.2": | def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): """Return the directory containing the Python library (standard or site additions). If 'plat_specific' is true, return the directory containing platform-specific modules, i.e. any module from a non-pure-Python module distribution; otherwise, return the platform-shared library directory. If 'standard_lib' is true, return the directory containing standard Python library modules; otherwise, return the directory for site-specific modules. If 'prefix' is supplied, use it instead of sys.prefix or sys.exec_prefix -- i.e., ignore 'plat_specific'. """ if prefix is None: prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": libpython = os.path.join(prefix, "lib", "python" + get_python_version()) if standard_lib: return libpython else: return os.path.join(libpython, "site-packages") elif os.name == "nt": if standard_lib: return os.path.join(prefix, "Lib") else: if sys.version < "2.2": return prefix else: return os.path.join(PREFIX, "Lib", "site-packages") elif os.name == "mac": if plat_specific: if standard_lib: return os.path.join(prefix, "Lib", "lib-dynload") else: return os.path.join(prefix, "Lib", "site-packages") else: if standard_lib: return os.path.join(prefix, "Lib") else: return os.path.join(prefix, "Lib", "site-packages") elif os.name == "os2": if standard_lib: return os.path.join(PREFIX, "Lib") else: return os.path.join(PREFIX, "Lib", "site-packages") else: raise DistutilsPlatformError( "I don't know where Python installs its library " "on platform '%s'" % os.name) | 2356cd82c3490347fc50ac030d0ebcb8dc8543a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2356cd82c3490347fc50ac030d0ebcb8dc8543a5/sysconfig.py |
if sys.version < '2.2': | if get_python_version() < '2.2': | def get_config_h_filename(): """Return full pathname of installed pyconfig.h file.""" if python_build: inc_dir = os.curdir else: inc_dir = get_python_inc(plat_specific=1) if sys.version < '2.2': config_h = 'config.h' else: # The name of the config.h file changed in 2.2 config_h = 'pyconfig.h' return os.path.join(inc_dir, config_h) | 2356cd82c3490347fc50ac030d0ebcb8dc8543a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2356cd82c3490347fc50ac030d0ebcb8dc8543a5/sysconfig.py |
elif sys.version < '2.1': | elif get_python_version() < '2.1': | def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" g = {} # load the installed Makefile: try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): my_msg = my_msg + " (%s)" % msg.strerror raise DistutilsPlatformError(my_msg) # On MacOSX we need to check the setting of the environment variable # MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so # it needs to be compatible. # If it isn't set we set it to the configure-time value if sys.platform == 'darwin' and g.has_key('CONFIGURE_MACOSX_DEPLOYMENT_TARGET'): cfg_target = g['CONFIGURE_MACOSX_DEPLOYMENT_TARGET'] cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '') if cur_target == '': cur_target = cfg_target os.putenv('MACOSX_DEPLOYMENT_TARGET', cfg_target) if cfg_target != cur_target: my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure' % (cur_target, cfg_target)) raise DistutilsPlatformError(my_msg) # On AIX, there are wrong paths to the linker scripts in the Makefile # -- these paths are relative to the Python source, but when installed # the scripts are in another directory. if python_build: g['LDSHARED'] = g['BLDSHARED'] elif sys.version < '2.1': # The following two branches are for 1.5.2 compatibility. if sys.platform == 'aix4': # what about AIX 3.x ? # Linker script is in the config directory, not in Modules as the # Makefile says. python_lib = get_python_lib(standard_lib=1) ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix') python_exp = os.path.join(python_lib, 'config', 'python.exp') g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp) elif sys.platform == 'beos': # Linker script is in the config directory. In the Makefile it is # relative to the srcdir, which after installation no longer makes # sense. python_lib = get_python_lib(standard_lib=1) linkerscript_path = string.split(g['LDSHARED'])[0] linkerscript_name = os.path.basename(linkerscript_path) linkerscript = os.path.join(python_lib, 'config', linkerscript_name) # XXX this isn't the right place to do this: adding the Python # library to the link, if needed, should be in the "build_ext" # command. (It's also needed for non-MS compilers on Windows, and # it's taken care of for them by the 'build_ext.get_libraries()' # method.) g['LDSHARED'] = ("%s -L%s/lib -lpython%s" % (linkerscript, PREFIX, sys.version[0:3])) global _config_vars _config_vars = g | 2356cd82c3490347fc50ac030d0ebcb8dc8543a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2356cd82c3490347fc50ac030d0ebcb8dc8543a5/sysconfig.py |
(linkerscript, PREFIX, sys.version[0:3])) | (linkerscript, PREFIX, get_python_version())) | def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" g = {} # load the installed Makefile: try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): my_msg = my_msg + " (%s)" % msg.strerror raise DistutilsPlatformError(my_msg) # On MacOSX we need to check the setting of the environment variable # MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so # it needs to be compatible. # If it isn't set we set it to the configure-time value if sys.platform == 'darwin' and g.has_key('CONFIGURE_MACOSX_DEPLOYMENT_TARGET'): cfg_target = g['CONFIGURE_MACOSX_DEPLOYMENT_TARGET'] cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '') if cur_target == '': cur_target = cfg_target os.putenv('MACOSX_DEPLOYMENT_TARGET', cfg_target) if cfg_target != cur_target: my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure' % (cur_target, cfg_target)) raise DistutilsPlatformError(my_msg) # On AIX, there are wrong paths to the linker scripts in the Makefile # -- these paths are relative to the Python source, but when installed # the scripts are in another directory. if python_build: g['LDSHARED'] = g['BLDSHARED'] elif sys.version < '2.1': # The following two branches are for 1.5.2 compatibility. if sys.platform == 'aix4': # what about AIX 3.x ? # Linker script is in the config directory, not in Modules as the # Makefile says. python_lib = get_python_lib(standard_lib=1) ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix') python_exp = os.path.join(python_lib, 'config', 'python.exp') g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp) elif sys.platform == 'beos': # Linker script is in the config directory. In the Makefile it is # relative to the srcdir, which after installation no longer makes # sense. python_lib = get_python_lib(standard_lib=1) linkerscript_path = string.split(g['LDSHARED'])[0] linkerscript_name = os.path.basename(linkerscript_path) linkerscript = os.path.join(python_lib, 'config', linkerscript_name) # XXX this isn't the right place to do this: adding the Python # library to the link, if needed, should be in the "build_ext" # command. (It's also needed for non-MS compilers on Windows, and # it's taken care of for them by the 'build_ext.get_libraries()' # method.) g['LDSHARED'] = ("%s -L%s/lib -lpython%s" % (linkerscript, PREFIX, sys.version[0:3])) global _config_vars _config_vars = g | 2356cd82c3490347fc50ac030d0ebcb8dc8543a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2356cd82c3490347fc50ac030d0ebcb8dc8543a5/sysconfig.py |
if pass_iso8859: i = i % 128 if 32 <= i <= 126: | if 32 <= (i % mod) <= 126: | def make_escapes(pass_iso8859): global escapes for i in range(256): if pass_iso8859: # Allow iso-8859 characters to pass through so that e.g. 'msgid # "Hhe"' would result not result in 'msgid "H\366he"'. Otherwise # we escape any character outside the 32..126 range. i = i % 128 if 32 <= i <= 126: escapes.append(chr(i)) else: escapes.append("\\%03o" % i) escapes[ord('\\')] = '\\\\' escapes[ord('\t')] = '\\t' escapes[ord('\r')] = '\\r' escapes[ord('\n')] = '\\n' escapes[ord('\"')] = '\\"' | ae9dcec4f9019ecf6d72d3a00fb672f2d65697f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ae9dcec4f9019ecf6d72d3a00fb672f2d65697f9/pygettext.py |
make_escapes(options.escapes) | make_escapes(options.escape) | def main(): default_keywords = ['_'] try: opts, args = getopt.getopt( sys.argv[1:], 'ad:Ehk:n:o:p:Vvw:x:', ['extract-all', 'default-domain', 'escape', 'help', 'keyword', 'add-location', 'no-location', 'output=', 'output-dir=', 'verbose', 'version', 'width=', 'exclude-file=', ]) except getopt.error, msg: usage(1, msg) # for holding option values class Options: # constants GNU = 1 SOLARIS = 2 # defaults extractall = 0 # FIXME: currently this option has no effect at all. escape = 0 keywords = [] outpath = '' outfile = 'messages.pot' location = GNU verbose = 0 width = 78 excludefilename = '' options = Options() locations = {'gnu' : options.GNU, 'solaris' : options.SOLARIS, } # parse options for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-a', '--extract-all'): options.extractall = 1 elif opt in ('-d', '--default-domain'): options.outfile = arg + '.pot' elif opt in ('-E', '--escape'): options.escape = 1 elif opt in ('-k', '--keyword'): if arg is None: default_keywords = [] options.keywords.append(arg) elif opt in ('-n', '--add-location'): if arg is None: arg = 'gnu' try: options.location = locations[string.lower(arg)] except KeyError: d = {'arg':arg} usage(1, _('Invalid value for --add-location: %(arg)s') % d) elif opt in ('--no-location',): options.location = 0 elif opt in ('-o', '--output'): options.outfile = arg elif opt in ('-p', '--output-dir'): options.outpath = arg elif opt in ('-v', '--verbose'): options.verbose = 1 elif opt in ('-V', '--version'): print _('pygettext.py (xgettext for Python) %s') % __version__ sys.exit(0) elif opt in ('-w', '--width'): try: options.width = int(arg) except ValueError: d = {'arg':arg} usage(1, _('Invalid value for --width: %(arg)s, must be int') % d) elif opt in ('-x', '--exclude-file'): options.excludefilename = arg # calculate escapes make_escapes(options.escapes) # calculate all keywords options.keywords.extend(default_keywords) # initialize list of strings to exclude if options.excludefilename: try: fp = open(options.excludefilename) options.toexclude = fp.readlines() fp.close() except IOError: sys.stderr.write(_("Can't read --exclude-file: %s") % options.excludefilename) sys.exit(1) else: options.toexclude = [] # slurp through all the files eater = TokenEater(options) for filename in args: if options.verbose: print _('Working on %(filename)s') % {'filename':filename} fp = open(filename) eater.set_filename(filename) tokenize.tokenize(fp.readline, eater) fp.close() if options.outpath: options.outfile = os.path.join(options.outpath, options.outfile) fp = open(options.outfile, 'w') eater.write(fp) fp.close() | ae9dcec4f9019ecf6d72d3a00fb672f2d65697f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ae9dcec4f9019ecf6d72d3a00fb672f2d65697f9/pygettext.py |
mainname = os.path.basename(self.mainprogram) self.files.append((self.mainprogram, pathjoin(resdir, mainname))) mainprogram = self.mainprogram | mainprogram = os.path.basename(self.mainprogram) self.files.append((self.mainprogram, pathjoin(resdir, mainprogram))) | def preProcess(self): resdir = "Contents/Resources" if self.executable is not None: if self.mainprogram is None: execname = self.name else: execname = os.path.basename(self.executable) execpath = pathjoin(self.execdir, execname) if not self.symlink_exec: self.files.append((self.executable, execpath)) self.binaries.append(execpath) self.execpath = execpath | 3b64c2b31cddc5ef8bf1569d9df6834e1957d5bd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3b64c2b31cddc5ef8bf1569d9df6834e1957d5bd/bundlebuilder.py |
mainwrapperpath = pathjoin(execdir, self.name) | bootstrappath = pathjoin(execdir, self.name) | def preProcess(self): resdir = "Contents/Resources" if self.executable is not None: if self.mainprogram is None: execname = self.name else: execname = os.path.basename(self.executable) execpath = pathjoin(self.execdir, execname) if not self.symlink_exec: self.files.append((self.executable, execpath)) self.binaries.append(execpath) self.execpath = execpath | 3b64c2b31cddc5ef8bf1569d9df6834e1957d5bd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3b64c2b31cddc5ef8bf1569d9df6834e1957d5bd/bundlebuilder.py |
open(mainwrapperpath, "w").write(BOOTSTRAP_SCRIPT % locals()) os.chmod(mainwrapperpath, 0775) | open(bootstrappath, "w").write(BOOTSTRAP_SCRIPT % locals()) os.chmod(bootstrappath, 0775) | def preProcess(self): resdir = "Contents/Resources" if self.executable is not None: if self.mainprogram is None: execname = self.name else: execname = os.path.basename(self.executable) execpath = pathjoin(self.execdir, execname) if not self.symlink_exec: self.files.append((self.executable, execpath)) self.binaries.append(execpath) self.execpath = execpath | 3b64c2b31cddc5ef8bf1569d9df6834e1957d5bd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3b64c2b31cddc5ef8bf1569d9df6834e1957d5bd/bundlebuilder.py |
id(data), | id(data)+12, | def mk16pixmap(w, h, data): """kludge a pixmap together""" rv = struct.pack("lhhhhhhhlllhhhhlll", id(data), w*2 + 0x8000, 0, 0, h, w, 0, 0, 0, # XXXX? 72<<16, 72<<16, 16, 16, # XXXX 3, 5, 0, 0, 0) print 'Our pixmap, size %d:'%len(rv) dumppixmap(rv) return Qd.RawBitMap(rv) | f57e01671ffea648c2744881410675be1ce3c6ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f57e01671ffea648c2744881410675be1ce3c6ce/imgbrowse.py |
currect, QuickDraw.srcCopy, None) | currect, QuickDraw.srcCopy+QuickDraw.ditherCopy, None) | def do_update(self, *args): pass currect = self.fitrect() print 'PICT:', self.pictrect print 'WIND:', currect print 'ARGS:', (self.pixmap, self.wid.GetWindowPort().portBits, self.pictrect, currect, QuickDraw.srcCopy, None) self.info() Qd.CopyBits(self.pixmap, self.wid.GetWindowPort().portBits, self.pictrect, currect, QuickDraw.srcCopy, None) | f57e01671ffea648c2744881410675be1ce3c6ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f57e01671ffea648c2744881410675be1ce3c6ce/imgbrowse.py |
handler=None): | handler=None): | def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT, handler=None): ThreadingTCPServer.__init__(self, (host, port), handler) logging._acquireLock() self.abort = 0 logging._releaseLock() self.timeout = 1 | 02536bca15e9c3f50065c8ce3449adb01bd62573 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/02536bca15e9c3f50065c8ce3449adb01bd62573/config.py |
def serve(rcvr, hdlr): server = rcvr(handler=hdlr) | def serve(rcvr, hdlr, port): server = rcvr(port=port, handler=hdlr) | def serve(rcvr, hdlr): server = rcvr(handler=hdlr) global _listener logging._acquireLock() _listener = server logging._releaseLock() server.serve_until_stopped() | 02536bca15e9c3f50065c8ce3449adb01bd62573 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/02536bca15e9c3f50065c8ce3449adb01bd62573/config.py |
return threading.Thread(target=serve, args=(ConfigSocketReceiver, ConfigStreamHandler)) | return threading.Thread(target=serve, args=(ConfigSocketReceiver, ConfigStreamHandler, port)) | def serve(rcvr, hdlr): server = rcvr(handler=hdlr) global _listener logging._acquireLock() _listener = server logging._releaseLock() server.serve_until_stopped() | 02536bca15e9c3f50065c8ce3449adb01bd62573 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/02536bca15e9c3f50065c8ce3449adb01bd62573/config.py |
self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() keydefs = self.Bindings.default_keydefs | self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet() | def RemoveKeybindings(self): "Remove the keybindings before they are changed." # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() keydefs = self.Bindings.default_keydefs for event, keylist in keydefs.items(): self.text.event_delete(event, *keylist) for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: for event, keylist in keydefs.items(): self.text.event_delete(event, *keylist) | a945eef857307bb62f421da83331c51112ecdc94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a945eef857307bb62f421da83331c51112ecdc94/EditorWindow.py |
keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: for event, keylist in keydefs.items(): | xkeydefs = idleConf.GetExtensionBindings(extensionName) if xkeydefs: for event, keylist in xkeydefs.items(): | def RemoveKeybindings(self): "Remove the keybindings before they are changed." # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() keydefs = self.Bindings.default_keydefs for event, keylist in keydefs.items(): self.text.event_delete(event, *keylist) for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: for event, keylist in keydefs.items(): self.text.event_delete(event, *keylist) | a945eef857307bb62f421da83331c51112ecdc94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a945eef857307bb62f421da83331c51112ecdc94/EditorWindow.py |
self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() | self.Bindings.default_keydefs = keydefs = idleConf.GetCurrentKeySet() | def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.apply_bindings(keydefs) #update menu accelerators menuEventDict={} for menu in self.Bindings.menudefs: menuEventDict[menu[0]]={} for item in menu[1]: if item: menuEventDict[menu[0]][prepstr(item[0])[1]]=item[1] for menubarItem in self.menudict.keys(): menu=self.menudict[menubarItem] end=menu.index(END)+1 for index in range(0,end): if menu.type(index)=='command': accel=menu.entrycget(index,'accelerator') if accel: itemName=menu.entrycget(index,'label') event='' if menuEventDict.has_key(menubarItem): if menuEventDict[menubarItem].has_key(itemName): event=menuEventDict[menubarItem][itemName] if event: accel=get_accelerator(keydefs, event) menu.entryconfig(index,accelerator=accel) | a945eef857307bb62f421da83331c51112ecdc94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a945eef857307bb62f421da83331c51112ecdc94/EditorWindow.py |
keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.apply_bindings(keydefs) | xkeydefs = idleConf.GetExtensionBindings(extensionName) if xkeydefs: self.apply_bindings(xkeydefs) | def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.apply_bindings(keydefs) #update menu accelerators menuEventDict={} for menu in self.Bindings.menudefs: menuEventDict[menu[0]]={} for item in menu[1]: if item: menuEventDict[menu[0]][prepstr(item[0])[1]]=item[1] for menubarItem in self.menudict.keys(): menu=self.menudict[menubarItem] end=menu.index(END)+1 for index in range(0,end): if menu.type(index)=='command': accel=menu.entrycget(index,'accelerator') if accel: itemName=menu.entrycget(index,'label') event='' if menuEventDict.has_key(menubarItem): if menuEventDict[menubarItem].has_key(itemName): event=menuEventDict[menubarItem][itemName] if event: accel=get_accelerator(keydefs, event) menu.entryconfig(index,accelerator=accel) | a945eef857307bb62f421da83331c51112ecdc94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a945eef857307bb62f421da83331c51112ecdc94/EditorWindow.py |
menuEventDict={} | menuEventDict = {} | def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.apply_bindings(keydefs) #update menu accelerators menuEventDict={} for menu in self.Bindings.menudefs: menuEventDict[menu[0]]={} for item in menu[1]: if item: menuEventDict[menu[0]][prepstr(item[0])[1]]=item[1] for menubarItem in self.menudict.keys(): menu=self.menudict[menubarItem] end=menu.index(END)+1 for index in range(0,end): if menu.type(index)=='command': accel=menu.entrycget(index,'accelerator') if accel: itemName=menu.entrycget(index,'label') event='' if menuEventDict.has_key(menubarItem): if menuEventDict[menubarItem].has_key(itemName): event=menuEventDict[menubarItem][itemName] if event: accel=get_accelerator(keydefs, event) menu.entryconfig(index,accelerator=accel) | a945eef857307bb62f421da83331c51112ecdc94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a945eef857307bb62f421da83331c51112ecdc94/EditorWindow.py |
menuEventDict[menu[0]]={} | menuEventDict[menu[0]] = {} | def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.apply_bindings(keydefs) #update menu accelerators menuEventDict={} for menu in self.Bindings.menudefs: menuEventDict[menu[0]]={} for item in menu[1]: if item: menuEventDict[menu[0]][prepstr(item[0])[1]]=item[1] for menubarItem in self.menudict.keys(): menu=self.menudict[menubarItem] end=menu.index(END)+1 for index in range(0,end): if menu.type(index)=='command': accel=menu.entrycget(index,'accelerator') if accel: itemName=menu.entrycget(index,'label') event='' if menuEventDict.has_key(menubarItem): if menuEventDict[menubarItem].has_key(itemName): event=menuEventDict[menubarItem][itemName] if event: accel=get_accelerator(keydefs, event) menu.entryconfig(index,accelerator=accel) | a945eef857307bb62f421da83331c51112ecdc94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a945eef857307bb62f421da83331c51112ecdc94/EditorWindow.py |
menuEventDict[menu[0]][prepstr(item[0])[1]]=item[1] | menuEventDict[menu[0]][prepstr(item[0])[1]] = item[1] | def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.apply_bindings(keydefs) #update menu accelerators menuEventDict={} for menu in self.Bindings.menudefs: menuEventDict[menu[0]]={} for item in menu[1]: if item: menuEventDict[menu[0]][prepstr(item[0])[1]]=item[1] for menubarItem in self.menudict.keys(): menu=self.menudict[menubarItem] end=menu.index(END)+1 for index in range(0,end): if menu.type(index)=='command': accel=menu.entrycget(index,'accelerator') if accel: itemName=menu.entrycget(index,'label') event='' if menuEventDict.has_key(menubarItem): if menuEventDict[menubarItem].has_key(itemName): event=menuEventDict[menubarItem][itemName] if event: accel=get_accelerator(keydefs, event) menu.entryconfig(index,accelerator=accel) | a945eef857307bb62f421da83331c51112ecdc94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a945eef857307bb62f421da83331c51112ecdc94/EditorWindow.py |
menu=self.menudict[menubarItem] end=menu.index(END)+1 for index in range(0,end): if menu.type(index)=='command': accel=menu.entrycget(index,'accelerator') | menu = self.menudict[menubarItem] end = menu.index(END) + 1 for index in range(0, end): if menu.type(index) == 'command': accel = menu.entrycget(index, 'accelerator') | def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.apply_bindings(keydefs) #update menu accelerators menuEventDict={} for menu in self.Bindings.menudefs: menuEventDict[menu[0]]={} for item in menu[1]: if item: menuEventDict[menu[0]][prepstr(item[0])[1]]=item[1] for menubarItem in self.menudict.keys(): menu=self.menudict[menubarItem] end=menu.index(END)+1 for index in range(0,end): if menu.type(index)=='command': accel=menu.entrycget(index,'accelerator') if accel: itemName=menu.entrycget(index,'label') event='' if menuEventDict.has_key(menubarItem): if menuEventDict[menubarItem].has_key(itemName): event=menuEventDict[menubarItem][itemName] if event: accel=get_accelerator(keydefs, event) menu.entryconfig(index,accelerator=accel) | a945eef857307bb62f421da83331c51112ecdc94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a945eef857307bb62f421da83331c51112ecdc94/EditorWindow.py |
itemName=menu.entrycget(index,'label') event='' | itemName = menu.entrycget(index, 'label') event = '' | def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.apply_bindings(keydefs) #update menu accelerators menuEventDict={} for menu in self.Bindings.menudefs: menuEventDict[menu[0]]={} for item in menu[1]: if item: menuEventDict[menu[0]][prepstr(item[0])[1]]=item[1] for menubarItem in self.menudict.keys(): menu=self.menudict[menubarItem] end=menu.index(END)+1 for index in range(0,end): if menu.type(index)=='command': accel=menu.entrycget(index,'accelerator') if accel: itemName=menu.entrycget(index,'label') event='' if menuEventDict.has_key(menubarItem): if menuEventDict[menubarItem].has_key(itemName): event=menuEventDict[menubarItem][itemName] if event: accel=get_accelerator(keydefs, event) menu.entryconfig(index,accelerator=accel) | a945eef857307bb62f421da83331c51112ecdc94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a945eef857307bb62f421da83331c51112ecdc94/EditorWindow.py |
event=menuEventDict[menubarItem][itemName] | event = menuEventDict[menubarItem][itemName] | def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.apply_bindings(keydefs) #update menu accelerators menuEventDict={} for menu in self.Bindings.menudefs: menuEventDict[menu[0]]={} for item in menu[1]: if item: menuEventDict[menu[0]][prepstr(item[0])[1]]=item[1] for menubarItem in self.menudict.keys(): menu=self.menudict[menubarItem] end=menu.index(END)+1 for index in range(0,end): if menu.type(index)=='command': accel=menu.entrycget(index,'accelerator') if accel: itemName=menu.entrycget(index,'label') event='' if menuEventDict.has_key(menubarItem): if menuEventDict[menubarItem].has_key(itemName): event=menuEventDict[menubarItem][itemName] if event: accel=get_accelerator(keydefs, event) menu.entryconfig(index,accelerator=accel) | a945eef857307bb62f421da83331c51112ecdc94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a945eef857307bb62f421da83331c51112ecdc94/EditorWindow.py |
accel=get_accelerator(keydefs, event) menu.entryconfig(index,accelerator=accel) | accel = get_accelerator(keydefs, event) menu.entryconfig(index, accelerator=accel) | def ApplyKeybindings(self): "Update the keybindings after they are changed" # Called from configDialog.py self.Bindings.default_keydefs=idleConf.GetCurrentKeySet() self.apply_bindings() for extensionName in self.get_standard_extension_names(): keydefs = idleConf.GetExtensionBindings(extensionName) if keydefs: self.apply_bindings(keydefs) #update menu accelerators menuEventDict={} for menu in self.Bindings.menudefs: menuEventDict[menu[0]]={} for item in menu[1]: if item: menuEventDict[menu[0]][prepstr(item[0])[1]]=item[1] for menubarItem in self.menudict.keys(): menu=self.menudict[menubarItem] end=menu.index(END)+1 for index in range(0,end): if menu.type(index)=='command': accel=menu.entrycget(index,'accelerator') if accel: itemName=menu.entrycget(index,'label') event='' if menuEventDict.has_key(menubarItem): if menuEventDict[menubarItem].has_key(itemName): event=menuEventDict[menubarItem][itemName] if event: accel=get_accelerator(keydefs, event) menu.entryconfig(index,accelerator=accel) | a945eef857307bb62f421da83331c51112ecdc94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a945eef857307bb62f421da83331c51112ecdc94/EditorWindow.py |
"""Basic (multiple values per field) form content as dictionary. | """Form content as dictionary with a list of values per field. | def make_file(self, binary=None): """Overridable: return a readable & writable file. | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
"""Strict single-value expecting form content as dictionary. IF you only expect a single value for each field, then form[key] | """Form content as dictionary expecting a single value per field. If you only expect a single value for each field, then form[key] | def __init__(self, environ=os.environ): self.dict = self.data = parse(environ=environ) self.query_string = environ['QUERY_STRING'] | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
that expectation is not true. IF you expect a field to have | that expectation is not true. If you expect a field to have | def __init__(self, environ=os.environ): self.dict = self.data = parse(environ=environ) self.query_string = environ['QUERY_STRING'] | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
lis = [] for each in self.dict.values(): if len( each ) == 1 : lis.append(each[0]) else: lis.append(each) return lis | result = [] for value in self.dict.values(): if len(value) == 1: result.append(value[0]) else: result.append(value) return result | def values(self): lis = [] for each in self.dict.values(): if len( each ) == 1 : lis.append(each[0]) else: lis.append(each) return lis | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
lis = [] for key,value in self.dict.items(): if len(value) == 1 : lis.append((key, value[0])) else: lis.append((key, value)) return lis | result = [] for key, value in self.dict.items(): if len(value) == 1: result.append((key, value[0])) else: result.append((key, value)) return result | def items(self): lis = [] for key,value in self.dict.items(): if len(value) == 1 : lis.append((key, value[0])) else: lis.append((key, value)) return lis | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
def __getitem__( self, key ): v = SvFormContentDict.__getitem__( self, key ) if v[0] in string.digits+'+-.' : try: return string.atoi( v ) | def __getitem__(self, key): v = SvFormContentDict.__getitem__(self, key) if v[0] in string.digits + '+-.': try: return string.atoi(v) | def __getitem__( self, key ): v = SvFormContentDict.__getitem__( self, key ) if v[0] in string.digits+'+-.' : try: return string.atoi( v ) except ValueError: try: return string.atof( v ) except ValueError: pass return string.strip(v) | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
try: return string.atof( v ) | try: return string.atof(v) | def __getitem__( self, key ): v = SvFormContentDict.__getitem__( self, key ) if v[0] in string.digits+'+-.' : try: return string.atoi( v ) except ValueError: try: return string.atof( v ) except ValueError: pass return string.strip(v) | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
def values( self ): lis = [] | def values(self): result = [] | def values( self ): lis = [] for key in self.keys(): try: lis.append( self[key] ) except IndexError: lis.append( self.dict[key] ) return lis | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
lis.append( self[key] ) | result.append(self[key]) | def values( self ): lis = [] for key in self.keys(): try: lis.append( self[key] ) except IndexError: lis.append( self.dict[key] ) return lis | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
lis.append( self.dict[key] ) return lis def items( self ): lis = [] | result.append(self.dict[key]) return result def items(self): result = [] | def values( self ): lis = [] for key in self.keys(): try: lis.append( self[key] ) except IndexError: lis.append( self.dict[key] ) return lis | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
lis.append( (key, self[key]) ) | result.append((key, self[key])) | def items( self ): lis = [] for key in self.keys(): try: lis.append( (key, self[key]) ) except IndexError: lis.append( (key, self.dict[key]) ) return lis | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
lis.append( (key, self.dict[key]) ) return lis | result.append((key, self.dict[key])) return result | def items( self ): lis = [] for key in self.keys(): try: lis.append( (key, self[key]) ) except IndexError: lis.append( (key, self.dict[key]) ) return lis | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
if len (self.dict[key]) > location: | if len(self.dict[key]) > location: | def indexed_value(self, key, location): if self.dict.has_key(key): if len (self.dict[key]) > location: return self.dict[key][location] else: return None else: return None | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
print_directory() print_arguments() | def test(environ=os.environ): """Robust test CGI script, usable as main program. Write minimal HTTP headers and dump all information provided to the script in HTML form. """ import traceback print "Content-type: text/html" print sys.stderr = sys.stdout try: form = FieldStorage() # Replace with other classes to test those print_form(form) print_environ(environ) print_directory() print_arguments() print_environ_usage() def f(): exec "testing print_exception() -- <I>italics?</I>" def g(f=f): f() print "<H3>What follows is a test, not an actual exception:</H3>" g() except: print_exception() print "<H1>Second try with a small maxlen...</H1>" global maxlen maxlen = 50 try: form = FieldStorage() # Replace with other classes to test those print_form(form) print_environ(environ) print_directory() print_arguments() except: print_exception() | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
|
print_directory() print_arguments() | def g(f=f): f() | 41550751b18a239c982718c5055b4428c016b302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/41550751b18a239c982718c5055b4428c016b302/cgi.py |
|
def TemporaryFile(mode='w+b', bufsize=-1, suffix=""): """Create and return a temporary file (opened read-write by default).""" name = mktemp(suffix) if os.name == 'posix': # Unix -- be very careful fd = os.open(name, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0700) try: os.unlink(name) return os.fdopen(fd, mode, bufsize) except: os.close(fd) raise else: # Non-unix -- can't unlink file that's still open, use wrapper file = open(name, mode, bufsize) return TemporaryFileWrapper(file, name) | 3d5a17255312ca86473303031cddfae3bdd292f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3d5a17255312ca86473303031cddfae3bdd292f8/tempfile.py |
||
SetDialogItemText(text_h, "Progress...") | SetDialogItemText(text_h, label) | def __init__(self, label="Working...", maxval=100): self.label = label self.maxval = maxval self.curval = -1 self.d = GetNewDialog(259, -1) tp, text_h, rect = self.d.GetDialogItem(2) SetDialogItemText(text_h, "Progress...") self._update(0) | 2129e221120e08a1eefab8748e6939420d54fd11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2129e221120e08a1eefab8748e6939420d54fd11/EasyDialogs.py |
Qd.PaintRect(inner_rect) l, t, r, b = inner_rect r = int(l + (r-l)*value/self.maxval) inner_rect = l, t, r, b Qd.ForeColor(QuickDraw.blackColor) Qd.BackColor(QuickDraw.blackColor) Qd.PaintRect(inner_rect) | Qd.PaintRect((int(l + (r-l)*value/self.maxval), t, r, b)) | def _update(self, value): tp, h, bar_rect = self.d.GetDialogItem(3) Qd.SetPort(self.d) Qd.FrameRect(bar_rect) # Draw outline inner_rect = Qd.InsetRect(bar_rect, 1, 1) Qd.ForeColor(QuickDraw.whiteColor) Qd.BackColor(QuickDraw.whiteColor) Qd.PaintRect(inner_rect) # Clear internal l, t, r, b = inner_rect r = int(l + (r-l)*value/self.maxval) inner_rect = l, t, r, b Qd.ForeColor(QuickDraw.blackColor) Qd.BackColor(QuickDraw.blackColor) Qd.PaintRect(inner_rect) # Draw bar # Restore settings Qd.ForeColor(QuickDraw.blackColor) Qd.BackColor(QuickDraw.whiteColor) # Test for cancel button if ModalDialog(_ProgressBar_filterfunc) == 1: raise KeyboardInterrupt | 2129e221120e08a1eefab8748e6939420d54fd11 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2129e221120e08a1eefab8748e6939420d54fd11/EasyDialogs.py |
if __name__ == "__main__": | def test_main(): | def get_file(): return __file__ | e9cd2764f2f8cd75be50c60205ddddc71055927a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e9cd2764f2f8cd75be50c60205ddddc71055927a/test_zipimport.py |
attrs.getQNames() == [] and \ | (attrs.getQNames() == [] or attrs.getQNames() == ["ns:attr"]) and \ | def test_expat_nsattrs_wattr(): parser = create_parser(1) gather = AttrGatherer() parser.setContentHandler(gather) parser.feed("<doc xmlns:ns='%s' ns:attr='val'/>" % ns_uri) parser.close() attrs = gather._attrs return attrs.getLength() == 1 and \ attrs.getNames() == [(ns_uri, "attr")] and \ attrs.getQNames() == [] and \ len(attrs) == 1 and \ attrs.has_key((ns_uri, "attr")) and \ attrs.keys() == [(ns_uri, "attr")] and \ attrs.get((ns_uri, "attr")) == "val" and \ attrs.get((ns_uri, "attr"), 25) == "val" and \ attrs.items() == [((ns_uri, "attr"), "val")] and \ attrs.values() == ["val"] and \ attrs.getValue((ns_uri, "attr")) == "val" and \ attrs[(ns_uri, "attr")] == "val" | 7bcb37027a4735c4464be5a61bbbce7a7e57bfa5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7bcb37027a4735c4464be5a61bbbce7a7e57bfa5/test_sax.py |
import sys, traceback | import traceback | def _run_exitfuncs(): """run any registered exit functions _exithandlers is traversed in reverse order so functions are executed last in, first out. """ exc_info = None while _exithandlers: func, targs, kargs = _exithandlers.pop() try: func(*targs, **kargs) except SystemExit: exc_info = sys.exc_info() except: import sys, traceback print >> sys.stderr, "Error in atexit._run_exitfuncs:" traceback.print_exc() exc_info = sys.exc_info() if exc_info is not None: raise exc_info[0], exc_info[1], exc_info[2] | 3edfc10ec846fafad364bae00027a5b64e89576c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3edfc10ec846fafad364bae00027a5b64e89576c/atexit.py |
import sys | def register(func, *targs, **kargs): """register a function to be executed upon normal program termination func - function to be called at exit targs - optional arguments to pass to func kargs - optional keyword arguments to pass to func """ _exithandlers.append((func, targs, kargs)) | 3edfc10ec846fafad364bae00027a5b64e89576c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3edfc10ec846fafad364bae00027a5b64e89576c/atexit.py |
|
del sys | def register(func, *targs, **kargs): """register a function to be executed upon normal program termination func - function to be called at exit targs - optional arguments to pass to func kargs - optional keyword arguments to pass to func """ _exithandlers.append((func, targs, kargs)) | 3edfc10ec846fafad364bae00027a5b64e89576c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3edfc10ec846fafad364bae00027a5b64e89576c/atexit.py |
|
def check_module_event(self, event): | def check_module_event(self, event=None): | def check_module_event(self, event): filename = self.getfilename() if not filename: return if not self.tabnanny(filename): return self.checksyntax(filename) | 824886b867c82dd47df08da580c55289f9c45ba7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/824886b867c82dd47df08da580c55289f9c45ba7/ScriptBinding.py |
filename = self.getfilename() if not filename: return if not self.tabnanny(filename): return code = self.checksyntax(filename) | code = self.check_module_event(event) | def run_module_event(self, event): """Run the module after setting up the environment. | 824886b867c82dd47df08da580c55289f9c45ba7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/824886b867c82dd47df08da580c55289f9c45ba7/ScriptBinding.py |
self.saved_dbc_key = c.current(0,0,0)[0] | try: self.saved_dbc_key = c.current(0,0,0)[0] except db.DBError: pass | def _closeCursors(self, save=1): if self.dbc: c = self.dbc self.dbc = None if save: self.saved_dbc_key = c.current(0,0,0)[0] c.close() del c for cref in self._cursor_refs.values(): c = cref() if c is not None: c.close() | da9c65cacc1f104fdfe92d5de64a01e9af294cf7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da9c65cacc1f104fdfe92d5de64a01e9af294cf7/__init__.py |
self.reset() | def feed(self, data, isFinal = 0): if not self._parsing: self._parsing = 1 self.reset() self._cont_handler.startDocument() | 66f0b01fc08ab4416867e9677a1d1876c15b366a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/66f0b01fc08ab4416867e9677a1d1876c15b366a/expatreader.py |
|
import difflib a = expected.splitlines() b = output.splitlines() | a = expected.splitlines(1) b = output.splitlines(1) | def reportdiff(expected, output): print "*" * 70 import difflib a = expected.splitlines() b = output.splitlines() sm = difflib.SequenceMatcher(a=a, b=b) tuples = sm.get_opcodes() def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1) for op, a0, a1, b0, b1 in tuples: if op == 'equal': pass elif op == 'delete': print pair(a0, a1) + "d" + pair(b0, b1) for line in a[a0:a1]: print "<", line elif op == 'replace': print pair(a0, a1) + "c" + pair(b0, b1) for line in a[a0:a1]: print "<", line print "---" for line in b[b0:b1]: print ">", line elif op == 'insert': print str(a0) + "a" + pair(b0, b1) for line in b[b0:b1]: print ">", line else: print "get_opcodes() returned bad tuple?!?!", (op, a0, a1, b0, b1) print "*" * 70 | 5d5cbea13a7ce3fec0f1eaea43acaa3a9b6fb93c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5d5cbea13a7ce3fec0f1eaea43acaa3a9b6fb93c/regrtest.py |
return str(x0) else: return "%d,%d" % (x0, x1) | return "line " + str(x0) else: return "lines %d-%d" % (x0, x1) | def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1) | 5d5cbea13a7ce3fec0f1eaea43acaa3a9b6fb93c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5d5cbea13a7ce3fec0f1eaea43acaa3a9b6fb93c/regrtest.py |
print pair(a0, a1) + "d" + pair(b0, b1) | print "***", pair(a0, a1), "of expected output missing:" | def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1) | 5d5cbea13a7ce3fec0f1eaea43acaa3a9b6fb93c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5d5cbea13a7ce3fec0f1eaea43acaa3a9b6fb93c/regrtest.py |
print "<", line | print "-", line, | def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1) | 5d5cbea13a7ce3fec0f1eaea43acaa3a9b6fb93c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5d5cbea13a7ce3fec0f1eaea43acaa3a9b6fb93c/regrtest.py |
print pair(a0, a1) + "c" + pair(b0, b1) for line in a[a0:a1]: print "<", line print "---" | print "*** mismatch between", pair(a0, a1), "of expected", \ "output and", pair(b0, b1), "of actual output:" for line in difflib.ndiff(a[a0:a1], b[b0:b1]): print line, elif op == 'insert': print "***", pair(b0, b1), "of actual output doesn't appear", \ "in expected output after line", str(a1)+":" | def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1) | 5d5cbea13a7ce3fec0f1eaea43acaa3a9b6fb93c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5d5cbea13a7ce3fec0f1eaea43acaa3a9b6fb93c/regrtest.py |
print ">", line elif op == 'insert': print str(a0) + "a" + pair(b0, b1) for line in b[b0:b1]: print ">", line | print "+", line, | def pair(x0, x1): x0 += 1 if x0 >= x1: return str(x0) else: return "%d,%d" % (x0, x1) | 5d5cbea13a7ce3fec0f1eaea43acaa3a9b6fb93c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5d5cbea13a7ce3fec0f1eaea43acaa3a9b6fb93c/regrtest.py |
try: del sys.modules[modname] except KeyError: pass | def check_all(modname): names = {} try: exec "import %s" % modname in names except ImportError: # silent fail here seems the best route since some modules # may not be available in all environments return verify(hasattr(sys.modules[modname], "__all__"), "%s has no __all__ attribute" % modname) names = {} exec "from %s import *" % modname in names if names.has_key("__builtins__"): del names["__builtins__"] keys = names.keys() keys.sort() all = list(sys.modules[modname].__all__) # in case it's a tuple all.sort() verify(keys==all, "%s != %s" % (keys, all)) | cea5d26962361bbffe973a7cd56b982fddb9da43 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cea5d26962361bbffe973a7cd56b982fddb9da43/test___all__.py |
|
def basic_test_inplace_repeat(self, size): l = [''] l *= size self.assertEquals(len(l), size) self.failUnless(l[0] is l[-1]) del l l = [''] * size l *= 2 self.assertEquals(len(l), size * 2) self.failUnless(l[size - 1] is l[-1]) @bigmemtest(minsize=_2G // 2 + 2, memuse=16) def test_inplace_repeat_small(self, size): return self.basic_test_inplace_repeat(size) @bigmemtest(minsize=_2G + 2, memuse=16) def test_inplace_repeat_large(self, size): return self.basic_test_inplace_repeat(size) | def test_repeat_large(self, size): return self.basic_test_repeat(size) | a7bdc715c90e8ff03c83a1e3e3f5c78545b87b1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a7bdc715c90e8ff03c83a1e3e3f5c78545b87b1f/test_bigmem.py |
|
@bigmemtest(minsize=_2G // 2 + 2, memuse=8) | @bigmemtest(minsize=_2G // 2 + 2, memuse=16) | def basic_test_extend(self, size): l = [file] * size l.extend(l) self.assertEquals(len(l), size * 2) self.failUnless(l[0] is l[-1]) self.failUnless(l[size - 1] is l[size + 1]) | a7bdc715c90e8ff03c83a1e3e3f5c78545b87b1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a7bdc715c90e8ff03c83a1e3e3f5c78545b87b1f/test_bigmem.py |
@bigmemtest(minsize=_2G + 2, memuse=8) | @bigmemtest(minsize=_2G + 2, memuse=16) | def test_extend_small(self, size): return self.basic_test_extend(size) | a7bdc715c90e8ff03c83a1e3e3f5c78545b87b1f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a7bdc715c90e8ff03c83a1e3e3f5c78545b87b1f/test_bigmem.py |
def user_line(self, frame): # get the currently executing function ##print>>sys.__stderr__, "*function: ", frame.f_code.co_name ##print>>sys.__stderr__, "*file: ", frame.f_code.co_filename ##print>>sys.__stderr__, "*line number: ", frame.f_code.co_firstlineno co_filename = frame.f_code.co_filename co_name = frame.f_code.co_name try: func = frame.f_locals[co_name] if getattr(func, "DebuggerStepThrough", 0): print "XXXX DEBUGGER STEPPING THROUGH" self.set_step() return except: pass if co_filename in ('rpc.py', '<string>'): self.set_step() return if co_filename.endswith('threading.py'): self.set_step() return message = self.__frame2message(frame) self.gui.interaction(message, frame) | 5da7e431bc05216e5364bde17a39e5d00c77bece /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5da7e431bc05216e5364bde17a39e5d00c77bece/Debugger.py |
||
if co_filename in ('rpc.py', '<string>'): | if co_filename in (r'.\rpc.py', 'rpc.py','<string>'): | def user_line(self, frame): # get the currently executing function ##print>>sys.__stderr__, "*function: ", frame.f_code.co_name ##print>>sys.__stderr__, "*file: ", frame.f_code.co_filename ##print>>sys.__stderr__, "*line number: ", frame.f_code.co_firstlineno co_filename = frame.f_code.co_filename co_name = frame.f_code.co_name try: func = frame.f_locals[co_name] if getattr(func, "DebuggerStepThrough", 0): print "XXXX DEBUGGER STEPPING THROUGH" self.set_step() return except: pass if co_filename in ('rpc.py', '<string>'): self.set_step() return if co_filename.endswith('threading.py'): self.set_step() return message = self.__frame2message(frame) self.gui.interaction(message, frame) | 5da7e431bc05216e5364bde17a39e5d00c77bece /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5da7e431bc05216e5364bde17a39e5d00c77bece/Debugger.py |
return WeakValuedItemIterator(self) | for wr in self.data.itervalues(): value = wr() if value is not None: yield wr.key, value | def iteritems(self): return WeakValuedItemIterator(self) | 4fd20c6c44f74cca2cf3674f367c51fe70a1883b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fd20c6c44f74cca2cf3674f367c51fe70a1883b/weakref.py |
__iter__ = iterkeys | def __iter__(self): return self.data.iterkeys() | def iterkeys(self): return self.data.iterkeys() | 4fd20c6c44f74cca2cf3674f367c51fe70a1883b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fd20c6c44f74cca2cf3674f367c51fe70a1883b/weakref.py |
return WeakValuedValueIterator(self) | for wr in self.data.itervalues(): obj = wr() if obj is not None: yield obj | def itervalues(self): return WeakValuedValueIterator(self) | 4fd20c6c44f74cca2cf3674f367c51fe70a1883b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fd20c6c44f74cca2cf3674f367c51fe70a1883b/weakref.py |
return WeakKeyedItemIterator(self) | for wr, value in self.data.iteritems(): key = wr() if key is not None: yield key, value | def iteritems(self): return WeakKeyedItemIterator(self) | 4fd20c6c44f74cca2cf3674f367c51fe70a1883b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fd20c6c44f74cca2cf3674f367c51fe70a1883b/weakref.py |
return WeakKeyedKeyIterator(self) __iter__ = iterkeys | for wr in self.data.iterkeys(): obj = wr() if obj is not None: yield obj def __iter__(self): return self.iterkeys() | def iterkeys(self): return WeakKeyedKeyIterator(self) | 4fd20c6c44f74cca2cf3674f367c51fe70a1883b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fd20c6c44f74cca2cf3674f367c51fe70a1883b/weakref.py |
def WeakKeyedKeyIterator(weakdict): for wr in weakdict.data.iterkeys(): obj = wr() if obj is not None: yield obj def WeakKeyedItemIterator(weakdict): for wr, value in weakdict.data.iteritems(): key = wr() if key is not None: yield key, value def WeakValuedValueIterator(weakdict): for wr in weakdict.data.itervalues(): obj = wr() if obj is not None: yield obj def WeakValuedItemIterator(weakdict): for wr in weakdict.data.itervalues(): value = wr() if value is not None: yield wr.key, value | def update(self, dict=None, **kwargs): d = self.data if dict is not None: if not hasattr(dict, "items"): dict = type({})(dict) for key, value in dict.items(): d[ref(key, self._remove)] = value if len(kwargs): self.update(kwargs) | 4fd20c6c44f74cca2cf3674f367c51fe70a1883b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fd20c6c44f74cca2cf3674f367c51fe70a1883b/weakref.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.