rem stringlengths 2 226k | add stringlengths 0 227k | context stringlengths 8 228k | meta stringlengths 156 215 | input_ids list | attention_mask list | labels list |
|---|---|---|---|---|---|---|
else: | else: | def handler(req): """main handler; called by mod_python""" req.allow_methods(["GET"]) if req.get_config().has_key('PythonDebug'): reload(dump) if (uniqueURI(req) == "test"): return test(req) if (uniqueURI(req) == "query"): return query(req) if (uniqueURI(req) == "form"): return form(req) if (uniqueURI(req) == ""): return index(req) #elif (req.method == "GET"): # return get(req) else: return apache.HTTP_NOT_IMPLEMENTED | 4ad0c2d979019c9dfdd8cb2810cbc56f296fe42a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2336/4ad0c2d979019c9dfdd8cb2810cbc56f296fe42a/frontend.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1838,
12,
3658,
4672,
3536,
5254,
1838,
31,
2566,
635,
681,
67,
8103,
8395,
1111,
18,
5965,
67,
5163,
3816,
6,
3264,
6,
5717,
225,
309,
1111,
18,
588,
67,
1425,
7675,
5332,
67,
856,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1838,
12,
3658,
4672,
3536,
5254,
1838,
31,
2566,
635,
681,
67,
8103,
8395,
1111,
18,
5965,
67,
5163,
3816,
6,
3264,
6,
5717,
225,
309,
1111,
18,
588,
67,
1425,
7675,
5332,
67,
856,
... |
elif os.WIFSIGNALED(status): print "%s EXIT STATUS: CRASHED signal %d (%f seconds)" % (prefix, os.WTERMSIG(status), elapsedtime) sys.exit(exitSignal) | def forkexec(command, args): global prefix global elapsedtime #print command #print args try: pid = os.fork() if pid == 0: # Child os.execvp(command, args) else: # Parent return pid except OSError, e: print "%s ERROR: %s %s failed: %d (%s) (%f seconds)" % (prefix, command, args, e.errno, e.strerror, elapsedtime) sys.exit(exitOSError) | 91b0c1dfe68e02a765b95b7d3be5128317a7ea01 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/11102/91b0c1dfe68e02a765b95b7d3be5128317a7ea01/timed_run.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
12515,
4177,
12,
3076,
16,
833,
4672,
2552,
1633,
2552,
9613,
957,
468,
1188,
1296,
468,
1188,
833,
775,
30,
4231,
273,
1140,
18,
23335,
1435,
309,
4231,
422,
374,
30,
225,
468,
7451,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
12515,
4177,
12,
3076,
16,
833,
4672,
2552,
1633,
2552,
9613,
957,
468,
1188,
1296,
468,
1188,
833,
775,
30,
4231,
273,
1140,
18,
23335,
1435,
309,
4231,
422,
374,
30,
225,
468,
7451,
... | |
print ">>> Merging contents of",mystart,"to "+myroot print ">>> Logging merge to "+myroot+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" prepare_db(myroot,mycategory,mypackage) outfile=open(myroot+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS","w") mergefiles(outfile,myroot,mystart) | print ">>> Merging contents of",mystart,"to "+root print ">>> Logging merge to "+root+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" prepare_db(mycategory,mypackage) outfile=open(root+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS","w") mergefiles(outfile,mystart) | def merge(myroot,mycategory,mypackage,mystart): if myroot=="": myroot="/" mystart=os.path.normpath(mystart) os.chdir(mystart) print print ">>> Merging contents of",mystart,"to "+myroot print ">>> Logging merge to "+myroot+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS" prepare_db(myroot,mycategory,mypackage) outfile=open(myroot+"var/db/pkg/"+mycategory+"/"+mypackage+"/CONTENTS","w") mergefiles(outfile,myroot,mystart) outfile.close() print print ">>>",mypackage,"merged." print | 01f4a9c4d0b331efdfed1bd9585e56e10c758791 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9957/01f4a9c4d0b331efdfed1bd9585e56e10c758791/portage.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2691,
12,
4811,
3085,
16,
4811,
4743,
16,
81,
879,
1270,
16,
81,
1094,
485,
4672,
309,
3399,
3085,
631,
3660,
30,
3399,
3085,
1546,
4898,
312,
1094,
485,
33,
538,
18,
803,
18,
7959,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2691,
12,
4811,
3085,
16,
4811,
4743,
16,
81,
879,
1270,
16,
81,
1094,
485,
4672,
309,
3399,
3085,
631,
3660,
30,
3399,
3085,
1546,
4898,
312,
1094,
485,
33,
538,
18,
803,
18,
7959,
... |
if len([key for key, val in self.structures.iteritems() if not val]) == 0: | if len([key for key, val in self.states.iteritems() if not val]) == 0: | def GenerateStats(self, client_version): '''Generate XML summary of execution statistics''' stats = lxml.etree.Element("Statistics") | 045d7efed0d6739f4c664499caaa84bd7cc6d935 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11867/045d7efed0d6739f4c664499caaa84bd7cc6d935/Toolset.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
6654,
4195,
12,
2890,
16,
1004,
67,
1589,
4672,
9163,
4625,
3167,
4916,
434,
4588,
7691,
26418,
3177,
273,
328,
2902,
18,
31303,
18,
1046,
2932,
8569,
7923,
2,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
6654,
4195,
12,
2890,
16,
1004,
67,
1589,
4672,
9163,
4625,
3167,
4916,
434,
4588,
7691,
26418,
3177,
273,
328,
2902,
18,
31303,
18,
1046,
2932,
8569,
7923,
2,
-100,
-100,
-100,
-100,
-1... |
ld t1, ds, [scale, index, base], disp | ld t1, ds, [0, t0, t7], disp | def macroop SUB_P_R | dd95f0468c599f30303740527ce19d810f43aca6 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/7385/dd95f0468c599f30303740527ce19d810f43aca6/add_and_subtract.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
11522,
556,
10025,
67,
52,
67,
54,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
11522,
556,
10025,
67,
52,
67,
54,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
if 0 and p.decl.type.isToplevel(): | if 0 and dispatches: | def addDispatcher(mdefn, dispatchMethod, params): mdefn.addstmt(cxx.StmtDecl(cxx.Decl(cxx.Type('int'), '__route'))) routevar = cxx.ExprVar('__route') mdefn.addstmt(cxx.StmtExpr(cxx.ExprAssn( routevar, cxx.ExprCall(cxx.ExprSelect(cxx.ExprVar('msg'), '.', 'routing_id'))))) routeif = cxx.StmtIf(cxx.ExprBinary( cxx.ExprVar('MSG_ROUTING_CONTROL'), '!=', routevar)) routeif.ifb.addstmt(cxx.StmtDecl(cxx.Decl( cxx.Type('Channel::Listener', ptr=1), '__routed'))) routedvar = cxx.ExprVar('__routed') routeif.ifb.addstmt(cxx.StmtExpr(cxx.ExprAssn( routedvar, cxx.ExprCall(cxx.ExprVar('Lookup'), [ routevar ])))) | 134060c8d7f4987e8b617779d6063a1d7b5ff7a4 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/11102/134060c8d7f4987e8b617779d6063a1d7b5ff7a4/lower.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
527,
6681,
12,
81,
536,
82,
16,
3435,
1305,
16,
859,
4672,
312,
536,
82,
18,
1289,
10589,
12,
71,
5279,
18,
8952,
3456,
12,
71,
5279,
18,
3456,
12,
71,
5279,
18,
559,
2668,
474,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
527,
6681,
12,
81,
536,
82,
16,
3435,
1305,
16,
859,
4672,
312,
536,
82,
18,
1289,
10589,
12,
71,
5279,
18,
8952,
3456,
12,
71,
5279,
18,
3456,
12,
71,
5279,
18,
559,
2668,
474,
19... |
vidmenu.Append(ID_MENU_GO, DV.l('Let\'s &go!'), DV.l('Processes all the videos in the list.')) self.Bind(wx.EVT_MENU, self.onGo, id=ID_MENU_GO) | menu_letsgo = wx.MenuItem(vidmenu, -1, DV.l('Let\'s &go!'), DV.l('Processes all the videos in the list.')) vidmenu.AppendItem(menu_letsgo) self.Bind(wx.EVT_MENU, self.onGo, menu_letsgo) | def __init__(self, parent, id, title): Damnlog('DamnMainFrame GUI building starting.') wx.Frame.__init__(self, parent, wx.ID_ANY, title, size=(780, 580), style=wx.DEFAULT_FRAME_STYLE) self.CreateStatusBar() filemenu = wx.Menu() filemenu.Append(ID_MENU_ADD_FILE, DV.l('&Add files...'), DV.l('Adds damn videos from local files.')) self.Bind(wx.EVT_MENU, self.onAddFile, id=ID_MENU_ADD_FILE) filemenu.Append(ID_MENU_ADD_URL, DV.l('Add &URL...'), DV.l('Adds a damn video from a URL.')) self.Bind(wx.EVT_MENU, self.onAddURL, id=ID_MENU_ADD_URL) filemenu.AppendSeparator() filemenu.Append(ID_MENU_EXIT, DV.l('E&xit'), DV.l('Terminates DamnVid.')) self.Bind(wx.EVT_MENU, self.onExit, id=ID_MENU_EXIT) vidmenu = wx.Menu() vidmenu.Append(ID_MENU_GO, DV.l('Let\'s &go!'), DV.l('Processes all the videos in the list.')) self.Bind(wx.EVT_MENU, self.onGo, id=ID_MENU_GO) vidmenu.AppendSeparator() self.prefmenuitem = vidmenu.Append(ID_MENU_PREFERENCES, DV.l('Preferences'), DV.l('Opens DamnVid\'s preferences, allowing you to customize its settings.')) self.Bind(wx.EVT_MENU, self.onPrefs, id=ID_MENU_PREFERENCES) #vidmenu.Append(ID_MENU_OUTDIR,'Output directory','Opens DamnVid\'s output directory, where all the videos are saved.') #self.Bind(wx.EVT_MENU,self.onOpenOutDir,id=ID_MENU_OUTDIR) halpmenu = wx.Menu() halpmenu.Append(ID_MENU_HALP, DV.l('&Help'), DV.l('Opens DamnVid\'s help.')) self.Bind(wx.EVT_MENU, self.onHalp, id=ID_MENU_HALP) halpmenu.Append(ID_MENU_REPORTBUG, DV.l('Report a bug'), DV.l('Submit a new bug report.')) self.Bind(wx.EVT_MENU, self.onReportBug, id=ID_MENU_REPORTBUG) halpmenu.Append(ID_MENU_UPDATE, DV.l('Check for updates...'), DV.l('Checks if a new version of DamnVid is available.')) self.Bind(wx.EVT_MENU, self.onCheckUpdates, id=ID_MENU_UPDATE) halpmenu.AppendSeparator() halpmenu.Append(ID_MENU_ABOUT, DV.l('&About DamnVid ') + DV.version + '...', DV.l('Displays information about DamnVid.')) self.Bind(wx.EVT_MENU, self.onAboutDV, id=ID_MENU_ABOUT) self.menubar = wx.MenuBar() self.menubar.Append(filemenu, DV.l('&File')) self.menubar.Append(vidmenu, DV.l('&DamnVid')) self.menubar.Append(halpmenu, DV.l('&Help')) self.SetMenuBar(self.menubar) Damnlog('DamnMainFrame menu bar is up.') vbox = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox) #vbox.Add((0,DV.border_padding)) Actually, do NOT add a padding there, it looks better when stuck on the edge panel = wx.Panel(self, -1) vbox.Add(panel, 1, wx.EXPAND) grid = wx.FlexGridSizer(2, 2, 8, 8) panel1 = wx.Panel(panel, -1) grid.Add(panel1, 1, wx.EXPAND) panel2 = wx.Panel(panel, -1) grid.Add(panel2, 0, wx.EXPAND) panel3 = wx.Panel(panel, -1) grid.Add(panel3, 0, wx.EXPAND) panel4 = wx.Panel(panel, -1) grid.Add(panel4, 0, wx.EXPAND) panel.SetSizer(grid) hbox1 = wx.BoxSizer(wx.HORIZONTAL) #hbox1.Add((DV.border_padding,0)) Ditto panel1.SetSizer(hbox1) self.list = DamnList(panel1, window=self) self.list.InsertColumn(ID_COL_VIDNAME, DV.l('Video name')) self.list.SetColumnWidth(ID_COL_VIDNAME, width=180) self.list.InsertColumn(ID_COL_VIDPROFILE, DV.l('Encoding profile')) self.list.SetColumnWidth(ID_COL_VIDPROFILE, width=120) self.list.InsertColumn(ID_COL_VIDSTAT, DV.l('Status')) self.list.SetColumnWidth(ID_COL_VIDSTAT, width=120) self.list.InsertColumn(ID_COL_VIDPATH, DV.l('Source')) self.list.SetColumnWidth(ID_COL_VIDPATH, wx.LIST_AUTOSIZE) self.list.Bind(wx.EVT_KEY_DOWN, self.onListKeyDown) self.list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onListSelect) self.list.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.onListSelect) DV.listicons.initWX() self.list.AssignImageList(DV.listicons, wx.IMAGE_LIST_SMALL) self.list.SetDropTarget(DamnDropHandler(self)) self.list.Bind(wx.EVT_RIGHT_DOWN, self.list.onRightClick) hbox1.Add(self.list, 1, wx.EXPAND) Damnlog('DamnMainFrame MainList is up.') vboxwrap2 = wx.BoxSizer(wx.HORIZONTAL) sizer2 = wx.BoxSizer(wx.VERTICAL) vboxwrap2.Add(sizer2) vboxwrap2.Add((DV.border_padding, 0)) sizer2.Add((0, DV.border_padding)) panel2.SetSizer(vboxwrap2) self.droptarget = wx.animate.GIFAnimationCtrl(panel2, -1, DV.images_path + 'droptarget.gif') self.droptarget.Bind(wx.EVT_LEFT_UP, self.onDropTargetClick) sizer2.Add(self.droptarget, 0, wx.ALIGN_CENTER) self.droptarget.SetDropTarget(DamnDropHandler(self)) # Extra forced gap here sizer2.Add((0, DV.control_vgap + 4)) self.addByFile = wx.Button(panel2, -1, DV.l('Add Files')) sizer2.Add(self.addByFile, 0, wx.ALIGN_CENTER) sizer2.Add((0, DV.control_vgap)) self.Bind(wx.EVT_BUTTON, self.onAddFile, self.addByFile) self.addByURL = wx.Button(panel2, -1, DV.l('Add URL')) sizer2.Add(self.addByURL, 0, wx.ALIGN_CENTER) sizer2.Add((0, DV.control_vgap)) self.Bind(wx.EVT_BUTTON, self.onAddURL, self.addByURL) self.btnSearch = wx.Button(panel2, -1, DV.l('Search...')) sizer2.Add(self.btnSearch, 0, wx.ALIGN_CENTER) sizer2.Add((0, DV.control_vgap)) self.Bind(wx.EVT_BUTTON, self.onSearch, self.btnSearch) self.btnRename = wx.Button(panel2, -1, DV.l('Rename')) sizer2.Add(self.btnRename, 0, wx.ALIGN_CENTER) sizer2.Add((0, DV.control_vgap)) self.Bind(wx.EVT_BUTTON, self.onRename, self.btnRename) self.profilepanel = wx.Panel(panel2, -1) profilepanelsizer = wx.BoxSizer(wx.VERTICAL) self.profilepanel.SetSizer(profilepanelsizer) profilepanelsizer.Add(wx.StaticText(self.profilepanel, -1, DV.l('Profile:')), 0, wx.ALIGN_CENTER) self.profiledropdown = wx.Choice(self.profilepanel, -1, choices=[DV.l('(None)')]) profilepanelsizer.Add((0, DV.control_vgap)) profilepanelsizer.Add(self.profiledropdown, 0, wx.ALIGN_CENTER) sizer2.Add(self.profilepanel) tmplistheight = self.profiledropdown.GetSizeTuple()[1] self.profilepanel.Hide() sizer2.Add((0, DV.control_vgap)) self.btnMoveUp = wx.Button(panel2, -1, DV.l('Move up')) sizer2.Add(self.btnMoveUp, 0, wx.ALIGN_CENTER) sizer2.Add((0, DV.control_vgap)) self.Bind(wx.EVT_BUTTON, self.onMoveUp, self.btnMoveUp) self.btnMoveDown = wx.Button(panel2, -1, DV.l('Move down')) sizer2.Add(self.btnMoveDown, 0, wx.ALIGN_CENTER) sizer2.Add((0, DV.control_vgap)) self.Bind(wx.EVT_BUTTON, self.onMoveDown, self.btnMoveDown) self.deletebutton = wx.Button(panel2, -1, DV.l('Remove')) sizer2.Add(self.deletebutton, 0, wx.ALIGN_CENTER) sizer2.Add((0, DV.control_vgap)) self.Bind(wx.EVT_BUTTON, self.onDelete, self.deletebutton) self.gobutton1 = wx.Button(panel2, -1, DV.l('Let\'s go!')) sizer2.Add(self.gobutton1, 0, wx.ALIGN_CENTER) sizer2.Add((0, DV.border_padding)) buttonwidth = sizer2.GetMinSizeTuple()[0] self.Bind(wx.EVT_BUTTON, self.onGo, self.gobutton1) hbox3 = wx.BoxSizer(wx.HORIZONTAL) hbox3.Add((DV.border_padding, 0)) panel3.SetSizer(hbox3) hbox3.Add(wx.StaticText(panel3, -1, DV.l('Current video: ')), 0, wx.ALIGN_CENTER_VERTICAL) self.gauge1 = wx.Gauge(panel3, -1) self.gauge1.SetSize((self.gauge1.GetSizeTuple()[0], hbox3.GetSizeTuple()[1])) hbox3.Add(self.gauge1, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL) #self.gobutton2=wx.Button(bottompanel,-1,'Let\'s go!') #self.Bind(wx.EVT_BUTTON,self.onGo,self.gobutton2) #grid.Add(wx.StaticText(bottompanel,-1,''),0) #grid.Add(self.gobutton2,0) #grid.Add(wx.StaticText(bottompanel,-1,'Total progress:'),0) #self.gauge2=wx.Gauge(bottompanel,-1) #grid.Add(self.gauge2,1,wx.EXPAND) hboxwrapper4 = wx.BoxSizer(wx.HORIZONTAL) hbox4 = wx.BoxSizer(wx.VERTICAL) hboxwrapper4.Add(hbox4) hboxwrapper4.Add((0, DV.border_padding)) panel4.SetSizer(hboxwrapper4) self.stopbutton = wx.Button(panel4, -1, DV.l('Stop')) for button in (self.addByFile, self.addByURL, self.btnRename, self.btnMoveUp, self.btnMoveDown, self.deletebutton, self.gobutton1, self.stopbutton, self.btnSearch): button.SetMinSize((buttonwidth, button.GetSizeTuple()[1])) self.profiledropdown.SetMinSize((buttonwidth, tmplistheight)) self.profiledropdown.Bind(wx.EVT_CHOICE, self.onChangeProfileDropdown) self.profilepanel.Show() hbox4.Add(self.stopbutton) hbox4.Add((0, DV.border_padding)) #vbox.Add((0,DV.border_padding)) Ditto self.stopbutton.Disable() self.Bind(wx.EVT_BUTTON, self.onStop, self.stopbutton) grid.AddGrowableRow(0, 1) grid.AddGrowableCol(0, 1) self.Bind(wx.EVT_CLOSE, self.onClose, self) self.Bind(wx.EVT_SIZE, self.onResize, self) self.Bind(DV.evt_prog, self.onProgress) self.Bind(DV.evt_load, self.onLoading) Damnlog('DamnMainFrame: All GUI is up.') self.clipboardtimer = wx.Timer(self, -1) self.clipboardtimer.Start(1000) self.Bind(wx.EVT_TIMER, self.onClipboardTimer, self.clipboardtimer) Damnlog('DaminMainFrame: Clipboard timer started.') DV.icon = wx.Icon(DV.images_path + 'icon.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(DV.icon) Damnlog('DamnMainFrame: init stage 1 done.') | 7a486514c4f2b2eb8c7e2a316b3d60c539f2c4cb /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/11142/7a486514c4f2b2eb8c7e2a316b3d60c539f2c4cb/DamnVid.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
2738,
972,
12,
2890,
16,
982,
16,
612,
16,
2077,
4672,
463,
301,
82,
1330,
2668,
40,
301,
82,
6376,
3219,
10978,
10504,
5023,
1093,
13,
7075,
18,
3219,
16186,
2738,
972,
12,
2890... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
2738,
972,
12,
2890,
16,
982,
16,
612,
16,
2077,
4672,
463,
301,
82,
1330,
2668,
40,
301,
82,
6376,
3219,
10978,
10504,
5023,
1093,
13,
7075,
18,
3219,
16186,
2738,
972,
12,
2890... |
print pprint.pp.process(g.outputs[0]) | print pprint(g.outputs[0]) | def test_muldiv(self): x, y, z = matrices('xyz') a, b, c, d = matrices('abcd') | 8bac635aa52a9bd662a2bb534b37246d68e24b85 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/12438/8bac635aa52a9bd662a2bb534b37246d68e24b85/test_opt.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
67,
16411,
2892,
12,
2890,
4672,
619,
16,
677,
16,
998,
273,
16415,
2668,
17177,
6134,
279,
16,
324,
16,
276,
16,
302,
273,
16415,
2668,
378,
4315,
6134,
2,
0,
0,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
67,
16411,
2892,
12,
2890,
4672,
619,
16,
677,
16,
998,
273,
16415,
2668,
17177,
6134,
279,
16,
324,
16,
276,
16,
302,
273,
16415,
2668,
378,
4315,
6134,
2,
-100,
-100,
-100,
-10... |
map(lambda t: apply(secDB.put, t), ColorIndex) | map(lambda t, secDB=secDB: apply(secDB.put, t), ColorIndex) | def test01_join(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_join..." % \ self.__class__.__name__ | 3537da2ace7b993743a57c98b4acb0a8f5628404 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3187/3537da2ace7b993743a57c98b4acb0a8f5628404/test_join.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
1611,
67,
5701,
12,
2890,
4672,
309,
3988,
30,
1172,
2337,
82,
2187,
2400,
2218,
380,
5196,
1172,
315,
7051,
738,
87,
18,
3813,
1611,
67,
5701,
7070,
738,
521,
365,
16186,
1106,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
1611,
67,
5701,
12,
2890,
4672,
309,
3988,
30,
1172,
2337,
82,
2187,
2400,
2218,
380,
5196,
1172,
315,
7051,
738,
87,
18,
3813,
1611,
67,
5701,
7070,
738,
521,
365,
16186,
1106,
... |
Conditions on the parameters are alpha > -1 and beta} > -1. | Conditions on the parameters are alpha > 0 and beta > 0. | def betavariate(self, alpha, beta): """Beta distribution. | 06324fe34acc6da25e5cbecabd5f23380d862daf /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/8125/06324fe34acc6da25e5cbecabd5f23380d862daf/random.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2701,
842,
297,
3840,
12,
2890,
16,
4190,
16,
6796,
4672,
3536,
38,
1066,
7006,
18,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2701,
842,
297,
3840,
12,
2890,
16,
4190,
16,
6796,
4672,
3536,
38,
1066,
7006,
18,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
button.set_size_request(width + 2, height + 2) | padding = (6 if sys.platform == "win32" else 2) button.set_size_request(width + padding, height + padding) | def _get_tab_close_button(self): """Initialize and return a tab close button.""" | 9656478e2209be7b5fbc511bbdb6d278827fcc72 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/12852/9656478e2209be7b5fbc511bbdb6d278827fcc72/page.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
588,
67,
7032,
67,
4412,
67,
5391,
12,
2890,
4672,
3536,
7520,
471,
327,
279,
3246,
1746,
3568,
12123,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
588,
67,
7032,
67,
4412,
67,
5391,
12,
2890,
4672,
3536,
7520,
471,
327,
279,
3246,
1746,
3568,
12123,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
o = db.tag_object_by_id (DADGAD_ID, '/%s/testrating' % user, 5) | o = db.tag_object_by_id (self.dadgadID, '/%s/testrating' % user, 5) | def testSetTagByID (self): # fails against sandbox db = self.db user = db.credentials.username o = db.delete_abstract_tag ('testrating') o = db.create_abstract_tag ('testrating', "%s's testrating (0-10; more is better)" % self.user) o = db.tag_object_by_id (DADGAD_ID, '/%s/testrating' % user, 5) self.assertEqual (o, 0) status, v = db.get_tag_value_by_id (DADGAD_ID, 'testrating') self.assertEqual (v, 5) | a258ae866ad40d7092b84a6b1737df504976b56c /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/12637/a258ae866ad40d7092b84a6b1737df504976b56c/fdb.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
694,
1805,
13331,
261,
2890,
4672,
468,
6684,
5314,
15202,
1319,
273,
365,
18,
1966,
729,
273,
1319,
18,
11687,
18,
5053,
320,
273,
1319,
18,
3733,
67,
17801,
67,
2692,
7707,
1078,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
694,
1805,
13331,
261,
2890,
4672,
468,
6684,
5314,
15202,
1319,
273,
365,
18,
1966,
729,
273,
1319,
18,
11687,
18,
5053,
320,
273,
1319,
18,
3733,
67,
17801,
67,
2692,
7707,
1078,... |
colors = colors[:,NewAxis] + zeros(ncolmax)[NewAxis,:] | colors = colors[:,newaxis] + zeros(ncolmax)[newaxis,:] | def _makeoutput(self, scale, coords, radii, colors): if len(colors.shape) == 1: # Greyscales ncol = 1 else: ncol = colors.shape[1] # 1 or 3. assert ncol == 3 # RGB values # If one processor says RGB, all must convert ncolthis = array([ncol]) ncolmax = zeros((1,), ncolthis.typecode()) self.mpi.allreduce(ncolthis, ncolmax, self.MPI.max) ncolmax = ncolmax[0] if ncolmax > ncol: assert ncol == 1 colors = colors[:,NewAxis] + zeros(ncolmax)[NewAxis,:] ncol = ncolmax assert colors.shape == (len(coords), ncol) # Now send data from slaves to master data = zeros((len(coords)+1, 4+ncol), float) data[:-1,:3] = coords data[:-1,3] = radii data[-1,-1] = 4+ncol # Used to communicate shape if ncol == 1: data[:-1,4] = colors else: data[:-1,4:] = colors if not self.master: self.mpi.send(data, 0, self.mpitag) else: total = [data[:-1]] # Last row is the dimensions. n = len(coords) colsmin = colsmax = 4+ncol for proc in range(1, self.mpi.size): self._verb("Receiving from processor "+str(proc)) fdat = self.mpi.receive(float, proc, self.mpitag)[0] fdat.shape = (-1, fdat[-1]) fdat = fdat[:-1] # Last row is the dimensions. total.append(fdat) n = n + len(fdat) if fdat.shape[1] < colsmin: colsmin = fdat.shape[1] if fdat.shape[1] > colsmax: colsmax = fdat.shape[1] self._verb("Merging data") # Some processors may have only greyscales whereas others # may have RGB. That will cause difficulties. trouble = colsmax != colsmin data = zeros((n, colsmax), float) if trouble: assert data.shape[1] == 7 else: assert data.shape[1] == 7 or data.shape[1] == 5 i = 0 for d in total: if not trouble or d.shape[1] == 7: data[i:i+len(d)] = d else: assert d.shape[1] == 5 data[i:i+len(d), :5] = d data[i:i+len(d), 5] = d[4] data[i:i+len(d), 6] = d[4] i = i + len(d) assert i == len(data) # Now all data is on the master self._verb("Sorting merged data") order = argsort(data[:,2]) data = take(data, order) coords = data[:,:3] radii = data[:,3] if data.shape[1] == 5: colors = data[:,4] else: colors = data[:,4:] PrimiPlotter._makeoutput(self, scale, coords, radii, colors) | 1f2dd3935fed37f1cea965585c0c6d0971a3f5e5 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/5735/1f2dd3935fed37f1cea965585c0c6d0971a3f5e5/primiplotter.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
6540,
2844,
12,
2890,
16,
3159,
16,
6074,
16,
28125,
16,
5740,
4672,
309,
562,
12,
9724,
18,
4867,
13,
422,
404,
30,
468,
611,
266,
1900,
21177,
290,
1293,
273,
404,
469,
30,
29... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
6540,
2844,
12,
2890,
16,
3159,
16,
6074,
16,
28125,
16,
5740,
4672,
309,
562,
12,
9724,
18,
4867,
13,
422,
404,
30,
468,
611,
266,
1900,
21177,
290,
1293,
273,
404,
469,
30,
29... |
self.send_header() | self.send("<?xml version='1.0'?><stream:stream version='1.0' xmlns:stream='http://etherx.jabber.org/streams' to='%s' xmlns='%s'>"%(self.Server,self.Namespace)) while self.Dispatcher.Stream._document_attrs is None: self.Process(1) return 'ok' class Client(CommonClient): def connect(self,server=None,proxy=None): if not CommonClient.connect(self,server,proxy): return | def connect(self,server=None,proxy=None): if proxy: connected=transports.HTTPPROXYsocket(proxy,server).PlugIn(self) else: connected=transports.TCPsocket(server).PlugIn(self) if not connected: return if self.Connection.getPort()==5223: transports.TLS().PlugIn(self,now=1) dispatcher.Dispatcher().PlugIn(self) self.send_header() transports.TLS().PlugIn(self) while not self.Dispatcher.Stream._document_attrs and self.Process(): pass if not self.Dispatcher.Stream._document_attrs.has_key('version') or not self.Dispatcher.Stream._document_attrs['version']=='1.0': return while not self.Dispatcher.Stream.features and self.Process(): pass # If we get version 1.0 stream the features tag MUST BE presented if not self.Dispatcher.Stream.features.getTag('starttls'): return # TLS not supported by server while not self.TLS.starttls and self.Process(): pass if self.TLS.starttls<>'proceed': self.event('tls_failed'); return 'tls failed' return 'ok' | 4a0dc64c62f94f1d1cd8b5cb92c2b58deabd4bfb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7194/4a0dc64c62f94f1d1cd8b5cb92c2b58deabd4bfb/client.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3077,
12,
2890,
16,
3567,
33,
7036,
16,
5656,
33,
7036,
4672,
309,
2889,
30,
5840,
33,
2338,
4363,
18,
3693,
16085,
7814,
12,
5656,
16,
3567,
2934,
1749,
637,
382,
12,
2890,
13,
469,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3077,
12,
2890,
16,
3567,
33,
7036,
16,
5656,
33,
7036,
4672,
309,
2889,
30,
5840,
33,
2338,
4363,
18,
3693,
16085,
7814,
12,
5656,
16,
3567,
2934,
1749,
637,
382,
12,
2890,
13,
469,
... |
p = 2 if bound is None: bound = A.hecke_bound() while True: misc.verbose("using T_%s"%p) if anemic: while N % p == 0: p = arith.next_prime(p) f = self.hecke_polynomial(p) T = A.dual_hecke_matrix(p) V = T.kernel_on(V, poly=f, check=False) if V.dimension() <= self.dimension(): break p = arith.next_prime(p) if p > bound: break if V.rank() == self.rank(): self.__dual_free_module = V return V else: raise RuntimeError, "Computation of embedded dual vector space failed " + \ "(cut down to rank %s, but should have cut down to rank %s)."%(V.rank(), self.rank()) | N = self.level() p = 2 if bound is None: bound = A.hecke_bound() while True: if anemic: while N % p == 0: p = arith.next_prime(p) misc.verbose("using T_%s"%p) f = self.hecke_polynomial(p) T = A.dual_hecke_matrix(p) V = T.kernel_on(V, poly=f, check=False) if V.dimension() <= self.dimension(): break p = arith.next_prime(p) if p > bound: break if V.rank() == self.rank(): self.__dual_free_module = V return V else: raise RuntimeError, "Computation of embedded dual vector space failed " + \ "(cut down to rank %s, but should have cut down to rank %s)."%(V.rank(), self.rank()) | def dual_free_module(self, bound=None, anemic=True): """ Compute embedded dual free module if possible. In general this won't be possible, e.g., if this space is not Hecke equivariant, possibly if it is not cuspidal, or if the characteristic is not 0. In all these cases we raise a RuntimeError exception. """ try: return self.__dual_free_module except AttributeError: if self.dimension() == 0: self.__dual_free_module = self.ambient_hecke_module().dual_free_module().zero_submodule() return self.__dual_free_module # ALGORITHM: Compute the char poly of each Hecke operator on the # submodule, then use it to cut out a submodule of the dual. If # the dimension cuts down to the dimension of self terminate # with success. If it stays bigger beyond the bound (Sturm) # bound, raise a RuntimeError exception. misc.verbose("computing") N = self.level() A = self.ambient_hecke_module() if A.dimension() == self.dimension(): self.__dual_free_module = A.free_module() return self.__dual_free_module V = A.free_module() p = 2 if bound is None: bound = A.hecke_bound() while True: misc.verbose("using T_%s"%p) if anemic: while N % p == 0: p = arith.next_prime(p) f = self.hecke_polynomial(p) T = A.dual_hecke_matrix(p) V = T.kernel_on(V, poly=f, check=False) if V.dimension() <= self.dimension(): break p = arith.next_prime(p) if p > bound: break | 44390c2f3d28a6980046467c7676b7049c7f3ea1 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/9890/44390c2f3d28a6980046467c7676b7049c7f3ea1/submodule.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
24557,
67,
9156,
67,
2978,
12,
2890,
16,
2489,
33,
7036,
16,
392,
351,
335,
33,
5510,
4672,
3536,
8155,
7488,
24557,
4843,
1605,
309,
3323,
18,
225,
657,
7470,
333,
8462,
1404,
506,
33... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
24557,
67,
9156,
67,
2978,
12,
2890,
16,
2489,
33,
7036,
16,
392,
351,
335,
33,
5510,
4672,
3536,
8155,
7488,
24557,
4843,
1605,
309,
3323,
18,
225,
657,
7470,
333,
8462,
1404,
506,
33... |
second_descent = int(second_descent) | second_descent = int(second_descent) | def two_descent(self, verbose = True, selmer_only = False, first_limit = 20, second_limit = 8, n_aux = -1, second_descent = True): """ Compute 2-descent data for this curve. | 8b53e056cc765e689493ec9632c441ee03a3206a /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/8b53e056cc765e689493ec9632c441ee03a3206a/interface.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2795,
67,
5569,
319,
12,
2890,
16,
3988,
273,
1053,
16,
357,
6592,
67,
3700,
273,
1083,
16,
1122,
67,
3595,
273,
4200,
16,
2205,
67,
3595,
273,
1725,
16,
290,
67,
18196,
273,
300,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2795,
67,
5569,
319,
12,
2890,
16,
3988,
273,
1053,
16,
357,
6592,
67,
3700,
273,
1083,
16,
1122,
67,
3595,
273,
4200,
16,
2205,
67,
3595,
273,
1725,
16,
290,
67,
18196,
273,
300,
21... |
array([(1, (3,)), (4, (6,))], | array([(1, (3,)), (4, (6,))], | def drop_fields(base, drop_names, usemask=True, asrecarray=False): """ Return a new array with fields in `drop_names` dropped. Nested fields are supported. Parameters ---------- base : array Input array drop_names : string or sequence String or sequence of strings corresponding to the names of the fields to drop. usemask : {False, True}, optional Whether to return a masked array or not. asrecarray : string or sequence Whether to return a recarray or a mrecarray (`asrecarray=True`) or a plain ndarray or masked array with flexible dtype (`asrecarray=False`) Examples -------- >>> from numpy.lib import recfunctions as rfn >>> a = np.array([(1, (2, 3.0)), (4, (5, 6.0))], ... dtype=[('a', int), ('b', [('ba', float), ('bb', int)])]) >>> rfn.drop_fields(a, 'a') array([((2.0, 3),), ((5.0, 6),)], dtype=[('b', [('ba', '<f8'), ('bb', '<i4')])]) >>> rfn.drop_fields(a, 'ba') array([(1, (3,)), (4, (6,))], dtype=[('a', '<i4'), ('b', [('bb', '<i4')])]) >>> rfn.drop_fields(a, ['ba', 'bb']) array([(1,), (4,)], dtype=[('a', '<i4')]) """ if _is_string_like(drop_names): drop_names = [drop_names,] else: drop_names = set(drop_names) # def _drop_descr(ndtype, drop_names): names = ndtype.names newdtype = [] for name in names: current = ndtype[name] if name in drop_names: continue if current.names: descr = _drop_descr(current, drop_names) if descr: newdtype.append((name, descr)) else: newdtype.append((name, current)) return newdtype # newdtype = _drop_descr(base.dtype, drop_names) if not newdtype: return None # output = np.empty(base.shape, dtype=newdtype) output = recursive_fill_fields(base, output) return _fix_output(output, usemask=usemask, asrecarray=asrecarray) | 8d227b3f6d8e882676ce43a6651c20409b01bd96 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14925/8d227b3f6d8e882676ce43a6651c20409b01bd96/recfunctions.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3640,
67,
2821,
12,
1969,
16,
3640,
67,
1973,
16,
999,
4455,
33,
5510,
16,
487,
3927,
1126,
33,
8381,
4672,
3536,
2000,
279,
394,
526,
598,
1466,
316,
1375,
7285,
67,
1973,
68,
14611,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3640,
67,
2821,
12,
1969,
16,
3640,
67,
1973,
16,
999,
4455,
33,
5510,
16,
487,
3927,
1126,
33,
8381,
4672,
3536,
2000,
279,
394,
526,
598,
1466,
316,
1375,
7285,
67,
1973,
68,
14611,
... |
return configuratorClass(self.runid, self.policy, self.repository, | return configuratorClass(self.runid, policy, self.repository, | def createConfigurator(self): # prodPolicy - the production run policy self.logger.log(Log.DEBUG, "ProductionRunManager:createConfigurator") | f34d20b0b60bf0ba5d29279ad0b5d2aa9f08b6e6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6549/f34d20b0b60bf0ba5d29279ad0b5d2aa9f08b6e6/ProductionRunManager.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
752,
17182,
12,
2890,
4672,
468,
10791,
2582,
300,
326,
12449,
1086,
3329,
365,
18,
4901,
18,
1330,
12,
1343,
18,
9394,
16,
315,
31590,
1997,
1318,
30,
2640,
17182,
7923,
2,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
752,
17182,
12,
2890,
4672,
468,
10791,
2582,
300,
326,
12449,
1086,
3329,
365,
18,
4901,
18,
1330,
12,
1343,
18,
9394,
16,
315,
31590,
1997,
1318,
30,
2640,
17182,
7923,
2,
-100,
-100,
... |
exts.append( Extension('operator', ['operator.c']) ) | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 51b15239404c94da7472bdf543be6b831a9131c5 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12029/51b15239404c94da7472bdf543be6b831a9131c5/setup.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
5966,
67,
6400,
12,
2890,
4672,
468,
7693,
716,
342,
13640,
19,
3729,
353,
3712,
1399,
527,
67,
1214,
67,
869,
67,
1098,
12,
2890,
18,
9576,
18,
12083,
67,
8291,
16,
1173,
13640,
19,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
5966,
67,
6400,
12,
2890,
4672,
468,
7693,
716,
342,
13640,
19,
3729,
353,
3712,
1399,
527,
67,
1214,
67,
869,
67,
1098,
12,
2890,
18,
9576,
18,
12083,
67,
8291,
16,
1173,
13640,
19,
... | |
if set(val) != new_val or True: | if set(val) != new_val: | def commit(self, book_ids, notify=False): if self.process_each_book(): for book_id in book_ids: val = self.db.get_custom(book_id, num=self.col_id, index_is_id=True) new_val = self.getter(val) if set(val) != new_val or True: self.db.set_custom(book_id, new_val, num=self.col_id, notify=notify) else: val = self.getter() val = self.normalize_ui_val(val) if val != self.initial_val: for book_id in book_ids: self.db.set_custom(book_id, val, num=self.col_id, notify=notify) | c917f95c2c723d81946fa417941edc4bf3bde687 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9125/c917f95c2c723d81946fa417941edc4bf3bde687/custom_column_widgets.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3294,
12,
2890,
16,
6978,
67,
2232,
16,
5066,
33,
8381,
4672,
309,
365,
18,
2567,
67,
13798,
67,
3618,
13332,
364,
6978,
67,
350,
316,
6978,
67,
2232,
30,
1244,
273,
365,
18,
1966,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3294,
12,
2890,
16,
6978,
67,
2232,
16,
5066,
33,
8381,
4672,
309,
365,
18,
2567,
67,
13798,
67,
3618,
13332,
364,
6978,
67,
350,
316,
6978,
67,
2232,
30,
1244,
273,
365,
18,
1966,
1... |
@unittest2.expectedFailure | def test_break_with_dwarf(self): """Test setting objc breakpoints using 'regexp-break' and 'breakpoint set'.""" self.buildDwarf() self.break_on_objc_methods() | 8f7f9e03d7238e4d458588efbba63de7c9c2a9a1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11986/8f7f9e03d7238e4d458588efbba63de7c9c2a9a1/TestObjCMethods.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
67,
8820,
67,
1918,
67,
72,
905,
74,
12,
2890,
4672,
3536,
4709,
3637,
1081,
71,
23416,
1450,
296,
17745,
17,
8820,
11,
471,
296,
8820,
1153,
444,
11,
12123,
365,
18,
3510,
40,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
67,
8820,
67,
1918,
67,
72,
905,
74,
12,
2890,
4672,
3536,
4709,
3637,
1081,
71,
23416,
1450,
296,
17745,
17,
8820,
11,
471,
296,
8820,
1153,
444,
11,
12123,
365,
18,
3510,
40,
... | |
"""Check that WeakValueDictionary class conforms to the mapping protocol""" | """Check that WeakValueDictionary conforms to the mapping protocol""" | def __eq__(self, other): if mutate: # Side effect that mutates the dict, by removing the # last strong reference to a key. del objs[-1] return self.value == other.value | 449caca1523a486e022ec94684bbfe4a4d6952f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3187/449caca1523a486e022ec94684bbfe4a4d6952f8/test_weakref.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
11253,
972,
12,
2890,
16,
1308,
4672,
309,
15887,
30,
468,
26248,
5426,
716,
4318,
815,
326,
2065,
16,
635,
9427,
326,
468,
1142,
11773,
2114,
358,
279,
498,
18,
1464,
12721,
18919... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
11253,
972,
12,
2890,
16,
1308,
4672,
309,
15887,
30,
468,
26248,
5426,
716,
4318,
815,
326,
2065,
16,
635,
9427,
326,
468,
1142,
11773,
2114,
358,
279,
498,
18,
1464,
12721,
18919... |
if config.ZOPE_LINES_IS_TUPLE_TYPE: value = tuple(value) | def set(self, instance, value, **kwargs): """ If passed-in value is a string, split at line breaks and remove leading and trailing white space before storing in object with rest of properties. """ __traceback_info__ = value, type(value) if type(value) in STRING_TYPES: value = value.split('\n') value = [decode(v.strip(), instance, **kwargs) for v in value if v.strip()] value = filter(None, value) if config.ZOPE_LINES_IS_TUPLE_TYPE: value = tuple(value) ObjectField.set(self, instance, value, **kwargs) | 64c71cec849e633ac53e1bcfe44e2c42bf15bd9b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12165/64c71cec849e633ac53e1bcfe44e2c42bf15bd9b/Field.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
444,
12,
2890,
16,
791,
16,
460,
16,
2826,
4333,
4672,
3536,
971,
2275,
17,
267,
460,
353,
279,
533,
16,
1416,
622,
980,
16217,
471,
1206,
7676,
471,
7341,
9578,
3476,
1865,
15729,
316... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
444,
12,
2890,
16,
791,
16,
460,
16,
2826,
4333,
4672,
3536,
971,
2275,
17,
267,
460,
353,
279,
533,
16,
1416,
622,
980,
16217,
471,
1206,
7676,
471,
7341,
9578,
3476,
1865,
15729,
316... | |
self._report_rain(total, rate) | self._report_rain(rainTotal, rainRate) | def decodeRecord(self, record): type = record[0] if type == 0xD3: self.decodeTimeStamp(record[2:7]) dirDeg = record[7] * 22.5 gustSpeed = record[9] / 3.6 avgSpeed = (((record[10] & 0xF0) >> 4) | (record[11] & 0xF0)) / 3.6 self.logger.info("Wind Dir: %s" % windDirMap[record[7]]) self.logger.info("Gust: %.1f km/h" % gustSpeed) self.logger.info("Wind: %.1f km/h" % avgSpeed) self._report_wind(dirDeg, avgSpeed, gustSpeed) elif type == 0xD4: self.decodeTimeStamp(record[2:7]) rate = record[8] self.logger.info("Rain Rate: %d mm/hr" % rate) self.logger.info("Rain Hour: %d mm" % (record[9] * 256 + record[10])) self.logger.info("Rain 24h: %.1f mm" % ((record[11] * 256 + record[12]) / 1000.0)) total = (record[13] * 256 + record[14]) / 1000.0 self.logger.info("Rain Total: %.1f mm" % total) self.decodeTimeStamp(record[15:20]) self._report_rain(total, rate) elif type == 0xD5: # Untested. I don't have a UV sensor. uv = record[7] self.logger.info("UV Index: %d" % uv) self._report_uv(uv) elif type == 0xD6: self.decodeTimeStamp(record[2:7]) pressure = (record[8] & 0xF) * 256 + record[7] self.logger.info("Forecast1: %s" % forecastMap[(record[8] & 0xF0) >> 4]) self.logger.info("Pressure1: %d hPa" % pressure) self.logger.info("Forecast1: %s" % forecastMap[(record[10] & 0xF0) >> 4]) self.logger.info("Pressure2: %d hPa" % ((record[10] & 0xF) * 256 + record[9])) self._report_barometer_absolute(pressure) elif type == 0xD7: self.decodeTimeStamp(record[2:7]) offset = 7 rSize = 7 records = (record[1] - offset + 1) / rSize for i in xrange(records): sensor = record[offset + i * rSize] & 0xF temp = ((record[offset + i * rSize + 2] & 0x0F) * 256 + record[offset + i * rSize + 1]) * 0.1 if record[offset + i * rSize + 2] & 0x80: temp = -temp humidity = record[offset + i * rSize + 3] self.logger.info("Sensor: %d" % sensor) self.logger.info("Temp: %.1f C" % temp) self.logger.info("Humidity: %d%%" % humidity) dewPoint = (record[12] * 256 + record[11]) * 0.1 self.logger.info("Dew point: %.1f C" % dewPoint) self._report_temperature(temp, humidity, sensor) | 299ca2bbe7bddf68c6261581c1566094af3d303f /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/3323/299ca2bbe7bddf68c6261581c1566094af3d303f/wmr200.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2495,
2115,
12,
2890,
16,
1409,
4672,
618,
273,
1409,
63,
20,
65,
309,
618,
422,
374,
17593,
23,
30,
365,
18,
3922,
21536,
12,
3366,
63,
22,
30,
27,
5717,
1577,
13283,
273,
1409,
63,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2495,
2115,
12,
2890,
16,
1409,
4672,
618,
273,
1409,
63,
20,
65,
309,
618,
422,
374,
17593,
23,
30,
365,
18,
3922,
21536,
12,
3366,
63,
22,
30,
27,
5717,
1577,
13283,
273,
1409,
63,... |
if self.transport.connected and not self.transport.disconnecting: self.transport.resumeProducing() | self.transport.resumeProducing() | def resumeProducing(self): self.paused -= 1 if self.paused==0: if self.transport.connected and not self.transport.disconnecting: self.transport.resumeProducing() | 66cf070908c09e9515b4c7db1ec2f0199dd65123 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/10078/66cf070908c09e9515b4c7db1ec2f0199dd65123/protocol.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
10774,
8390,
2822,
12,
2890,
4672,
365,
18,
8774,
3668,
3947,
404,
309,
365,
18,
8774,
3668,
631,
20,
30,
309,
365,
18,
13049,
18,
8537,
471,
486,
365,
18,
13049,
18,
20177,
310,
30,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
10774,
8390,
2822,
12,
2890,
4672,
365,
18,
8774,
3668,
3947,
404,
309,
365,
18,
8774,
3668,
631,
20,
30,
309,
365,
18,
13049,
18,
8537,
471,
486,
365,
18,
13049,
18,
20177,
310,
30,
... |
""" | """ | def fetch_bugs(request): # FIXME: Give bugs some date field language = request.GET.get('language', '') format = request.GET.get('format', None) start = int(request.GET.get('start', 1)) end = int(request.GET.get('end', 10)) bugs = Bug.objects.all() if language: bugs = bugs.filter(project__language=language) #if status: # bugs = bugs.filter(project__status=status) bugs = bugs[start-1:end] for b in bugs: """ b.description += "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." b.description = b.description[:65] + "..." """ b.project.icon_url = "/static/images/icons/projects/%s.png" % b.project.name.lower() if format == 'json': return bugs_to_json_response(bugs, request.GET.get('jsoncallback', 'alert')) else: prev_page_query_str = QueryDict('') prev_page_query_str = prev_page_query_str.copy() next_page_query_str = QueryDict('') next_page_query_str = next_page_query_str.copy() if language: prev_page_query_str['language'] = language next_page_query_str['language'] = language if format: prev_page_query_str['format'] = format next_page_query_str['format'] = format diff = end - start prev_page_query_str['start'] = start - diff - 1 prev_page_query_str['end'] = start - 1 next_page_query_str['start'] = end + 1 next_page_query_str['end'] = end + diff + 1 return render_to_response('search/search.html', { 'bunch_of_bugs': bugs, 'developer_name': "Orrin Hatch", 'language': language, 'start': start, 'end': end, 'url': 'http://launchpad.net/', 'prev_page_url': '/search/?' + prev_page_query_str.urlencode(), 'next_page_url': '/search/?' + next_page_query_str.urlencode() }) | 1a4e7c1bf89031f94711c1ea65959742c1f064c8 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/11976/1a4e7c1bf89031f94711c1ea65959742c1f064c8/views.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2158,
67,
19381,
12,
2293,
4672,
468,
9852,
30,
22374,
22398,
2690,
1509,
652,
225,
2653,
273,
590,
18,
3264,
18,
588,
2668,
4923,
2187,
28707,
740,
273,
590,
18,
3264,
18,
588,
2668,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2158,
67,
19381,
12,
2293,
4672,
468,
9852,
30,
22374,
22398,
2690,
1509,
652,
225,
2653,
273,
590,
18,
3264,
18,
588,
2668,
4923,
2187,
28707,
740,
273,
590,
18,
3264,
18,
588,
2668,
... |
weighting, setting ``weighted`` to ``True`` will force | weighting, setting ``weighted=True`` will force | def longest_path(self, s = None, t = None, weighted = False, algorithm = "MILP", solver = None, verbose = 0): r""" Returns a longest path of ``self``. | 1ce3f98f3b3a6c76baa509a4ebc0110ea7853d74 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9890/1ce3f98f3b3a6c76baa509a4ebc0110ea7853d74/generic_graph.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
12163,
67,
803,
12,
2890,
16,
272,
273,
599,
16,
268,
273,
599,
16,
13747,
273,
1083,
16,
4886,
273,
315,
49,
2627,
52,
3113,
12776,
273,
599,
16,
3988,
273,
374,
4672,
436,
8395,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
12163,
67,
803,
12,
2890,
16,
272,
273,
599,
16,
268,
273,
599,
16,
13747,
273,
1083,
16,
4886,
273,
315,
49,
2627,
52,
3113,
12776,
273,
599,
16,
3988,
273,
374,
4672,
436,
8395,
28... |
self.announce(' ...msgmerge found at %s' % self.msgmerge_exe) | self.announce(' ...msgmerge found at %s' % self.msgmerge_exe) | def finalize_options(self): if self.xgettext_exe is None: self.announce('Searching xgettext...') self.xgettext_exe = spawn.find_executable('xgettext') if self.xgettext_exe is None: raise SystemExit('Couldn\'t find "xgettext".') self.announce(' ...xgettext found at %s' % self.xgettext_exe) | b989b48d397440412fdd5c0b7129d414e5bfa640 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/2215/b989b48d397440412fdd5c0b7129d414e5bfa640/appdistutils.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
12409,
67,
2116,
12,
2890,
4672,
309,
365,
18,
92,
29967,
67,
14880,
353,
599,
30,
365,
18,
1072,
8386,
2668,
2979,
310,
619,
29967,
7821,
13,
365,
18,
92,
29967,
67,
14880,
273,
12560... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
12409,
67,
2116,
12,
2890,
4672,
309,
365,
18,
92,
29967,
67,
14880,
353,
599,
30,
365,
18,
1072,
8386,
2668,
2979,
310,
619,
29967,
7821,
13,
365,
18,
92,
29967,
67,
14880,
273,
12560... |
out = "%s-%s" % (cfg.hostmask_prefix, alpha) | out = "%s-%X" % (cfg.hostmask_prefix, alpha) | def mask_hostname(host): alpha = d(m(m("%s:%s:%s" % (KEY1, host, KEY2)) + KEY3)) out = "%s-%s" % (cfg.hostmask_prefix, alpha) try: out += host[host.index('.'):] except ValueError: pass return out | 0c0c4ff9d50f9bc73793b9c7d046c6b1be9bf6c4 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/4752/0c0c4ff9d50f9bc73793b9c7d046c6b1be9bf6c4/hostmask.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3066,
67,
10358,
12,
2564,
4672,
4190,
273,
302,
12,
81,
12,
81,
27188,
87,
5319,
87,
5319,
87,
6,
738,
261,
3297,
21,
16,
1479,
16,
5311,
22,
3719,
397,
5311,
23,
3719,
225,
596,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3066,
67,
10358,
12,
2564,
4672,
4190,
273,
302,
12,
81,
12,
81,
27188,
87,
5319,
87,
5319,
87,
6,
738,
261,
3297,
21,
16,
1479,
16,
5311,
22,
3719,
397,
5311,
23,
3719,
225,
596,
... |
msgstr = '\0'.join(msgstr) | msgid = self._encode(e.msgid + '\0' + e.msgid_plural) msgstr = self._encode('\0'.join(msgstr)) | def cmp(_self, other): if _self.msgid > other.msgid: return 1 elif _self.msgid < other.msgid: return -1 else: return 0 | 9d732105697624731ed08ef764908b70660f97db /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5718/9d732105697624731ed08ef764908b70660f97db/polib.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
9411,
24899,
2890,
16,
1308,
4672,
309,
389,
2890,
18,
3576,
350,
405,
1308,
18,
3576,
350,
30,
327,
404,
1327,
389,
2890,
18,
3576,
350,
411,
1308,
18,
3576,
350,
30,
327,
300,
21,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
9411,
24899,
2890,
16,
1308,
4672,
309,
389,
2890,
18,
3576,
350,
405,
1308,
18,
3576,
350,
30,
327,
404,
1327,
389,
2890,
18,
3576,
350,
411,
1308,
18,
3576,
350,
30,
327,
300,
21,
... |
rec = c.first() | rec = self.cur.first() | def finish_test(self, secDB, txn=None): # 'Blues' should not be in the secondary database vals = secDB.pget('Blues', txn=txn) assert vals == None, vals | c5cf731a4deb710892c9083a468a6d173d791456 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8125/c5cf731a4deb710892c9083a468a6d173d791456/test_associate.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
4076,
67,
3813,
12,
2890,
16,
1428,
2290,
16,
7827,
33,
7036,
4672,
468,
296,
4802,
3610,
11,
1410,
486,
506,
316,
326,
9946,
2063,
5773,
273,
1428,
2290,
18,
84,
588,
2668,
4802,
3610... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
4076,
67,
3813,
12,
2890,
16,
1428,
2290,
16,
7827,
33,
7036,
4672,
468,
296,
4802,
3610,
11,
1410,
486,
506,
316,
326,
9946,
2063,
5773,
273,
1428,
2290,
18,
84,
588,
2668,
4802,
3610... |
>>> if self._top_page not in ("trees.html", "indices.html", "help.html"): | >>> if self._top_page_url not in ("trees.html", "indices.html", "help.html"): | def write_graph(self, out, graph): # Write the graph's image to a file path = os.path.join(self._directory, graph.uid) if not graph.write('%s.gif' % path, 'gif'): return # Generate the image map. cmapx = graph.render('cmapx') or '' # Display the graph. out('%s\n<center>\n<img src="%s.gif" alt="%s" usemap="#%s" ' 'ismap="ismap" class="graph-without-title"/>\n</center>' % (cmapx, graph.uid, graph.uid, graph.uid)) | 28d88ae14617650a4a829fae94668100dc4e2b05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3512/28d88ae14617650a4a829fae94668100dc4e2b05/html.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1045,
67,
4660,
12,
2890,
16,
596,
16,
2667,
4672,
468,
2598,
326,
2667,
1807,
1316,
358,
279,
585,
589,
273,
1140,
18,
803,
18,
5701,
12,
2890,
6315,
5149,
16,
2667,
18,
1911,
13,
3... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1045,
67,
4660,
12,
2890,
16,
596,
16,
2667,
4672,
468,
2598,
326,
2667,
1807,
1316,
358,
279,
585,
589,
273,
1140,
18,
803,
18,
5701,
12,
2890,
6315,
5149,
16,
2667,
18,
1911,
13,
3... |
attach.extend(getSearchPaths(name)) attachable.extend(self._findAttachableDatabases(attach)) | if searchPaths: attach.extend(getSearchPaths(name)) attachable.extend(self._findAttachableDatabases(attach, searchPaths)) | def _findAttachableDatabases(self, attachList): """ Returns URLs for databases that can be attached to a given database. """ attachable = [] for name in attachList: if '://' in name: # database url attachable.append(name) elif os.path.isabs(name): # path if not os.path.exists(name): continue | efeca3d2902f76d7d3753812050d8f9422892085 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11128/efeca3d2902f76d7d3753812050d8f9422892085/dbconnector.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
4720,
4761,
429,
31635,
12,
2890,
16,
3306,
682,
4672,
3536,
2860,
10414,
364,
16358,
716,
848,
506,
7495,
358,
279,
864,
2063,
18,
3536,
3306,
429,
273,
5378,
364,
508,
316,
3306,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
4720,
4761,
429,
31635,
12,
2890,
16,
3306,
682,
4672,
3536,
2860,
10414,
364,
16358,
716,
848,
506,
7495,
358,
279,
864,
2063,
18,
3536,
3306,
429,
273,
5378,
364,
508,
316,
3306,
... |
date = datetime.strptime(date, '%Y-%m-%d %H:%M:%S') date = int(time.mktime(date.timetuple()))*1000 | date = time.strptime(date, '%Y-%m-%d %H:%M:%S') date = int(time.mktime(date))*1000 | def main(): """ Calls the parse_args function based on the command-line inputs and handles parsed arguments. """ (opts, args) = parse_args(sys.argv) # Handle parsed options. if opts.svn_log: log_file = opts.svn_log # Check to be sure the specified log path exists. if os.path.exists(log_file): # Iterate through log file lines to parse out the revision history, adding Event # entries to a list as we go. event_list = [] file_handle = open(log_file, 'r') line = file_handle.readline() while len(line) > 0: # The svn_sep indicates a new revision history to parse. if line.startswith(svn_sep): # Extract author and date from revision line. Here is a sample revision line: # r9 | michael.ogawa | 2008-06-19 10:23:25 -0500 (Thu, 19 Jun 2008) | 3 lines. rev_line = file_handle.readline() # The last line of the file is an svn_sep line, so if we try to retreive the # revision line and get an empty string, we know we are at the end of the file # and can break out of the loop. if rev_line is '' or len(rev_line) < 2: break; rev_parts = rev_line.split(' | ') author = rev_parts[1] date_parts = rev_parts[2].split(" ") date = date_parts[0] + " " + date_parts[1] date = datetime.strptime(date, '%Y-%m-%d %H:%M:%S') date = int(time.mktime(date.timetuple()))*1000 # Skip the 'Changed paths:' line and start reading in the changed filenames. file_handle.readline() path = file_handle.readline() while len(path) > 1: ch_path = path[5:].split(" (from")[0].replace("\n", "") event_list.append(Event(ch_path, date, author)) path = file_handle.readline() line = file_handle.readline() file_handle.close() # Generate standard event xml file from event_list. create_event_xml(event_list, log_file, opts.output_log) else: print "Please specify an existing path." if opts.cvs_log: log_file = opts.cvs_log # Check to be sure the specified log path exists. if os.path.exists(log_file): event_list = [] filename = "" file_handle = open(log_file, 'r') line = file_handle.readline() while len(line) > 0: # The cvs_sep indicates a new revision history to parse. if line.startswith(cvs_sep): #Read the revision number rev_line = file_handle.readline() # Extract author and date from revision line. rev_line = file_handle.readline() if(rev_line.lower().find("date:") == 0): rev_parts = rev_line.split('; ') date_parts = rev_parts[0].split(": ") date = datetime.strptime(date_parts[1], '%Y/%m/%d %H:%M:%S') date = int(time.mktime(date.timetuple())*1000) author = rev_parts[1].split(": ")[1] event_list.append(Event(filename, date, author)) line = file_handle.readline() if(str(line) == ""): break elif(line.lower().find("rcs file: ") >= 0): rev_line = line.split(": "); filename = rev_line[1].strip().split(',')[0] file_handle.close() # Generate standard event xml file from event_list. create_event_xml(event_list, log_file, opts.output_log) else: print "Please specify an existing path." if opts.git_log: print "Not yet implemented." if opts.wikimedia_log: print "Not yet implemented." | 07bd69abc7d3d5cca73da4cd75778d9c20d7bdb5 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/5288/07bd69abc7d3d5cca73da4cd75778d9c20d7bdb5/convert_logs.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2774,
13332,
3536,
23665,
326,
1109,
67,
1968,
445,
2511,
603,
326,
1296,
17,
1369,
4540,
471,
7372,
2707,
1775,
18,
3536,
261,
4952,
16,
833,
13,
273,
1109,
67,
1968,
12,
9499,
18,
19... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2774,
13332,
3536,
23665,
326,
1109,
67,
1968,
445,
2511,
603,
326,
1296,
17,
1369,
4540,
471,
7372,
2707,
1775,
18,
3536,
261,
4952,
16,
833,
13,
273,
1109,
67,
1968,
12,
9499,
18,
19... |
res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context) | res[account_id][name] = round(sum,2) data = self._compute_level_tree(cr, uid, ids, child_ids, res, [name], context) for i in data: res_final[i] = data[i][name] return res_final | def _total_cost_calc(self, cr, uid, ids, name, arg, context=None): res = {} parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)], context=context)) if parent_ids: cr.execute("""SELECT account_analytic_line.account_id, COALESCE(SUM(amount_currency), 0.0) \ FROM account_analytic_line \ JOIN account_analytic_journal \ ON account_analytic_line.journal_id = account_analytic_journal.id \ WHERE account_analytic_line.account_id IN %s \ AND amount<0 \ GROUP BY account_analytic_line.account_id""",(parent_ids,)) for account_id, sum in cr.fetchall(): res[account_id] = round(sum,2) return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context) | 4b09311a7342151ec794c610eafc2ea578fd49b9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/4b09311a7342151ec794c610eafc2ea578fd49b9/account_analytic_analysis.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
4963,
67,
12398,
67,
12448,
12,
2890,
16,
4422,
16,
4555,
16,
3258,
16,
508,
16,
1501,
16,
819,
33,
7036,
4672,
400,
273,
2618,
982,
67,
2232,
273,
3193,
12,
2890,
18,
3072,
12,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
4963,
67,
12398,
67,
12448,
12,
2890,
16,
4422,
16,
4555,
16,
3258,
16,
508,
16,
1501,
16,
819,
33,
7036,
4672,
400,
273,
2618,
982,
67,
2232,
273,
3193,
12,
2890,
18,
3072,
12,... |
a[1:5,1] = list('hello') | a[:,1] = farray(list('hello'),'S1') | def test_string_array(self): d = Dictionary() d['string'] = ['one', 'two', 'three'] a = FortranArray(d.get_array('string')) a[1:5,1] = list('hello') self.assertEqual(list(a2s(d['string'])), list(a2s(a))) | 22553d1954c5354861ecddbbf6c7ba8804bbdc65 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8914/22553d1954c5354861ecddbbf6c7ba8804bbdc65/test_dictionary.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
67,
1080,
67,
1126,
12,
2890,
4672,
302,
273,
16447,
1435,
302,
3292,
1080,
3546,
273,
10228,
476,
2187,
296,
15415,
2187,
296,
451,
992,
3546,
279,
273,
2457,
13171,
1076,
12,
72,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
67,
1080,
67,
1126,
12,
2890,
4672,
302,
273,
16447,
1435,
302,
3292,
1080,
3546,
273,
10228,
476,
2187,
296,
15415,
2187,
296,
451,
992,
3546,
279,
273,
2457,
13171,
1076,
12,
72,... |
return None | if response.status == 404: return None else: raise S3ResponseError(response.status, response.reason, body) | def get_key(self, key_name): """ Check to see if a particular key exists within the bucket. This method uses a HEAD request to check for the existance of the key. Returns: An instance of a Key object or None """ path = '/%s/%s' % (self.name, key_name) response = self.connection.make_request('HEAD', urllib.quote(path)) if response.status == 200: body = response.read() k = self.key_class(self) k.metadata = boto.utils.get_aws_metadata(response.msg) k.etag = response.getheader('etag') k.content_type = response.getheader('content-type') k.last_modified = response.getheader('last-modified') k.size = response.getheader('content-length') k.name = key_name return k else: # -- gross hack -- # httplib gets confused with chunked responses to HEAD requests # so I have to fake it out response.chunked = 0 body = response.read() return None | 567be50e30fafc6936d9eeec7746083b9ad792df /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/1098/567be50e30fafc6936d9eeec7746083b9ad792df/bucket.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
336,
67,
856,
12,
2890,
16,
498,
67,
529,
4672,
3536,
2073,
358,
2621,
309,
279,
6826,
498,
1704,
3470,
326,
2783,
18,
225,
1220,
707,
4692,
279,
14792,
590,
358,
866,
364,
326,
1005,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
336,
67,
856,
12,
2890,
16,
498,
67,
529,
4672,
3536,
2073,
358,
2621,
309,
279,
6826,
498,
1704,
3470,
326,
2783,
18,
225,
1220,
707,
4692,
279,
14792,
590,
358,
866,
364,
326,
1005,
... |
for x in all_input_formats(): mt = guess_type('dummy.'+x)[0] if mt: f.write('MimeType=%s;\n'%mt) | f.write('MimeType=%s;\n'%';'.join(mimetypes)) | def write_mimetypes(f): for x in all_input_formats(): mt = guess_type('dummy.'+x)[0] if mt: f.write('MimeType=%s;\n'%mt) | f28aed051186076b966fce4171cc4185d0f64878 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9125/f28aed051186076b966fce4171cc4185d0f64878/linux.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1045,
67,
81,
381,
15180,
12,
74,
4672,
364,
619,
316,
777,
67,
2630,
67,
11962,
13332,
5874,
273,
7274,
67,
723,
2668,
21050,
1093,
15,
92,
25146,
20,
65,
309,
5874,
30,
284,
18,
26... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1045,
67,
81,
381,
15180,
12,
74,
4672,
364,
619,
316,
777,
67,
2630,
67,
11962,
13332,
5874,
273,
7274,
67,
723,
2668,
21050,
1093,
15,
92,
25146,
20,
65,
309,
5874,
30,
284,
18,
26... |
for base in cls.__bases__: if hasattr(base, "_getDefaults"): defaults.update(base._getDefaults()) | def _getDefaults(cls): defaults = {} for name, value in cls.__dict__.items(): if name[0] != "_" and not isinstance(value, (function, classmethod)): defaults[name] = deepcopy(value) for base in cls.__bases__: if hasattr(base, "_getDefaults"): defaults.update(base._getDefaults()) return defaults | ed8bfce0028ecd7e7c3b778f70b24d8d03809a05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ed8bfce0028ecd7e7c3b778f70b24d8d03809a05/bundlebuilder.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
588,
7019,
12,
6429,
4672,
3467,
273,
2618,
364,
508,
16,
460,
316,
2028,
16186,
1576,
25648,
3319,
13332,
309,
508,
63,
20,
65,
480,
8802,
471,
486,
1549,
12,
1132,
16,
261,
915,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
588,
7019,
12,
6429,
4672,
3467,
273,
2618,
364,
508,
16,
460,
316,
2028,
16186,
1576,
25648,
3319,
13332,
309,
508,
63,
20,
65,
480,
8802,
471,
486,
1549,
12,
1132,
16,
261,
915,... | |
if req.header_only and not re_special_uri.match(req.uri): | if req.header_only and not RE_SPECIAL_URI.match(req.uri): | def _handler(req): """ This handler is invoked by mod_python with the apache request.""" try: allowed_methods = ("GET", "POST", "HEAD", "OPTIONS") req.allow_methods(allowed_methods, 1) if req.method not in allowed_methods: raise apache.SERVER_RETURN, apache.HTTP_METHOD_NOT_ALLOWED | 00bdd4e15cae5bba82b87f2de4cd2c3f177919b7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12027/00bdd4e15cae5bba82b87f2de4cd2c3f177919b7/webinterface_handler.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
4176,
12,
3658,
4672,
3536,
1220,
1838,
353,
8187,
635,
681,
67,
8103,
598,
326,
12291,
590,
12123,
775,
30,
2935,
67,
5163,
273,
7566,
3264,
3113,
315,
3798,
3113,
315,
12458,
3113... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
4176,
12,
3658,
4672,
3536,
1220,
1838,
353,
8187,
635,
681,
67,
8103,
598,
326,
12291,
590,
12123,
775,
30,
2935,
67,
5163,
273,
7566,
3264,
3113,
315,
3798,
3113,
315,
12458,
3113... |
tag_types = NodeTagTypes (self.api,node_tag_type_id_or_tagname) | tag_types = NodeTagTypes (self.api,[node_tag_type_id_or_tagname]) | def call(self, auth, groupname, node_tag_type_id_or_tagname, tagvalue): # locate tag type tag_types = NodeTagTypes (self.api,node_tag_type_id_or_tagname) if not(tag_types): raise PLCInvalidArgument, "No such tag type %r"%node_tag_type_id_or_tagname tag_type=tag_types[0] | f92114b6cf8d3de3a6ffec076e9c3c1fdc47e378 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/7598/f92114b6cf8d3de3a6ffec076e9c3c1fdc47e378/AddNodeGroup.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
745,
12,
2890,
16,
1357,
16,
25329,
16,
756,
67,
2692,
67,
723,
67,
350,
67,
280,
67,
2692,
529,
16,
1047,
1132,
4672,
468,
10627,
1047,
618,
1047,
67,
2352,
273,
2029,
1805,
2016,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
745,
12,
2890,
16,
1357,
16,
25329,
16,
756,
67,
2692,
67,
723,
67,
350,
67,
280,
67,
2692,
529,
16,
1047,
1132,
4672,
468,
10627,
1047,
618,
1047,
67,
2352,
273,
2029,
1805,
2016,
2... |
self.__pari_prime = P[0] return self.__pari_prime is not None | self._pari_prime = P[0] return self._pari_prime is not None | def is_prime(self): """ Return True if this ideal is prime. | c989217220c4ac3c4e3d27ab0c4a9fe6e7ed585c /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/9890/c989217220c4ac3c4e3d27ab0c4a9fe6e7ed585c/number_field_ideal.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
353,
67,
16382,
12,
2890,
4672,
3536,
2000,
1053,
309,
333,
23349,
353,
17014,
18,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
353,
67,
16382,
12,
2890,
4672,
3536,
2000,
1053,
309,
333,
23349,
353,
17014,
18,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
true if command-line were successfully parsed and we should carry | true if command-line was successfully parsed and we should carry | def parse_command_line (self): """Parse the setup script's command line, taken from the 'script_args' instance attribute (which defaults to 'sys.argv[1:]' -- see 'setup()' in core.py). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternately scanned for Distutils commands and options for that command. Each new command terminates the options for the previous command. The allowed options for a command are determined by the 'user_options' attribute of the command class -- thus, we have to be able to load command classes in order to parse the command line. Any error in that 'options' attribute raises DistutilsGetoptError; any error on the command-line raises DistutilsArgError. If no Distutils commands were found on the command line, raises DistutilsArgError. Return true if command-line were successfully parsed and we should carry on with executing commands; false if no errors but we shouldn't execute commands (currently, this only happens if user asks for help). """ # We have to parse the command line a bit at a time -- global # options, then the first command, then its options, and so on -- # because each command will be handled by a different class, and # the options that are valid for a particular class aren't known # until we have loaded the command class, which doesn't happen # until we know what the command is. | 1bd7ad2e3e38bb7b880fc03e866939bddcfa2c55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8125/1bd7ad2e3e38bb7b880fc03e866939bddcfa2c55/dist.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1109,
67,
3076,
67,
1369,
261,
2890,
4672,
3536,
3201,
326,
3875,
2728,
1807,
1296,
980,
16,
9830,
628,
326,
296,
4263,
67,
1968,
11,
791,
1566,
261,
12784,
3467,
358,
296,
9499,
18,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1109,
67,
3076,
67,
1369,
261,
2890,
4672,
3536,
3201,
326,
3875,
2728,
1807,
1296,
980,
16,
9830,
628,
326,
296,
4263,
67,
1968,
11,
791,
1566,
261,
12784,
3467,
358,
296,
9499,
18,
1... |
while ss[--i].type !== BLOCK: pass | while ss[i].type !== BLOCK: i -= 1 | def Variables(tokenizer, compilerContext, letBlock): """Parses a comma-separated list of var declarations (and maybe initializations).""" builder = compilerContext.builder if tokenizer.token.type == VAR: build = builder.VAR__build addDecl = builder.VAR__addDecl finish = builder.VAR__finish s = compilerContext elif tokenizer.token.type == CONST: build = builder.CONST__build addDecl = builder.CONST__addDecl finish = builder.CONST__finish s = compilerContext elif tokenizer.token.type == LET or tokenizer.token.type == LEFT_PAREN: build = builder.LET__build addDecl = builder.LET__addDecl finish = builder.LET__finish if not letBlock: ss = compilerContext.stmtStack i = ss.length # a BLOCK *must* be found. while ss[--i].type !== BLOCK: pass # Lets at the def toplevel are just vars, at least in SpiderMonkey. if i == 0: build = builder.VAR__build addDecl = builder.VAR__addDecl finish = builder.VAR__finish s = compilerContext else: s = ss[i] else: s = letBlock node = build.call(builder, tokenizer) initializers = [] while True: tokenType = tokenizer.get() # FIXME Should have a special DECLARATION node instead of overloading # IDENTIFIER to mean both identifier declarations and destructured # declarations. childNode = builder.DECL__build(tokenizer) if tokenType == LEFT_BRACKET or tokenType == LEFT_CURLY: # Pass in s if we need to add each pattern matched into # its varDecls, else pass in compilerContext. data = null # Need to unget to parse the full destructured expression. tokenizer.unget() builder.DECL__setName(childNode, DestructuringExpression(tokenizer, compilerContext, True, s)) if compilerContext.inForLoopInit and tokenizer.peek() == IN: addDecl.call(builder, node, childNode, s) continue tokenizer.mustMatch(ASSIGN) if (tokenizer.token.assignOp) raise SyntaxError("Invalid variable initialization", tokenizer) # Parse the init as a normal assignment. n3 = builder.ASSIGN__build(tokenizer) builder.ASSIGN__addOperand(n3, childNode.name) builder.ASSIGN__addOperand(n3, AssignExpression(tokenizer, compilerContext)) builder.ASSIGN__finish(n3) # But only add the rhs as the initializer. builder.DECL__setInitializer(childNode, n3[1]) builder.DECL__finish(childNode) addDecl.call(builder, node, childNode, s) continue if tokenType != IDENTIFIER: raise SyntaxError("Missing variable name", tokenizer) builder.DECL__setName(childNode, tokenizer.token.value) builder.DECL__setReadOnly(childNode, node.type == CONST) addDecl.call(builder, node, childNode, s) if tokenizer.match(ASSIGN): if tokenizer.token.assignOp: raise SyntaxError("Invalid variable initialization", tokenizer) # Parse the init as a normal assignment. id = mkIdentifier(childNode.tokenizer, childNode.name, True) n3 = builder.ASSIGN__build(tokenizer) builder.ASSIGN__addOperand(n3, id) builder.ASSIGN__addOperand(n3, AssignExpression(tokenizer, compilerContext)) builder.ASSIGN__finish(n3) initializers.push(n3) # But only add the rhs as the initializer. builder.DECL__setInitializer(childNode, n3[1]) builder.DECL__finish(childNode) s.varDecls.push(childNode) if not tokenizer.match(COMMA): break finish.call(builder, node) return node | e84674e67dd665fd11d61644e7a7afffaad25771 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12949/e84674e67dd665fd11d61644e7a7afffaad25771/Parser.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
23536,
12,
2316,
1824,
16,
5274,
1042,
16,
2231,
1768,
4672,
3536,
6656,
279,
8716,
17,
24622,
666,
434,
569,
12312,
261,
464,
6944,
2172,
7089,
13,
12123,
225,
2089,
273,
5274,
1042,
18... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
23536,
12,
2316,
1824,
16,
5274,
1042,
16,
2231,
1768,
4672,
3536,
6656,
279,
8716,
17,
24622,
666,
434,
569,
12312,
261,
464,
6944,
2172,
7089,
13,
12123,
225,
2089,
273,
5274,
1042,
18... |
return swi.swi('OS_File', '5s;i', p)!=0 | try: return swi.swi('OS_File', '5s;i', p)!=0 except swi.error: return 0 | def exists(p): """ | 34a69ec4e94952eaef8ac996d16209e81924c72a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3187/34a69ec4e94952eaef8ac996d16209e81924c72a/riscospath.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1704,
12,
84,
4672,
3536,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1704,
12,
84,
4672,
3536,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-10... |
trapCall(self, self.callback, response) | trapCall(self, origCallback, response) | def finishRequest(self): # figure out what the response was before we do things like start a # pipelined response. if self.bodyDataCallback: body = None elif self.chunked: body = ''.join(self.chunks) else: body = self.body response = self.makeResponse(body) if self.stream.isOpen(): if self.willClose: self.closeConnection() self.changeState('closed') elif self.pipelinedRequest is not None: self.startNewRequest(*self.pipelinedRequest) self.pipelinedRequest = None else: self.changeState('ready') self.idleSince = clock() trapCall(self, self.callback, response) self.requestsFinished += 1 self.maybeSendReadyCallback() | a4d386f87dc8865ad1ba56fb64de6fff834097d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12354/a4d386f87dc8865ad1ba56fb64de6fff834097d7/httpclient.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
4076,
691,
12,
2890,
4672,
468,
7837,
596,
4121,
326,
766,
1703,
1865,
732,
741,
9198,
3007,
787,
279,
468,
8341,
292,
1920,
766,
18,
309,
365,
18,
3432,
751,
2428,
30,
1417,
273,
599,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
4076,
691,
12,
2890,
4672,
468,
7837,
596,
4121,
326,
766,
1703,
1865,
732,
741,
9198,
3007,
787,
279,
468,
8341,
292,
1920,
766,
18,
309,
365,
18,
3432,
751,
2428,
30,
1417,
273,
599,... |
def drawAO(): global OCCLUSSION, OCCBRIGHTR, OCCBRIGHTG, OCCBRIGHTB, OCCDARKR, OCCDARKG, OCCDARKB, OCCSAMPLES, OCCDIST col=10; line=200; BGL.glRasterPos2i(col, line); Draw.Text("Ambient Occlusion") col=10; line=175; OCCLUSSION=Draw.Toggle("Amb Occ", 2, col, line, 85, 18, OCCLUSSION.val) | def drawShad(): col=10; line=325; BGL.glRasterPos2i(col, line); Draw.Text("Specific instructions for exporting shaders:") col=10; line=300; BGL.glRasterPos2i(col, line); Draw.Text("Uber: shader name should start with 'sfube' - imports Blender's Col and Spe RGB values") col=10; line=285; BGL.glRasterPos2i(col, line); Draw.Text("\t\tIF Texture Slot 0: diffuse texture(Mapto Col value), else Col RGB values") col=10; line=270; BGL.glRasterPos2i(col, line); Draw.Text("\t\tIF Texture Slot 2: specular texture(Mapto Var value), else Spe RGB values") col=10; line=250; BGL.glRasterPos2i(col, line); Draw.Text("Diffuse: shader name should start with 'sfdif' - imports Blender's Col RGB values") col=10; line=225; BGL.glRasterPos2i(col, line); Draw.Text("Shiny: shader name sould start with 'sfshi' - imports Blender's Col RGB and RayMirr values") col=10; line=200; BGL.glRasterPos2i(col, line); Draw.Text("Ambient Occlusion: shader name sould start with 'sfamb' - imports Blender's Col RGB (Bright) and Spe RGB (Dark) values") col=10; line=175; BGL.glRasterPos2i(col, line); Draw.Text("Phong: shader name sould start with 'sfpho' - imports Blender's Col RGB and Spe RGB values") col=10; line=150; BGL.glRasterPos2i(col, line); Draw.Text("Ward: shader name sould start with 'sfwar' - imports Blender's Col RGB and Spe RGB values") col=10; line=125; BGL.glRasterPos2i(col, line); Draw.Text("Mirror: shader name sould start with 'sfmir' - imports Blender's Col RGB values, Ray Mir button must be on") col=10; line=100; BGL.glRasterPos2i(col, line); Draw.Text("Glass: shader name sould start with 'sfgla' - imports Blender's Col RGB and IOR values, Ray Transp button must be on") col=10; line=75; BGL.glRasterPos2i(col, line); Draw.Text("Constant: shader name should start with 'sfcon' - imports Blender's Col RGB values") drawButtons() def drawRender(): global EXPORT, RENDER, SMALLMESH, NOGI, NOCAUSTICS, QUICKUV, QUICKNORM, QUICKID, QUICKPRIMS, QUICKGRAY, QUICKWIRE, QUICKOCC, QOCCDIST, FILETYPE, DEPTH_DIFF, DEPTH_REFL, DEPTH_REFR, QUICKOPT, EXP_ANIM, IPR col=10; line=325; BGL.glRasterPos2i(col, line); Draw.Text("Rendering actions:") col=10; line=300; EXPORT=Draw.Button("Export .sc", EXP_EVT, col, line, 140, 18, "Export the scene to .sc file") col=160; RENDER=Draw.Button("Render exported", REND_EVT, col, line, 130, 18, "Render it (Export a .sc file first)") col=300; FILETYPE=Draw.Menu("%tFile type|png|tga|hdr|exr", FILE_TYPE, col, line, 85, 18, FILETYPE.val) col=10; line=275; BGL.glRasterPos2i(col, line); Draw.Text("Max raytrace depths:") col=10; line=250; DEPTH_DIFF=Draw.Number("Diffuse Depth", 2, col, line, 125, 18, DEPTH_DIFF.val, 1, 100) col=150; DEPTH_REFL=Draw.Number("Reflection Depth", 2, col, line, 125, 18, DEPTH_REFL.val, 1, 100) col=290; DEPTH_REFR=Draw.Number("Refraction Depth", 2, col, line, 125, 18, DEPTH_REFR.val, 1, 100) col=10; line=225; BGL.glRasterPos2i(col, line); Draw.Text("Rendering options:") col=10; line=200; SMALLMESH=Draw.Toggle("Small mesh", 2, col, line, 85, 18, SMALLMESH.val, "Load triangle meshes using triangles optimized for memory use") col=100; NOGI=Draw.Toggle("No GI", 2, col, line, 85, 18, NOGI.val, "Disable any global illumination engines in the scene") col=190; NOCAUSTICS=Draw.Toggle("No Caustics", 2, col, line, 85, 18, NOCAUSTICS.val, "Disable any caustic engine in the scene") col=280; NOGUI=Draw.Toggle("No GUI", 2, col, line, 85, 18, NOCAUSTICS.val, "Don't open the frame showing rendering progress") col=370; IPR=Draw.Toggle("IPR", 2, col, line, 85, 18, IPR.val, "Render using progressive algorithm") col=10; line=180; BGL.glRasterPos2i(col, line); Draw.Text("Quick override options:") col=10; line=150; QUICKOPT=Draw.Menu("%tQuick option|None|Quick UVs|Quick Normals|Quick ID|Quick Primitives|Quick Gray|Quick Wire", QUICK_OPT, col, line, 100, 18, QUICKOPT.val) col=10; line=125; QUICKOCC=Draw.Toggle("Quick Amb Occ", QUICK_OCC, col, line, 85, 18, QUICKOCC.val, "Applies ambient occlusion to the scene with specified maximum distance") col=100; QOCCDIST=Draw.Number("Distance", 2, col, line, 125, 18, QOCCDIST.val, 0.00, 1000.00) col=10; line=75; EXP_ANIM=Draw.Toggle("Export As Animation", 2, col, line, 140, 18, EXP_ANIM.val, "Export the scene as animation") drawButtons() def drawConfig(): global SET_PATH, THREADS, MEM, SET_JAVAPATH col=155; line = 230; BGL.glRasterPos2i(col, line); Draw.Text("(threads=0 means auto-detect)") col=10; line = 225; THREADS=Draw.Number("Threads", 2, col, line, 140, 18, THREADS.val, 0, 8) col=10; line = 200; MEM=Draw.Number("Memory (MB)", 2, col, line, 140, 18, MEM.val, 256, 2048) col= 10; line = 175; Draw.Button("Store SF Path & Settings", SET_PATH, col, line, 140,18) col= 10; line = 150; Draw.Button("Store Java Path", SET_JAVAPATH, col, line, 140,18) datadir=Blender.Get("datadir") trial=os.path.exists(datadir+'/path2sf.cfg') if trial == 1: f = open(datadir + '/path2sf.cfg', 'r+') sfdir = f.readline() memory = f.readline() threads = f.readline() javadir = f.readline() col=10; line = 130; BGL.glRasterPos2i(col, line); Draw.Text("Sunflow path: %s" % sfdir) col=10; line = 110; BGL.glRasterPos2i(col, line); Draw.Text("Memory: %s MB" % memory) col=10; line = 90; BGL.glRasterPos2i(col, line); Draw.Text("Threads: %s" % threads) col=10; line = 70; BGL.glRasterPos2i(col, line); Draw.Text("Java path: %s" % javadir) f.close() if trial == 0: col=10; line = 105; BGL.glRasterPos2i(col, line); Draw.Text("Sunflow is not configured yet - set Memory, Number of Threads and Path to sunflow.jar") drawButtons() def drawGI(): global CAUSTICS, PHOTONNUMBER, PHOTONMAP, PHOTONESTIMATE, PHOTONRADIUS global INSTANTGI, IGISAMPLES, IGISETS, IGIBIAS, IGIBIASSAMPLES global IRRCACHE, IRRSAMPLES, IRRTOLERANCE, IRRSPACEMIN, IRRSPACEMAX global gPHOTONNUMBER, gPHOTONESTIMATE, gPHOTONRADIUS, gPHOTONMAP, USEGLOBALS global PATHTRACE, PATHSAMPLES global VIEWCAUSTICS, VIEWGLOBALS, VIEWGI global OCCLUSION, OCCBRIGHTR, OCCBRIGHTG, OCCBRIGHTB, OCCDARKR, OCCDARKG, OCCDARKB, OCCSAMPLES, OCCDIST col=10; line=375; BGL.glRasterPos2i(col, line); Draw.Text("Caustics and Global Illumination") col=10; line=350; CAUSTICS=Draw.Toggle("Caustics", EVENT_CAUSTICS, col, line, 85, 18, CAUSTICS.val, "Turn on caustics in the scene") col=100; PHOTONNUMBER=Draw.Number("Photons", 2, col, line, 125, 18, PHOTONNUMBER.val, 0, 5000000) col=230; PHOTONMAP=Draw.Menu("%tCaustics Photon Map|kd", PHOTON_EVENT, col, line, 60, 18, PHOTONMAP.val) col=295; PHOTONESTIMATE=Draw.Number("Photon Estim.", 2, col, line, 125, 18, PHOTONESTIMATE.val, 0, 1000) col=425; PHOTONRADIUS=Draw.Number("Photon Radius", 2, col, line, 125, 18, PHOTONRADIUS.val, 0.00, 10.00) col=10; line=325; INSTANTGI=Draw.Toggle("Instant GI", FORCE_INSTANTGI, col, line, 85, 18, INSTANTGI.val, "Enable Instant GI for GI in the scene") col=100; IGISAMPLES=Draw.Number("Samples", 2, col, line, 125, 18, IGISAMPLES.val, 0, 1024) col=230; IGISETS=Draw.Number("Number of Sets", 2, col, line, 125, 18, IGISETS.val, 1.0, 100.0) col=100; line=300; IGIBIAS=Draw.Number("Bias", 2, col, line, 125, 18, IGIBIAS.val, 0.00000, 0.00009) col=230; IGIBIASSAMPLES=Draw.Number("Bias Samples", 2, col, line, 125, 18, IGIBIASSAMPLES.val, 0, 1) col=10; line=275; IRRCACHE=Draw.Toggle("Irr. Cache", FORCE_IRRCACHE, col, line, 85, 18, IRRCACHE.val, "Enable Irradiance Caching for GI in the scene") col=100; IRRSAMPLES=Draw.Number("Samples", 2, col, line, 125, 18, IRRSAMPLES.val, 0, 1024) col=230; IRRTOLERANCE=Draw.Number("Tolerance", 2, col, line, 125, 18, IRRTOLERANCE.val, 0.0, 0.10) col=100; line=250; IRRSPACEMIN=Draw.Number("Min. Space", 2, col, line, 125, 18, IRRSPACEMIN.val, 0.0, 10.0) col=230; IRRSPACEMAX=Draw.Number("Max. Space", 2, col, line, 125, 18, IRRSPACEMAX.val, 0.0, 10.0) col=10; line=225; USEGLOBALS=Draw.Toggle("Use Globals", FORCE_GLOBALS, col, line, 85, 18, USEGLOBALS.val, "Use global photons instead of path tracing for Irr. Cache secondary bounces") col=100; gPHOTONNUMBER=Draw.Number("Glob. Phot.", 2, col, line, 125, 18, gPHOTONNUMBER.val, 0, 5000000) col=230; gPHOTONMAP=Draw.Menu("%tGlobal Photon Map|kd|grid", gPHOTON_EVENT, col, line, 60, 18, gPHOTONMAP.val) col=295; gPHOTONESTIMATE=Draw.Number("Global Estim.", 2, col, line, 125, 18, gPHOTONESTIMATE.val, 0, 1000) col=425; gPHOTONRADIUS=Draw.Number("Global Radius", 2, col, line, 125, 18, gPHOTONRADIUS.val, 0.00, 10.00) col=10; line=200; PATHTRACE=Draw.Toggle("Path Tracing", FORCE_PATHTRACE, col, line, 85, 18, PATHTRACE.val, "Enable Path Tracing for GI in the scene") col=100; PATHSAMPLES=Draw.Number("Samples", 2, col, line, 125, 18, PATHSAMPLES.val, 0, 1024) col=100; line=175; VIEWCAUSTICS=Draw.Toggle("Just Caustics", OVERRIDE_CAUSTICS, col, line, 85, 18, VIEWCAUSTICS.val, "Render only the caustic photons in the scene (Caustics must be on)") col=190; VIEWGLOBALS=Draw.Toggle("Just Globals", OVERRIDE_GLOBALS, col, line, 85, 18, VIEWGLOBALS.val, "Render only the global photons in the scene (No Irr. Path must be on)") col=280; VIEWGI=Draw.Toggle("Just GI", OVERRIDE_GI, col, line, 85, 18, VIEWGI.val, "Render only the gi components in the scene (A GI engine must be selected)") col=10; line=150; BGL.glRasterPos2i(col, line); Draw.Text("Ambient Occlusion") col=10; line=125; OCCLUSION=Draw.Toggle("Amb Occ", 2, col, line, 85, 18, OCCLUSION.val, "Turn on ambient occlusion for the whole scene") | def drawLights(): global MESHLIGHTPOWER, DSAMPLES ## meshlight power slider col=10; line=200; BGL.glRasterPos2i(col, line); Draw.Text("Meshlight:") col=100; line=195; MESHLIGHTPOWER=Draw.Number("Power", 2, col, line, 120, 18, MESHLIGHTPOWER.val, 1, 15) ## lightserver settings col=10; line=150; BGL.glRasterPos2i(col, line); Draw.Text("Lightserver:") col=100; line=147; DSAMPLES=Draw.Number("Direct Samples ", 2, col, line, 250, 18, DSAMPLES.val, 0, 1024); drawButtons() | cbe7db97c14dab7ad62f558e33819d3bd283fe7b /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/12400/cbe7db97c14dab7ad62f558e33819d3bd283fe7b/sunflow_export.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3724,
48,
10730,
13332,
2552,
7733,
2664,
23516,
2419,
18839,
16,
8678,
8900,
11386,
7541,
6986,
5099,
7212,
18442,
645,
33,
2163,
31,
980,
33,
6976,
31,
605,
11261,
18,
7043,
18637,
1616,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3724,
48,
10730,
13332,
2552,
7733,
2664,
23516,
2419,
18839,
16,
8678,
8900,
11386,
7541,
6986,
5099,
7212,
18442,
645,
33,
2163,
31,
980,
33,
6976,
31,
605,
11261,
18,
7043,
18637,
1616,... |
item.findtext('description'), _wordpress_to_html(item.findtext(CONTENT.encoded)), | post_intro, post_body, | def get_author(name): if name: author = authors.get(name) if author is None: author = authors[name] = Author(name, None) return author | 435972875a2b87d7dcb676be1fd8e49b11e75eec /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/12815/435972875a2b87d7dcb676be1fd8e49b11e75eec/wordpress.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
336,
67,
4161,
12,
529,
4672,
309,
508,
30,
2869,
273,
14494,
18,
588,
12,
529,
13,
309,
2869,
353,
599,
30,
2869,
273,
14494,
63,
529,
65,
273,
6712,
12,
529,
16,
599,
13,
327,
28... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
336,
67,
4161,
12,
529,
4672,
309,
508,
30,
2869,
273,
14494,
18,
588,
12,
529,
13,
309,
2869,
353,
599,
30,
2869,
273,
14494,
63,
529,
65,
273,
6712,
12,
529,
16,
599,
13,
327,
28... |
task_set_option('file_path', os.path.abspath(args[0])) | fix_argv_paths([args[0]]) task_set_option('file_path', os.path.realpath(args[0])) | def task_submit_elaborate_specific_parameter(key, value, opts, args): """ Given the string key it checks it's meaning, eventually using the value. Usually it fills some key in the options dict. It must return True if it has elaborated the key, False, if it doesn't know that key. eg: if key in ['-n', '--number']: task_get_option(\1) = value return True return False """ # No time change option if key in ("-n", "--notimechange"): task_set_option('notimechange', 1) # Insert mode option elif key in ("-i", "--insert"): if task_get_option('mode') == 'replace': # if also replace found, then set to replace_or_insert task_set_option('mode', 'replace_or_insert') else: task_set_option('mode', 'insert') task_set_option('file_path', os.path.abspath(args[0])) # Replace mode option elif key in ("-r", "--replace"): if task_get_option('mode') == 'insert': # if also insert found, then set to replace_or_insert task_set_option('mode', 'replace_or_insert') else: task_set_option('mode', 'replace') task_set_option('file_path', os.path.abspath(args[0])) # Correct mode option elif key in ("-c", "--correct"): task_set_option('mode', 'correct') task_set_option('file_path', os.path.abspath(args[0])) # Append mode option elif key in ("-a", "--append"): task_set_option('mode', 'append') task_set_option('file_path', os.path.abspath(args[0])) # Reference mode option elif key in ("-z", "--reference"): task_set_option('mode', 'reference') task_set_option('file_path', os.path.abspath(args[0])) # Format mode option elif key in ("-f", "--format"): task_set_option('mode', 'format') task_set_option('file_path', os.path.abspath(args[0])) # Stage elif key in ("-S", "--stage"): try: value = int(value) except ValueError: print >> sys.stderr, """The value specified for --stage must be a valid integer, not %s""" % value return False if not (0 <= value <= 5): print >> sys.stderr, """The value specified for --stage must be comprised between 0 and 5""" return False task_set_option('stage_to_start_from', value) else: return False return True | 8cc3b43a838518a7aad1d89a4bb5eb83c4e6ee39 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/12027/8cc3b43a838518a7aad1d89a4bb5eb83c4e6ee39/bibupload.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1562,
67,
9297,
67,
28765,
280,
340,
67,
12524,
67,
6775,
12,
856,
16,
460,
16,
1500,
16,
833,
4672,
3536,
16803,
326,
533,
498,
518,
4271,
518,
1807,
12256,
16,
18011,
1450,
326,
460,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1562,
67,
9297,
67,
28765,
280,
340,
67,
12524,
67,
6775,
12,
856,
16,
460,
16,
1500,
16,
833,
4672,
3536,
16803,
326,
533,
498,
518,
4271,
518,
1807,
12256,
16,
18011,
1450,
326,
460,... |
The Desargues graph: :: | The Desargues graph:: | def GeneralizedPetersenGraph(self, n,k): r""" Returns a generalized Petersen graph with `2n` nodes. The variables `n`, `k` are integers such that `n>2` and `0<k\leq\lfloor(n-1)`/`2\rfloor` | a2ad0103402756f8db79454b2283ad1d542b2c37 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/9890/a2ad0103402756f8db79454b2283ad1d542b2c37/graph_generators.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
9544,
1235,
52,
1032,
275,
4137,
12,
2890,
16,
290,
16,
79,
4672,
436,
8395,
2860,
279,
7470,
1235,
453,
1032,
275,
2667,
598,
1375,
22,
82,
68,
2199,
18,
1021,
3152,
1375,
82,
9191,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
9544,
1235,
52,
1032,
275,
4137,
12,
2890,
16,
290,
16,
79,
4672,
436,
8395,
2860,
279,
7470,
1235,
453,
1032,
275,
2667,
598,
1375,
22,
82,
68,
2199,
18,
1021,
3152,
1375,
82,
9191,
... |
- tkz_style - a pre-defined ``tkz-graph`` style such as "Art" or "Normal" | - tkz_style - a pre-defined ``tkz-graph`` style such as "Art" or "Normal". Currently, the recognized styles are "Shade", "Art", "Normal", "Dijkstra", "Welsh", "Classic", and "Simple". Any other value will not give an error, but if you run ``latex`` on the graph, then an unrecognized style will be treated as "Normal". | def set_option(self, option_name, option_value = None): r""" Sets, modifies, clears a legitimate `\mbox{\rm\LaTeX}` option for rendering a graph. | 99481238fceb0d8b68ce60dc6afa0cf50557a9c1 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/9890/99481238fceb0d8b68ce60dc6afa0cf50557a9c1/graph_latex.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
444,
67,
3482,
12,
2890,
16,
1456,
67,
529,
16,
1456,
67,
1132,
273,
599,
4672,
436,
8395,
11511,
16,
23934,
16,
22655,
279,
4553,
305,
4988,
1375,
64,
81,
2147,
23241,
8864,
64,
30745... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
444,
67,
3482,
12,
2890,
16,
1456,
67,
529,
16,
1456,
67,
1132,
273,
599,
4672,
436,
8395,
11511,
16,
23934,
16,
22655,
279,
4553,
305,
4988,
1375,
64,
81,
2147,
23241,
8864,
64,
30745... |
self._row=line=self._Record(self.parse(line), self._schema, self._names) | self._row=line=self._Record( self.parse(line,_index), self._schema, self._names) | def __getitem__(self,input_index): | 0c3148b932564478c74f0e11774fea8ace578414 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/0c3148b932564478c74f0e11774fea8ace578414/RDB.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
31571,
972,
12,
2890,
16,
2630,
67,
1615,
4672,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
31571,
972,
12,
2890,
16,
2630,
67,
1615,
4672,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,... |
if self.indiType == 5: | if self.indiType == 6: | def indiMethodChanged(self): if self.data: attr = self.data.domain[self.selectedAttr] attrName = attr.name if self.indiType: if self.indiType == 5: if attr.varType == orange.VarTypes.Discrete: self.methods[attrName] = 5, self.indiValCom else: self.methods[attrName] = 5, str(self.indiValue) else: self.methods[attrName] = self.indiType, None else: if self.methods.has_key(attrName): del self.methods[attrName] self.attrList.triggerUpdate(True) self.setBtAllToDefault() self.sendIf() | 6dd39f8a0aebe0212befa1fe1b06512e950b5b47 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/6366/6dd39f8a0aebe0212befa1fe1b06512e950b5b47/OWImpute.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1547,
77,
1305,
5033,
12,
2890,
4672,
309,
365,
18,
892,
30,
1604,
273,
365,
18,
892,
18,
4308,
63,
2890,
18,
8109,
3843,
65,
11583,
273,
1604,
18,
529,
309,
365,
18,
728,
77,
559,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1547,
77,
1305,
5033,
12,
2890,
4672,
309,
365,
18,
892,
30,
1604,
273,
365,
18,
892,
18,
4308,
63,
2890,
18,
8109,
3843,
65,
11583,
273,
1604,
18,
529,
309,
365,
18,
728,
77,
559,
... |
self.assertEqual(pop.subPopName([1, 0]), 'MALE') self.assertEqual(pop.subPopName([1, 1]), 'FEMALE') | self.assertEqual(pop.subPopName([1, 0]), 'Male') self.assertEqual(pop.subPopName([1, 1]), 'Female') | def testSexSplitter(self): 'Testing sexSplitter::sexSplitter()' pop = population(size=[20, 80]) InitSex(pop) InitByFreq(pop, [0.4, 0.6]) Stat(pop, numOfMales=True, vars=['numOfMales_sp', 'numOfFemales_sp']) pop.setVirtualSplitter(sexSplitter()) self.assertEqual(pop.subPopSize([1, 0]), pop.dvars(1).numOfMales) self.assertEqual(pop.subPopSize([1, 1]), pop.dvars(1).numOfFemales) self.assertEqual(pop.subPopName([1, 0]), 'MALE') self.assertEqual(pop.subPopName([1, 1]), 'FEMALE') for ind in pop.individuals([0, 0]): self.assertEqual(ind.sex(), MALE) for ind in pop.individuals([0, 1]): self.assertEqual(ind.sex(), FEMALE) # test nested virtual subpopulation for ind in pop.individuals([0, 0]): self.assertEqual(ind.sex(), MALE) for ind1 in pop.individuals([0, 1]): self.assertEqual(ind1.sex(), FEMALE) numMale = 0 numFemale = 0 for ind in pop.individuals(1): if ind.sex() == MALE: numMale += 1 else: numFemale += 1 #print numMale, numFemale self.assertEqual(numMale == 0, False) self.assertEqual(numFemale == 0, False) | 322e93e52614eec4168315329001ebd76b1bf7fe /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/401/322e93e52614eec4168315329001ebd76b1bf7fe/test_02_population.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
55,
338,
26738,
12,
2890,
4672,
296,
22218,
19631,
26738,
2866,
20909,
26738,
11866,
1843,
273,
11209,
12,
1467,
22850,
3462,
16,
8958,
5717,
4378,
55,
338,
12,
5120,
13,
4378,
858,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
55,
338,
26738,
12,
2890,
4672,
296,
22218,
19631,
26738,
2866,
20909,
26738,
11866,
1843,
273,
11209,
12,
1467,
22850,
3462,
16,
8958,
5717,
4378,
55,
338,
12,
5120,
13,
4378,
858,
... |
dcg.grabDtellaTopic() | dch.grabDtellaTopic() | def syncComplete(self): | 5b8d99776f24725999755a13b266ffb99c33d6d7 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/4752/5b8d99776f24725999755a13b266ffb99c33d6d7/dtella.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3792,
6322,
12,
2890,
4672,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3792,
6322,
12,
2890,
4672,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-... |
tests.sort(key=lambda x: x[0]) | tests.sort(lambda x, y: cmp(x[0], y[0])) | def run_tests(): # needed to avoid confusion involving atexit handlers import logging orig_modules = sys.modules.keys() if sys.argv[1:]: # test only files given on cmdline files = [entry + '.py' for entry in sys.argv[1:] if entry.startswith('test_')] else: files = [entry for entry in os.listdir(testdir) if (entry.startswith('test_') and entry.endswith('.py'))] files.sort() print >>sys.stderr, ' Pygments Test Suite running, stand by... ' print >>sys.stderr, '===============================================' for testfile in files: globs = {} try: execfile(join(testdir, testfile), globs) except Exception, exc: raise err(testfile, 'execfile', exc) continue sys.stderr.write(testfile[:-3] + ': ') try: runner = QuietTestRunner(testfile[:-3]) # make a test suite of all TestCases in the file tests = [] for name, thing in globs.iteritems(): if name.endswith('Test'): tests.append((name, unittest.makeSuite(thing))) tests.sort(key=lambda x: x[0]) suite = unittest.TestSuite() suite.addTests(x[1] for x in tests) runner.run(suite) except Exception, exc: err(testfile, 'running test', exc) print >>sys.stderr, '===============================================' if failed: print >>sys.stderr, '%d of %d tests failed.' % \ (error_test_count, total_test_count) print >>sys.stderr, 'Tests failed in:', ', '.join(failed) return 1 else: if total_test_count == 1: print >>sys.stderr, '1 test happy.' else: print >>sys.stderr, 'All %d tests happy.' % total_test_count return 0 | 3f3e683ac2d6413653b349d8dc704b3feb3929bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2885/3f3e683ac2d6413653b349d8dc704b3feb3929bb/run.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1086,
67,
16341,
13332,
468,
3577,
358,
4543,
31067,
29876,
6282,
622,
8593,
4919,
1930,
2907,
225,
1647,
67,
6400,
273,
2589,
18,
6400,
18,
2452,
1435,
225,
309,
2589,
18,
19485,
63,
21... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1086,
67,
16341,
13332,
468,
3577,
358,
4543,
31067,
29876,
6282,
622,
8593,
4919,
1930,
2907,
225,
1647,
67,
6400,
273,
2589,
18,
6400,
18,
2452,
1435,
225,
309,
2589,
18,
19485,
63,
21... |
def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, on_error=False, reply_to=False, tinycrm=False, ssl=False, debug=False,subtype='plain'): | def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, reply_to=False, attach=None, tinycrm=False, ssl=False, debug=False,subtype='plain'): | def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, on_error=False, reply_to=False, tinycrm=False, ssl=False, debug=False,subtype='plain'): """Send an email.""" if not email_cc: email_cc=[] if not email_bcc: email_bcc=[] import smtplib from email.MIMEText import MIMEText from email.MIMEMultipart import MIMEMultipart from email.Header import Header from email.Utils import formatdate, COMMASPACE msg = MIMEText(body or '',_subtype=subtype,_charset='utf-8') msg['Subject'] = Header(subject.decode('utf8'), 'utf-8') msg['From'] = email_from del msg['Reply-To'] if reply_to: msg['Reply-To'] = msg['From']+', '+reply_to msg['To'] = COMMASPACE.join(email_to) if email_cc: msg['Cc'] = COMMASPACE.join(email_cc) if email_bcc: msg['Bcc'] = COMMASPACE.join(email_bcc) msg['Date'] = formatdate(localtime=True) if tinycrm: msg['Message-Id'] = '<'+str(time.time())+'-tinycrm-'+str(tinycrm)+'@'+socket.gethostname()+'>' try: s = smtplib.SMTP() if debug: s.debuglevel = 5 s.connect(config['smtp_server'], config['smtp_port']) if ssl: s.ehlo() s.starttls() s.ehlo() if config['smtp_user'] or config['smtp_password']: s.login(config['smtp_user'], config['smtp_password']) s.sendmail(email_from, flatten([email_to, email_cc, email_bcc]), msg.as_string()) s.quit() except Exception, e: import logging logging.getLogger().error(str(e)) return True | 84928ad0c1ac14a64e3e1717c1c576ce525b6c49 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/7397/84928ad0c1ac14a64e3e1717c1c576ce525b6c49/misc.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2699,
67,
4661,
12,
3652,
67,
2080,
16,
2699,
67,
869,
16,
3221,
16,
1417,
16,
2699,
67,
952,
33,
7036,
16,
2699,
67,
31345,
33,
7036,
16,
4332,
67,
869,
33,
8381,
16,
3306,
33,
70... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2699,
67,
4661,
12,
3652,
67,
2080,
16,
2699,
67,
869,
16,
3221,
16,
1417,
16,
2699,
67,
952,
33,
7036,
16,
2699,
67,
31345,
33,
7036,
16,
4332,
67,
869,
33,
8381,
16,
3306,
33,
70... |
subtext += "DefaultValue=%s\n"%value | if subentry_infos["type"] == 1: subtext += "DefaultValue=%s\n"%BOOL_TRANSLATE[value] else: subtext += "DefaultValue=%s\n"%value | def GenerateFileContent(filepath): # Dictionary of each index contents indexContents = {} # Extract local time current_time = localtime() # Extract node informations nodename, nodeid, nodetype, description = Manager.GetCurrentNodeInfos() # Compiling lists of indexes defined entries = [idx for name, idx in Manager.GetCurrentValidIndexes(0, 0xFFFF)] # Generate FileInfo section fileContent = "[FileInfo]\n" fileContent += "FileName=%s\n"%os.path.split(filepath)[-1] fileContent += "FileVersion=1\n" fileContent += "FileRevision=1\n" fileContent += "EDSVersion=4.0\n" fileContent += "Description=%s\n"%description fileContent += "CreationTime=%s"%strftime("%I:%M", current_time) # %p option of strftime seems not working, then generate AM/PM by hands if strftime("%I", current_time) == strftime("%H", current_time): fileContent += "AM\n" else: fileContent += "PM\n" fileContent += "CreationDate=%s\n"%strftime("%m-%d-%Y", current_time) fileContent += "CreatedBy=CANFestival\n" fileContent += "ModificationTime=%s"%strftime("%I:%M", current_time) # %p option of strftime seems not working, then generate AM/PM by hands if strftime("%I", current_time) == strftime("%H", current_time): fileContent += "AM\n" else: fileContent += "PM\n" fileContent += "ModificationDate=%s\n"%strftime("%m-%d-%Y", current_time) fileContent += "ModifiedBy=CANFestival\n" # Generate DeviceInfo section fileContent += "\n[DeviceInfo]\n" fileContent += "VendorName=CANFestival\n" # Use information typed by user in Identity entry fileContent += "VendorNumber=0x%8.8X\n"%Manager.GetCurrentEntry(0x1018, 1) fileContent += "ProductName=%s\n"%nodename fileContent += "ProductNumber=0x%8.8X\n"%Manager.GetCurrentEntry(0x1018, 2) fileContent += "RevisionNumber=0x%8.8X\n"%Manager.GetCurrentEntry(0x1018, 3) # CANFestival support all baudrates as soon as driver choosen support them fileContent += "BaudRate_10=1\n" fileContent += "BaudRate_20=1\n" fileContent += "BaudRate_50=1\n" fileContent += "BaudRate_125=1\n" fileContent += "BaudRate_250=1\n" fileContent += "BaudRate_500=1\n" fileContent += "BaudRate_800=1\n" fileContent += "BaudRate_1000=1\n" # Select BootUp type from the informations given by user fileContent += "SimpleBootUpMaster=%s\n"%BOOL_TRANSLATE[nodetype == "master"] fileContent += "SimpleBootUpSlave=%s\n"%BOOL_TRANSLATE[nodetype == "slave"] # CANFestival characteristics fileContent += "Granularity=8\n" fileContent += "DynamicChannelsSupported=0\n" fileContent += "CompactPDO=0\n" fileContent += "GroupMessaging=0\n" # Calculate receive and tranmit PDO numbers with the entry available fileContent += "NrOfRXPDO=%d\n"%len([idx for idx in entries if 0x1400 <= idx <= 0x15FF]) fileContent += "NrOfTXPDO=%d\n"%len([idx for idx in entries if 0x1800 <= idx <= 0x19FF]) # LSS not supported as soon as DS-302 was not fully implemented fileContent += "LSS_Supported=0\n" # Generate Dummy Usage section fileContent += "\n[DummyUsage]\n" fileContent += "Dummy0001=0\n" fileContent += "Dummy0002=1\n" fileContent += "Dummy0003=1\n" fileContent += "Dummy0004=1\n" fileContent += "Dummy0005=1\n" fileContent += "Dummy0006=1\n" fileContent += "Dummy0007=1\n" # Generate Comments section fileContent += "\n[Comments]\n" fileContent += "Lines=0\n" # List of entry by type (Mandatory, Optional or Manufacturer mandatories = [] optionals = [] manufacturers = [] # For each entry, we generate the entry section or sections if there is subindexes for entry in entries: # Extract infos and values for the entry entry_infos = Manager.GetEntryInfos(entry) values = Manager.GetCurrentEntry(entry, compute = False) # Define section name text = "\n[%X]\n"%entry # If there is only one value, it's a VAR entry if type(values) != ListType: # Extract the informations of the first subindex subentry_infos = Manager.GetSubentryInfos(entry, 0) # Generate EDS informations for the entry text += "ParameterName=%s\n"%subentry_infos["name"] text += "ObjectType=0x7\n" text += "DataType=0x%4.4X\n"%subentry_infos["type"] text += "AccessType=%s\n"%subentry_infos["access"] text += "DefaultValue=%s\n"%values text += "PDOMapping=%s\n"%BOOL_TRANSLATE[subentry_infos["pdo"]] else: # Generate EDS informations for the entry text += "ParameterName=%s\n"%entry_infos["name"] if entry_infos["struct"] & node.OD_IdenticalSubindexes: text += "ObjectType=0x9\n" else: text += "ObjectType=0x8\n" # Generate EDS informations for subindexes of the entry in a separate text subtext = "" # Reset number of subindex defined nb_subentry = 0 for subentry, value in enumerate(values): # Extract the informations of each subindex subentry_infos = Manager.GetSubentryInfos(entry, subentry) # If entry is not for the compatibility, generate informations for subindex if subentry_infos["name"] != "Compatibility Entry": subtext += "\n[%Xsub%X]\n"%(entry, subentry) subtext += "ParameterName=%s\n"%subentry_infos["name"] subtext += "ObjectType=0x7\n" subtext += "DataType=0x%4.4X\n"%subentry_infos["type"] subtext += "AccessType=%s\n"%subentry_infos["access"] subtext += "DefaultValue=%s\n"%value subtext += "PDOMapping=%s\n"%BOOL_TRANSLATE[subentry_infos["pdo"]] # Increment number of subindex defined nb_subentry += 1 # Write number of subindex defined for the entry text += "SubNumber=%d\n"%nb_subentry # Write subindex definitions text += subtext # Then we add the entry in the right list # First case, entry is between 0x2000 and 0x5FFF, then it's a manufacturer entry if 0x2000 <= entry <= 0x5FFF: manufacturers.append(entry) # Second case, entry is required, then it's a mandatory entry elif entry_infos["need"]: mandatories.append(entry) # In any other case, it's an optional entry else: optionals.append(entry) # Save text of the entry in the dictiionary of contents indexContents[entry] = text # Before generate File Content we sort the entry list manufacturers.sort() mandatories.sort() optionals.sort() # Generate Definition of mandatory objects fileContent += "\n[MandatoryObjects]\n" fileContent += "SupportedObjects=%d\n"%len(mandatories) for idx, entry in enumerate(mandatories): fileContent += "%d=0x%4.4X\n"%(idx + 1, entry) # Write mandatory entries for entry in mandatories: fileContent += indexContents[entry] # Generate Definition of optional objects fileContent += "\n[OptionalObjects]\n" fileContent += "SupportedObjects=%d\n"%len(optionals) for idx, entry in enumerate(optionals): fileContent += "%d=0x%4.4X\n"%(idx + 1, entry) # Write optional entries for entry in optionals: fileContent += indexContents[entry] # Generate Definition of manufacturer objects fileContent += "\n[ManufacturerObjects]\n" fileContent += "SupportedObjects=%d\n"%len(manufacturers) for idx, entry in enumerate(manufacturers): fileContent += "%d=0x%4.4X\n"%(idx + 1, entry) # Write manufacturer entries for entry in manufacturers: fileContent += indexContents[entry] # Return File Content return fileContent | af80372170642f6770e2a36d938d9e8859dd4b9f /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/11017/af80372170642f6770e2a36d938d9e8859dd4b9f/eds_utils.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
6654,
25391,
12,
10561,
4672,
468,
16447,
434,
1517,
770,
2939,
770,
6323,
273,
2618,
225,
468,
8152,
1191,
813,
783,
67,
957,
273,
1191,
957,
1435,
468,
8152,
756,
26978,
14003,
1069,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
6654,
25391,
12,
10561,
4672,
468,
16447,
434,
1517,
770,
2939,
770,
6323,
273,
2618,
225,
468,
8152,
1191,
813,
783,
67,
957,
273,
1191,
957,
1435,
468,
8152,
756,
26978,
14003,
1069,
1... |
if self.commentcntl.Accepted: | if self.commentcntl.result() == QDialog.Accepted: | def insertComment(self): '''Insert a new comment into the model tree. ''' from Utility import Comment comment = Comment(self.assy, None, text='') self.commentcntl.setup(comment) if self.commentcntl.Accepted: part = self.assy.part part.ensure_toplevel_group() part.topnode.addchild(comment) self.mt.mt_update() | 3e641996106bfbfca0556099af1474c9ea4c6465 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11221/3e641996106bfbfca0556099af1474c9ea4c6465/MWsemantics.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2243,
4469,
12,
2890,
4672,
9163,
4600,
279,
394,
2879,
1368,
326,
938,
2151,
18,
9163,
628,
13134,
1930,
9821,
2879,
273,
9821,
12,
2890,
18,
428,
93,
16,
599,
16,
977,
2218,
6134,
36... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2243,
4469,
12,
2890,
4672,
9163,
4600,
279,
394,
2879,
1368,
326,
938,
2151,
18,
9163,
628,
13134,
1930,
9821,
2879,
273,
9821,
12,
2890,
18,
428,
93,
16,
599,
16,
977,
2218,
6134,
36... |
data_matrix[accession_id2row_index[accession_id], SNP_index] = nt2number[bases[i-start_pos]] | data_matrix[accession_id2row_index[accession_id], SNP_index] = nt2number[bases[inflated_index]] | def get_accession_X_snp_matrix(self, curs, accession_id2row_index, SNPpos2col_index, sequence_table, alignment_table): sys.stderr.write("Getting accession_X_snp_matrix ...\n") data_matrix = numpy.zeros([len(accession_id2row_index), len(SNPpos2col_index)], numpy.integer) curs.execute("select s.accession, s.alignment, s.bases, a.chromosome, a.start from %s s, %s a where s.alignment=a.id"%(sequence_table, alignment_table)) rows = curs.fetchmany(5000) counter = 0 while rows: for row in rows: accession_id, alignment_id, bases, chromosome, start_pos = row if accession_id in accession_id2row_index: for i in range(start_pos, start_pos+len(bases)): SNP_pos_key = (chromosome, i) if SNP_pos_key in SNPpos2col_index: if self.debug: import pdb pdb.set_trace() SNP_index = SNPpos2col_index[SNP_pos_key] data_matrix[accession_id2row_index[accession_id], SNP_index] = nt2number[bases[i-start_pos]] counter += 1 rows = curs.fetchmany(5000) if self.report: sys.stderr.write('%s%s'%('\x08'*20, counter)) sys.stderr.write("Done.\n") return data_matrix | fa5623119a62d7df76b8e84a1d3811aa80b925fb /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/9645/fa5623119a62d7df76b8e84a1d3811aa80b925fb/CmpAccession2Ecotype.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
336,
67,
3860,
285,
67,
60,
67,
87,
6782,
67,
5667,
12,
2890,
16,
25326,
16,
2006,
285,
67,
350,
22,
492,
67,
1615,
16,
14204,
52,
917,
22,
1293,
67,
1615,
16,
3102,
67,
2121,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
336,
67,
3860,
285,
67,
60,
67,
87,
6782,
67,
5667,
12,
2890,
16,
25326,
16,
2006,
285,
67,
350,
22,
492,
67,
1615,
16,
14204,
52,
917,
22,
1293,
67,
1615,
16,
3102,
67,
2121,
16,
... |
class MockIo: def __init__(self, mock_file): self.mock_file = mock_file def open(self, unused_filename, unused_mode, unused_encoding, _): return self.mock_file class CpplintTestBase(unittest.TestCase): """Provides some useful helper functions for cpplint tests.""" def perform_single_line_lint(self, code): error_collector = ErrorCollector(self.assert_) lines = code.split('\n') cpplint.remove_multi_line_comments('foo.h', lines, error_collector) clean_lines = cpplint.CleansedLines(lines) include_state = cpplint._IncludeState() function_state = cpplint._FunctionState() class_state = cpplint._ClassState() cpplint.process_line('foo.cc', 'cc', clean_lines, 0, include_state, function_state, class_state, error_collector) error_collector.remove_if_present( 'Lint failed to find start of function body.') return error_collector.results() def perform_multi_line_lint(self, code): error_collector = ErrorCollector(self.assert_) lines = code.split('\n') cpplint.remove_multi_line_comments('foo.h', lines, error_collector) lines = cpplint.CleansedLines(lines) class_state = cpplint._ClassState() for i in xrange(lines.num_lines()): cpplint.check_style('foo.h', lines, i, 'h', error_collector) cpplint.check_for_non_standard_constructs('foo.h', lines, i, class_state, error_collector) class_state.check_finished('foo.h', error_collector) return error_collector.results() def perform_language_rules_check(self, file_name, code): error_collector = ErrorCollector(self.assert_) include_state = cpplint._IncludeState() lines = code.split('\n') cpplint.remove_multi_line_comments(file_name, lines, error_collector) lines = cpplint.CleansedLines(lines) ext = file_name[file_name.rfind('.') + 1:] for i in xrange(lines.num_lines()): cpplint.check_language(file_name, lines, i, ext, include_state, error_collector) return error_collector.results() def perform_function_lengths_check(self, code): """Perform Lint function length check on block of code and return warnings. Builds up an array of lines corresponding to the code and strips comments using cpplint functions. Establishes an error collector and invokes the function length checking function following cpplint's pattern. Args: code: C++ source code expected to generate a warning message. Returns: The accumulated errors. """ file_name = 'foo.cc' error_collector = ErrorCollector(self.assert_) function_state = cpplint._FunctionState() lines = code.split('\n') cpplint.remove_multi_line_comments(file_name, lines, error_collector) lines = cpplint.CleansedLines(lines) for i in xrange(lines.num_lines()): cpplint.check_for_function_lengths(file_name, lines, i, function_state, error_collector) return error_collector.results() def perform_include_what_you_use(self, code, filename='foo.h', io=codecs): error_collector = ErrorCollector(self.assert_) include_state = cpplint._IncludeState() lines = code.split('\n') cpplint.remove_multi_line_comments(filename, lines, error_collector) lines = cpplint.CleansedLines(lines) for i in xrange(lines.num_lines()): cpplint.check_language(filename, lines, i, '.h', include_state, error_collector) cpplint.check_for_include_what_you_use(filename, lines, include_state, error_collector, io) return error_collector.results() def assert_lint(self, code, expected_message): self.assertEquals(expected_message, self.perform_single_line_lint(code)) def assert_multi_line_lint(self, code, expected_message): self.assertEquals(expected_message, self.perform_multi_line_lint(code)) def assert_multi_line_lint_re(self, code, expected_message_re): message = self.perform_multi_line_lint(code) if not re.search(expected_message_re, message): self.fail('Message was:\n' + message + 'Expected match to "' + expected_message_re + '"') def assert_language_rules_check(self, file_name, code, expected_message): self.assertEquals(expected_message, self.perform_language_rules_check(file_name, code)) def assert_include_what_you_use(self, code, expected_message): self.assertEquals(expected_message, self.perform_include_what_you_use(code)) def assert_blank_lines_check(self, lines, start_errors, end_errors): error_collector = ErrorCollector(self.assert_) cpplint.process_file_data('foo.cc', 'cc', lines, error_collector) self.assertEquals( start_errors, error_collector.results().count( 'Blank line at the start of a code block. Is this needed?' ' [whitespace/blank_line] [2]')) self.assertEquals( end_errors, error_collector.results().count( 'Blank line at the end of a code block. Is this needed?' ' [whitespace/blank_line] [3]')) class CpplintTest(CpplintTestBase): def test_get_line_width(self): self.assertEquals(0, cpplint.get_line_width('')) self.assertEquals(10, cpplint.get_line_width(u'x' * 10)) self.assertEquals(16, cpplint.get_line_width(u'都|道|府|県|支庁')) def test_find_next_multi_line_comment_start(self): self.assertEquals(1, cpplint.find_next_multi_line_comment_start([''], 0)) lines = ['a', 'b', '/* c'] self.assertEquals(2, cpplint.find_next_multi_line_comment_start(lines, 0)) lines = ['char a[] = "/*";'] self.assertEquals(1, cpplint.find_next_multi_line_comment_start(lines, 0)) def test_find_next_multi_line_comment_end(self): self.assertEquals(1, cpplint.find_next_multi_line_comment_end([''], 0)) lines = ['a', 'b', ' c */'] self.assertEquals(2, cpplint.find_next_multi_line_comment_end(lines, 0)) def test_remove_multi_line_comments_from_range(self): lines = ['a', ' /* comment ', ' * still comment', ' comment */ ', 'b'] cpplint.remove_multi_line_comments_from_range(lines, 1, 4) self.assertEquals(['a', '// dummy', '// dummy', '// dummy', 'b'], lines) def test_spaces_at_end_of_line(self): self.assert_lint( '// Hello there ', 'Line ends in whitespace. Consider deleting these extra spaces.' ' [whitespace/end_of_line] [4]') def test_cstyle_cast(self): self.assert_lint( 'int a = (int)1.0;', 'Using C-style cast. Use static_cast<int>(...) instead' ' [readability/casting] [4]') self.assert_lint( 'int *a = (int *)NULL;', 'Using C-style cast. Use reinterpret_cast<int *>(...) instead' ' [readability/casting] [4]') self.assert_lint( 'uint16 a = (uint16)1.0;', 'Using C-style cast. Use static_cast<uint16>(...) instead' ' [readability/casting] [4]') self.assert_lint( 'int32 a = (int32)1.0;', 'Using C-style cast. Use static_cast<int32>(...) instead' ' [readability/casting] [4]') self.assert_lint( 'uint64 a = (uint64)1.0;', 'Using C-style cast. Use static_cast<uint64>(...) instead' ' [readability/casting] [4]') self.assert_lint('u a = (u)NULL;', '') self.assert_lint('uint a = (uint)NULL;', '') def test_runtime_casting(self): self.assert_lint( 'int* x = &static_cast<int*>(foo);', 'Are you taking an address of a cast? ' 'This is dangerous: could be a temp var. ' 'Take the address before doing the cast, rather than after' ' [runtime/casting] [4]') self.assert_lint( 'int* x = &dynamic_cast<int *>(foo);', ['Are you taking an address of a cast? ' 'This is dangerous: could be a temp var. ' 'Take the address before doing the cast, rather than after' ' [runtime/casting] [4]', 'Do not use dynamic_cast<>. If you need to cast within a class ' 'hierarchy, use static_cast<> to upcast. Google doesn\'t support ' 'RTTI. [runtime/rtti] [5]']) self.assert_lint( 'int* x = &reinterpret_cast<int *>(foo);', 'Are you taking an address of a cast? ' 'This is dangerous: could be a temp var. ' 'Take the address before doing the cast, rather than after' ' [runtime/casting] [4]') self.assert_lint( 'int* x = reinterpret_cast<int *>(&foo);', '') def test_runtime_selfinit(self): self.assert_lint( 'Foo::Foo(Bar r, Bel l) : r_(r_), l_(l_) { }', 'You seem to be initializing a member variable with itself.' ' [runtime/init] [4]') self.assert_lint( 'Foo::Foo(Bar r, Bel l) : r_(r), l_(l) { }', '') self.assert_lint( 'Foo::Foo(Bar r) : r_(r), l_(r_), ll_(l_) { }', '') def test_runtime_rtti(self): statement = 'int* x = dynamic_cast<int*>(&foo);' error_message = ( 'Do not use dynamic_cast<>. If you need to cast within a class ' 'hierarchy, use static_cast<> to upcast. Google doesn\'t support ' 'RTTI. [runtime/rtti] [5]') self.assert_language_rules_check('foo.cc', statement, error_message) self.assert_language_rules_check('foo.h', statement, error_message) self.assert_language_rules_check('foo_test.cc', statement, '') self.assert_language_rules_check('foo_unittest.cc', statement, '') self.assert_language_rules_check('foo_regtest.cc', statement, '') | if not body_found: error(filename, line_number, 'readability/fn_size', 5, 'Lint failed to find start of function body.') elif match(r'^\}\s*$', line): if not search(r'\bNOLINT\b', raw_line): function_state.check(error, filename, line_number) function_state.end() elif not match(r'^\s*$', line): function_state.count() def check_spacing(filename, clean_lines, line_number, error): """Checks for the correctness of various spacing issues in the code. Things we check for: spaces around operators, spaces after if/for/while/switch, no spaces around parens in function calls, two spaces between code and comment, don't start a block with a blank line, don't end a function with a blank line, don't have too many blank lines in a row. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. line_number: The number of the line to check. error: The function to call with any errors found. """ raw = clean_lines.raw_lines line = raw[line_number] if is_blank_line(line): elided = clean_lines.elided previous_line = elided[line_number - 1] previous_brace = previous_line.rfind('{') if (previous_brace != -1 and previous_line[previous_brace:].find('}') == -1 and previous_line[:previous_brace].find('namespace') == -1): exception = False if match(r' {6}\w', previous_line): search_position = line_number - 2 while (search_position >= 0 and match(r' {6}\w', elided[search_position])): search_position -= 1 exception = (search_position >= 0 and elided[search_position][:5] == ' :') else: exception = (match(r' {4}\w[^\(]*\)\s*(const\s*)?(\{\s*$|:)', previous_line) or match(r' {4}:', previous_line)) if not exception: error(filename, line_number, 'whitespace/blank_line', 2, 'Blank line at the start of a code block. Is this needed?') if line_number + 1 < clean_lines.num_lines(): next_line = raw[line_number + 1] if (next_line and match(r'\s*}', next_line) and next_line.find('namespace') == -1 and next_line.find('} else ') == -1): error(filename, line_number, 'whitespace/blank_line', 3, 'Blank line at the end of a code block. Is this needed?') comment_position = line.find('//') if comment_position != -1: if (line.count('"', 0, comment_position) - line.count('\\"', 0, comment_position)) % 2 == 0: if (not match(r'^\s*{ //', line) and ((comment_position >= 1 and line[comment_position-1] not in string.whitespace) or (comment_position >= 2 and line[comment_position-2] not in string.whitespace))): error(filename, line_number, 'whitespace/comments', 2, 'At least two spaces is best between code and comments') commentend = comment_position + 2 if commentend < len(line) and not line[commentend] == ' ': matched = (search(r'[=/-]{4,}\s*$', line[commentend:]) or search(r'^/+ ', line[commentend:])) if not matched: error(filename, line_number, 'whitespace/comments', 4, 'Should have a space between // and comment') line = clean_lines.elided[line_number] line = re.sub(r'operator(==|!=|<|<<|<=|>=|>>|>)\(', 'operator\(', line) if search(r'[\w.]=[\w.]', line) and not search(r'\b(if|while) ', line): error(filename, line_number, 'whitespace/operators', 4, 'Missing spaces around =') matched = search(r'[^<>=!\s](==|!=|<=|>=)[^<>=!\s]', line) if not matched: if not search(r'<[^<]*,\s*$', line): matched = search(r'[^<>=!\s](<)[^<>=!\s]([^>]|->)*$', line) if matched: error(filename, line_number, 'whitespace/operators', 3, 'Missing spaces around %s' % matched.group(1)) matched = search(r'[^0-9\s](<<|>>)[^0-9\s]', line) if matched: error(filename, line_number, 'whitespace/operators', 3, 'Missing spaces around %s' % matched.group(1)) matched = search(r'(!\s|~\s|[\s]--[\s;]|[\s]\+\+[\s;])', line) if matched: error(filename, line_number, 'whitespace/operators', 4, 'Extra space for operator %s' % matched.group(1)) matched = search(r' (if\(|for\(|while\(|switch\()', line) if matched: error(filename, line_number, 'whitespace/parens', 5, 'Missing space before ( in %s' % matched.group(1)) matched = search(r'\b(if|for|while|switch)\s*\(([ ]*)(.).*[^ ]+([ ]*)\)\s*{\s*$', line) if matched: if len(matched.group(2)) != len(matched.group(4)): if not (matched.group(3) == ';' and len(matched.group(2)) == 1 + len(matched.group(4)) or not matched.group(2) and search(r'\bfor\s*\(.*; \)', line)): error(filename, line_number, 'whitespace/parens', 5, 'Mismatching spaces inside () in %s' % matched.group(1)) if not len(matched.group(2)) in [0, 1]: error(filename, line_number, 'whitespace/parens', 5, 'Should have zero or one spaces inside ( and ) in %s' % matched.group(1)) if search(r',[^\s]', line): error(filename, line_number, 'whitespace/comma', 3, 'Missing space after ,') check_spacing_for_function_call(filename, line, line_number, error) if search(r'[^ ({]{', line): error(filename, line_number, 'whitespace/braces', 5, 'Missing space before {') if search(r'}else', line): error(filename, line_number, 'whitespace/braces', 5, 'Missing space before else') if search(r'\w\s+\[', line) and not search(r'delete\s+\[', line): error(filename, line_number, 'whitespace/braces', 5, 'Extra space before [') if search(r':\s*;\s*$', line): error(filename, line_number, 'whitespace/semicolon', 5, 'Semicolon defining empty statement. Use { } instead.') elif search(r'^\s*;\s*$', line): error(filename, line_number, 'whitespace/semicolon', 5, 'Line contains only semicolon. If this should be an empty statement, ' 'use { } instead.') elif (search(r'\s+;\s*$', line) and not search(r'\bfor\b', line)): error(filename, line_number, 'whitespace/semicolon', 5, 'Extra space before last semicolon. If this should be an empty ' 'statement, use { } instead.') elif (search(r'\b(for|while)\s*\(.*\)\s*;\s*$', line) and line.count('(') == line.count(')') and not search(r'}\s*while', line)): error(filename, line_number, 'whitespace/semicolon', 5, 'Semicolon defining empty statement for this loop. Use { } instead.') def get_previous_non_blank_line(clean_lines, line_number): """Return the most recent non-blank line and its line number. Args: clean_lines: A CleansedLines instance containing the file contents. line_number: The number of the line to check. Returns: A tuple with two elements. The first element is the contents of the last non-blank line before the current line, or the empty string if this is the first non-blank line. The second is the line number of that line, or -1 if this is the first non-blank line. """ previous_line_number = line_number - 1 while previous_line_number >= 0: previous_line = clean_lines.elided[previous_line_number] if not is_blank_line(previous_line): return (previous_line, previous_line_number) previous_line_number -= 1 return ('', -1) def check_braces(filename, clean_lines, line_number, error): """Looks for misplaced braces (e.g. at the end of line). Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. line_number: The number of the line to check. error: The function to call with any errors found. """ line = clean_lines.elided[line_number] if match(r'\s*{\s*$', line): previous_line = get_previous_non_blank_line(clean_lines, line_number)[0] if (not search(r'[;:}{)=]\s*$|\)\s*const\s*$', previous_line) and previous_line.find(' error(filename, line_number, 'whitespace/braces', 4, 'This { should be at the end of the previous line') elif (search(r'\)\s*(const\s*)?{\s*$', line) and line.count('(') == line.count(')') and not search(r'\b(if|for|while|switch)\b', line)): error(filename, line_number, 'whitespace/braces', 4, 'Place brace on its own line for function definitions.') if match(r'\s*else\s*', line): previous_line = get_previous_non_blank_line(clean_lines, line_number)[0] if match(r'\s*}\s*$', previous_line): error(filename, line_number, 'whitespace/newline', 4, 'An else should appear on the same line as the preceding }') if search(r'\belse [^\s{]', line) and not search(r'\belse if\b', line): error(filename, line_number, 'whitespace/newline', 4, 'Else clause should never be on same line as else (use 2 lines)') if match(r'\s*do [^\s{]', line): error(filename, line_number, 'whitespace/newline', 4, 'do/while clauses should not be on a single line') previous_line_number = line_number while True: (previous_line, previous_line_number) = get_previous_non_blank_line(clean_lines, previous_line_number) if match(r'\s+{.*}\s*;', line) and not previous_line.count(';'): line = previous_line + line else: break if (search(r'{.*}\s*;', line) and line.count('{') == line.count('}') and not search(r'struct|class|enum|\s*=\s*{', line)): error(filename, line_number, 'readability/braces', 4, "You don't need a ; after a }") def replaceable_check(operator, macro, line): """Determine whether a basic CHECK can be replaced with a more specific one. For example suggest using CHECK_EQ instead of CHECK(a == b) and similarly for CHECK_GE, CHECK_GT, CHECK_LE, CHECK_LT, CHECK_NE. Args: operator: The C++ operator used in the CHECK. macro: The CHECK or EXPECT macro being called. line: The current source line. Returns: True if the CHECK can be replaced with a more specific one. """ match_constant = r'([-+]?(\d+|0[xX][0-9a-fA-F]+)[lLuU]{0,3}|".*"|\'.*\')' match_this = (r'\s*' + macro + r'\((\s*' + match_constant + r'\s*' + operator + r'[^<>].*|' r'.*[^<>]' + operator + r'\s*' + match_constant + r'\s*\))') return match(match_this, line) and not search(r'NULL|&&|\|\|', line) def check_check(filename, clean_lines, line_number, error): """Checks the use of CHECK and EXPECT macros. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. line_number: The number of the line to check. error: The function to call with any errors found. """ raw_lines = clean_lines.raw_lines current_macro = '' for macro in _CHECK_MACROS: if raw_lines[line_number].find(macro) >= 0: current_macro = macro break if not current_macro: return line = clean_lines.elided[line_number] for operator in ['==', '!=', '>=', '>', '<=', '<']: if replaceable_check(operator, current_macro, line): error(filename, line_number, 'readability/check', 2, 'Consider using %s instead of %s(a %s b)' % ( _CHECK_REPLACEMENT[current_macro][operator], current_macro, operator)) break def get_line_width(line): """Determines the width of the line in column positions. Args: line: A string, which may be a Unicode string. Returns: The width of the line in column positions, accounting for Unicode combining characters and wide characters. """ if isinstance(line, unicode): width = 0 for c in unicodedata.normalize('NFC', line): if unicodedata.east_asian_width(c) in ('W', 'F'): width += 2 elif not unicodedata.combining(c): width += 1 return width return len(line) def check_style(filename, clean_lines, line_number, file_extension, error): """Checks rules from the 'C++ style rules' section of cppguide.html. Most of these rules are hard to test (naming, comment style), but we do what we can. In particular we check for 4-space indents, line lengths, tab usage, spaces inside code, etc. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. line_number: The number of the line to check. file_extension: The extension (without the dot) of the filename. error: The function to call with any errors found. """ raw_lines = clean_lines.raw_lines line = raw_lines[line_number] if line.find('\t') != -1: error(filename, line_number, 'whitespace/tab', 1, 'Tab found; better to use spaces') initial_spaces = 0 cleansed_line = clean_lines.elided[line_number] while initial_spaces < len(line) and line[initial_spaces] == ' ': initial_spaces += 1 if line and line[-1].isspace(): error(filename, line_number, 'whitespace/end_of_line', 4, 'Line ends in whitespace. Consider deleting these extra spaces.') elif ((initial_spaces >= 1 and initial_spaces <= 3) and not match(r'\s*\w+\s*:\s*$', cleansed_line)): error(filename, line_number, 'whitespace/indent', 3, 'Weird number of spaces at line-start. ' 'Are you using a 4-space indent?') elif not initial_spaces and line[:2] != '//' and search(r'[^:]:\s*$', line): error(filename, line_number, 'whitespace/labels', 4, 'Labels should always be indented at least one space. ' 'If this is a member-initializer list in a constructor, ' 'the colon should be on the line after the definition header.') if (cleansed_line.count(';') > 1 and cleansed_line.find('for') == -1 and (get_previous_non_blank_line(clean_lines, line_number)[0].find('for') == -1 or get_previous_non_blank_line(clean_lines, line_number)[0].find(';') != -1) and not ((cleansed_line.find('case ') != -1 or cleansed_line.find('default:') != -1) and cleansed_line.find('break;') != -1)): error(filename, line_number, 'whitespace/newline', 4, 'More than one command on the same line') check_braces(filename, clean_lines, line_number, error) check_spacing(filename, clean_lines, line_number, error) check_check(filename, clean_lines, line_number, error) _RE_PATTERN_INCLUDE_NEW_STYLE = re.compile(r' _RE_PATTERN_INCLUDE = re.compile(r'^\s* _RE_FIRST_COMPONENT = re.compile(r'^[^-_.]+') def _drop_common_suffixes(filename): """Drops common suffixes like _test.cc or -inl.h from filename. For example: >>> _drop_common_suffixes('foo/foo-inl.h') 'foo/foo' >>> _drop_common_suffixes('foo/bar/foo.cc') 'foo/bar/foo' >>> _drop_common_suffixes('foo/foo_internal.h') 'foo/foo' >>> _drop_common_suffixes('foo/foo_unusualinternal.h') 'foo/foo_unusualinternal' Args: filename: The input filename. Returns: The filename with the common suffix removed. """ for suffix in ('test.cc', 'regtest.cc', 'unittest.cc', 'inl.h', 'impl.h', 'internal.h'): if (filename.endswith(suffix) and len(filename) > len(suffix) and filename[-len(suffix) - 1] in ('-', '_')): return filename[:-len(suffix) - 1] return os.path.splitext(filename)[0] def _is_test_filename(filename): """Determines if the given filename has a suffix that identifies it as a test. Args: filename: The input filename. Returns: True if 'filename' looks like a test, False otherwise. """ if (filename.endswith('_test.cc') or filename.endswith('_unittest.cc') or filename.endswith('_regtest.cc')): return True return False def _classify_include(fileinfo, include, is_system): """Figures out what kind of header 'include' is. Args: fileinfo: The current file cpplint is running over. A FileInfo instance. include: The path to a is_system: True if the Returns: One of the _XXX_HEADER constants. For example: >>> _classify_include(FileInfo('foo/foo.cc'), 'stdio.h', True) _C_SYS_HEADER >>> _classify_include(FileInfo('foo/foo.cc'), 'string', True) _CPP_SYS_HEADER >>> _classify_include(FileInfo('foo/foo.cc'), 'foo/foo.h', False) _LIKELY_MY_HEADER >>> _classify_include(FileInfo('foo/foo_unknown_extension.cc'), ... 'bar/foo_other_ext.h', False) _POSSIBLE_MY_HEADER >>> _classify_include(FileInfo('foo/foo.cc'), 'foo/bar.h', False) _OTHER_HEADER """ is_stl_h = include in _STL_HEADERS is_cpp_h = is_stl_h or include in _CPP_HEADERS if is_system: if is_cpp_h: return _CPP_SYS_HEADER return _C_SYS_HEADER target_dir, target_base = ( os.path.split(_drop_common_suffixes(fileinfo.repository_name()))) include_dir, include_base = os.path.split(_drop_common_suffixes(include)) if (target_base == include_base and (include_dir == target_dir or include_dir == os.path.normpath(target_dir + '/../public'))): return _LIKELY_MY_HEADER target_first_component = _RE_FIRST_COMPONENT.match(target_base) include_first_component = _RE_FIRST_COMPONENT.match(include_base) if (target_first_component and include_first_component and target_first_component.group(0) == include_first_component.group(0)): return _POSSIBLE_MY_HEADER return _OTHER_HEADER def check_include_line(filename, clean_lines, line_number, include_state, error): """Check rules that are applicable to Strings on certain tasks easier. However, to prevent false positives, checks applicable to Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. line_number: The number of the line to check. include_state: An _IncludeState instance in which the headers are inserted. error: The function to call with any errors found. """ fileinfo = FileInfo(filename) line = clean_lines.lines[line_number] matched = _RE_PATTERN_INCLUDE.search(line) if matched: include = matched.group(2) is_system = (matched.group(1) == '<') if include in include_state: error(filename, line_number, 'build/include', 4, '"%s" already included at %s:%s' % (include, filename, include_state[include])) else: include_state[include] = line_number error_message = include_state.check_next_include_order( _classify_include(fileinfo, include, is_system)) if error_message: error(filename, line_number, 'build/include_order', 4, '%s. Should be: %s.h, c system, c++ system, other.' % (error_message, fileinfo.base_name())) matched = _RE_PATTERN_INCLUDE.match(line) if matched: include = matched.group(2) if match(r'(f|ind|io|i|o|parse|pf|stdio|str|)?stream$', include): if not _is_test_filename(filename): error(filename, line_number, 'readability/streams', 3, 'Streams are highly discouraged.') def check_language(filename, clean_lines, line_number, file_extension, include_state, error): """Checks rules from the 'C++ language rules' section of cppguide.html. Some of these rules are hard to test (function overloading, using uint32 inappropriately), but we do the best we can. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. line_number: The number of the line to check. file_extension: The extension (without the dot) of the filename. include_state: An _IncludeState instance in which the headers are inserted. error: The function to call with any errors found. """ line = clean_lines.elided[line_number] if not line: return matched = _RE_PATTERN_INCLUDE.search(line) if matched: check_include_line(filename, clean_lines, line_number, include_state, error) return matched = search( r'\b(int|float|double|bool|char|int32|uint32|int64|uint64)\([^)]', line) if matched: if not match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(', line): error(filename, line_number, 'readability/casting', 4, 'Using deprecated casting style. ' 'Use static_cast<%s>(...) instead' % matched.group(1)) check_c_style_cast(filename, line_number, line, clean_lines.raw_lines[line_number], 'static_cast', r'\((int|float|double|bool|char|u?int(16|32|64))\)', error) check_c_style_cast(filename, line_number, line, clean_lines.raw_lines[line_number], 'reinterpret_cast', r'\((\w+\s?\*+\s?)\)', error) if search( r'(&\([^)]+\)[\w(])|(&(static|dynamic|reinterpret)_cast\b)', line): error(filename, line_number, 'runtime/casting', 4, ('Are you taking an address of a cast? ' 'This is dangerous: could be a temp var. ' 'Take the address before doing the cast, rather than after')) matched = match( r'((?:|static +)(?:|const +))string +([a-zA-Z0-9_:]+)\b(.*)', line) if matched and not match(r'\s*(<.*>)?(::[a-zA-Z0-9_]+)?\s*\(([^"]|$)', matched.group(3)): error(filename, line_number, 'runtime/string', 4, 'For a static/global string constant, use a C style string instead: ' '"%schar %s[]".' % (matched.group(1), matched.group(2))) if search(r'\bdynamic_cast<', line) and not _is_test_filename(filename): error(filename, line_number, 'runtime/rtti', 5, 'Do not use dynamic_cast<>. If you need to cast within a class ' "hierarchy, use static_cast<> to upcast. Google doesn't support " 'RTTI.') if search(r'\b([A-Za-z0-9_]*_)\(\1\)', line): error(filename, line_number, 'runtime/init', 4, 'You seem to be initializing a member variable with itself.') if file_extension == 'h': pass if search(r'\bshort port\b', line): if not search(r'\bunsigned short port\b', line): error(filename, line_number, 'runtime/int', 4, 'Use "unsigned short" for ports, not "short"') matched = search(r'snprintf\s*\(([^,]*),\s*([0-9]*)\s*,', line) if matched: error(filename, line_number, 'runtime/printf', 3, 'If you can, use sizeof(%s) instead of %s as the 2nd arg ' 'to snprintf.' % (matched.group(1), matched.group(2))) if search(r'\bsprintf\b', line): error(filename, line_number, 'runtime/printf', 5, 'Never use sprintf. Use snprintf instead.') matched = search(r'\b(strcpy|strcat)\b', line) if matched: error(filename, line_number, 'runtime/printf', 4, 'Almost always, snprintf is better than %s' % matched.group(1)) if search(r'\bsscanf\b', line): error(filename, line_number, 'runtime/printf', 1, 'sscanf can be ok, but is slow and can overflow buffers.') if search(r'\}\s*if\s*\(', line): error(filename, line_number, 'readability/braces', 4, 'Did you mean "else if"? If not, start a new line for "if".') matched = re.search(r'\b((?:string)?printf)\s*\(([\w.\->()]+)\)', line, re.I) if matched: error(filename, line_number, 'runtime/printf', 4, 'Potential format string bug. Do %s("%%s", %s) instead.' % (matched.group(1), matched.group(2))) matched = search(r'memset\s*\(([^,]*),\s*([^,]*),\s*0\s*\)', line) if matched and not match(r"^''|-?[0-9]+|0x[0-9A-Fa-f]$", matched.group(2)): error(filename, line_number, 'runtime/memset', 4, 'Did you mean "memset(%s, 0, %s)"?' % (matched.group(1), matched.group(2))) matched = match(r'\s*(.+::)?(\w+) [a-z]\w*\[(.+)];', line) if (matched and matched.group(2) != 'return' and matched.group(2) != 'delete' and matched.group(3).find(']') == -1): tokens = re.split(r'\s|\+|\-|\*|\/|<<|>>]', matched.group(3)) is_const = True skip_next = False for tok in tokens: if skip_next: skip_next = False continue if search(r'sizeof\(.+\)', tok): continue if search(r'arraysize\(\w+\)', tok): continue tok = tok.lstrip('(') tok = tok.rstrip(')') if not tok: continue if match(r'\d+', tok): continue if match(r'0[xX][0-9a-fA-F]+', tok): continue if match(r'k[A-Z0-9]\w*', tok): continue if match(r'(.+::)?k[A-Z0-9]\w*', tok): continue if match(r'(.+::)?[A-Z][A-Z0-9_]*', tok): continue if tok.startswith('sizeof'): skip_next = True continue is_const = False break if not is_const: error(filename, line_number, 'runtime/arrays', 1, 'Do not use variable-length arrays. Use an appropriately named ' "('k' followed by CamelCase) compile-time constant for the size.") if (file_extension == 'h' and search(r'\bnamespace\s*{', line) and line[-1] != '\\'): error(filename, line_number, 'build/namespaces', 4, 'Do not use unnamed namespaces in header files. See ' 'http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml ' for more information.') def check_c_style_cast(filename, line_number, line, raw_line, cast_type, pattern, error): """Checks for a C-style cast by looking for the pattern. This also handles sizeof(type) warnings, due to similarity of content. Args: filename: The name of the current file. line_number: The number of the line to check. line: The line of code to check. raw_line: The raw line of code to check, with comments. cast_type: The string for the C++ cast to recommend. This is either reinterpret_cast or static_cast, depending. pattern: The regular expression used to find C-style casts. error: The function to call with any errors found. """ matched = search(pattern, line) if not matched: return sizeof_match = match(r'.*sizeof\s*$', line[0:matched.start(1) - 1]) if sizeof_match: error(filename, line_number, 'runtime/sizeof', 1, 'Using sizeof(type). Use sizeof(varname) instead if possible') return remainder = line[matched.end(0):] | def remove_if_present(self, substr): for (index, error) in enumerate(self._errors): if error.find(substr) != -1: self._errors = self._errors[0:index] + self._errors[(index + 1):] break | dfbab72754cf78125ddb423381a58e64d7cad278 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/9392/dfbab72754cf78125ddb423381a58e64d7cad278/cpplint.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1206,
67,
430,
67,
6706,
12,
2890,
16,
2373,
4672,
364,
261,
1615,
16,
555,
13,
316,
4241,
12,
2890,
6315,
4324,
4672,
309,
555,
18,
4720,
12,
10706,
13,
480,
300,
21,
30,
365,
6315,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1206,
67,
430,
67,
6706,
12,
2890,
16,
2373,
4672,
364,
261,
1615,
16,
555,
13,
316,
4241,
12,
2890,
6315,
4324,
4672,
309,
555,
18,
4720,
12,
10706,
13,
480,
300,
21,
30,
365,
6315,... |
rfd, wfd, xfd = select.select([self, sys.stdin], [], []) | rfd, wfd, xfd = select([self, sys.stdin], [], []) | def interact(self): """Interaction function, emulates a very dumb telnet client.""" if sys.platform == "win32": self.mt_interact() return while 1: rfd, wfd, xfd = select.select([self, sys.stdin], [], []) if self in rfd: try: text = self.read_eager() except EOFError: print '*** Connection closed by remote host ***' break if text: sys.stdout.write(text) sys.stdout.flush() if sys.stdin in rfd: line = sys.stdin.readline() if not line: break self.write(line) | 63be25c16968b1c9d0252f27173e9cf04188007e /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/6753/63be25c16968b1c9d0252f27173e9cf04188007e/telnetlib.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
16592,
12,
2890,
4672,
3536,
17419,
445,
16,
801,
17099,
279,
8572,
302,
3592,
20666,
2758,
1004,
12123,
309,
2589,
18,
9898,
422,
315,
8082,
1578,
6877,
365,
18,
1010,
67,
2761,
621,
14... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
16592,
12,
2890,
4672,
3536,
17419,
445,
16,
801,
17099,
279,
8572,
302,
3592,
20666,
2758,
1004,
12123,
309,
2589,
18,
9898,
422,
315,
8082,
1578,
6877,
365,
18,
1010,
67,
2761,
621,
14... |
o2tf.printlog('buildkernel: main - cmd = %s' % \ | o2tf.printlog('buildkernel:Main - cmd = %s' % \ | def check_thread(runnumber, wdir, logfile): 'check_thread checks the pidlist for running tasks until the last one \ completes.' 'check_thread takes 3 arguments:' ' runnumer - Sequence number of a specific batch.' ' wdir - working directory.' ' logfile - logfile name' o2tf.printlog('buildkernel.check_thread: Waiting for processes to finish \ on thread %s, directory %s' % \ (runnumber, wdir), logfile, 0, '') while len(pidlist) > 0: o2tf.printlog('buildkernel.check_thread: Checking processes on thread \ %s, directory %s' % \ (runnumber, wdir), logfile, 0, '') o2tf.printlog('buildkernel.check_thread: pid list %s' % (pidlist), logfile, 0, '') for z in range(len(pidlist)): out = os.waitpid(pidlist[z],os.WNOHANG) o2tf.printlog('buildkernel.check_thread: z=%s, out=%s' % \ (z, out[1]), logfile, 0, '') if out[0] > 0: o2tf.printlog('buildkernel.check_thread: Removing pid \ %s from the list' % \ pidlist[z], logfile, 0, '') t2 = time.clock() o2tf.printlog('buildkernel.check_thread: %s [%s]: Build \ time is %f seconds' % (str(socket.gethostname()), pidlist[z], t2 - t1), logfile, 0, '') pidlist.remove(out[0]) break time.sleep(10) | d974635f0ebd98460a2338abe8d5b254e8b5f9a3 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/1915/d974635f0ebd98460a2338abe8d5b254e8b5f9a3/buildkernel.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
866,
67,
5930,
12,
2681,
2696,
16,
341,
1214,
16,
15204,
4672,
296,
1893,
67,
5930,
4271,
326,
4231,
1098,
364,
3549,
4592,
3180,
326,
1142,
1245,
521,
7218,
1093,
296,
1893,
67,
5930,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
866,
67,
5930,
12,
2681,
2696,
16,
341,
1214,
16,
15204,
4672,
296,
1893,
67,
5930,
4271,
326,
4231,
1098,
364,
3549,
4592,
3180,
326,
1142,
1245,
521,
7218,
1093,
296,
1893,
67,
5930,
... |
request.user.set_password('password') | request.user.set_password(post['password']) | def options(request): if request.method == 'POST': post = request.POST.copy() if 'password' in post and post['password'].strip() != u'': request.user.set_password('password') del post['password'] user_form = UserForm(post, instance=request.user) profile_form = PootleProfileForm(post, instance=get_profile(request.user)) user_form.save() profile_form.save() # Activate the newly selected interface language so that the user will # immediately see a translated interface. But only do this if the user # selected an interface language. if profile_form['ui_lang'].data != '': gettext.activate_for_profile(get_profile(request.user)) elif request.method == 'GET': user_form = UserForm(instance=request.user) profile_form = PootleProfileForm(instance=get_profile(request.user)) template_vars = {"pagetitle": _("Options for: %s", request.user.username), "introtext": _("Configure your settings here"), "detailstitle": _("Personal Details"), "fullname_title": _("Name"), "user_form": user_form, "profile_form": profile_form } return render_to_kid("profile/options.html", KidRequestContext(request, template_vars)) | 3f7ce69f8bdb24cd5524b37155b61c1faf2977d4 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/11388/3f7ce69f8bdb24cd5524b37155b61c1faf2977d4/view.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
702,
12,
2293,
4672,
309,
590,
18,
2039,
422,
296,
3798,
4278,
1603,
273,
590,
18,
3798,
18,
3530,
1435,
309,
296,
3664,
11,
316,
1603,
471,
1603,
3292,
3664,
29489,
6406,
1435,
480,
5... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
702,
12,
2293,
4672,
309,
590,
18,
2039,
422,
296,
3798,
4278,
1603,
273,
590,
18,
3798,
18,
3530,
1435,
309,
296,
3664,
11,
316,
1603,
471,
1603,
3292,
3664,
29489,
6406,
1435,
480,
5... |
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) | c377b16d12ba325bb108eca575447d66f19294c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c377b16d12ba325bb108eca575447d66f19294c0/regrtest.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3082,
12,
92,
20,
16,
619,
21,
4672,
619,
20,
1011,
404,
309,
619,
20,
1545,
619,
21,
30,
327,
609,
12,
92,
20,
13,
469,
30,
327,
2213,
72,
15529,
72,
6,
738,
261,
92,
20,
16,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3082,
12,
92,
20,
16,
619,
21,
4672,
619,
20,
1011,
404,
309,
619,
20,
1545,
619,
21,
30,
327,
609,
12,
92,
20,
13,
469,
30,
327,
2213,
72,
15529,
72,
6,
738,
261,
92,
20,
16,
... |
decomposition = recursiveDecomposition(uniValue) | font = self.getParent() decomposition = unicodeTools.decompositionBase(uniValue) | def _findDecomposedBaseForGlyph(self, glyphName, allowPseudoUnicode): if allowPseudoUnicode: uniValue = self.pseudoUnicodeForGlyphName(glyphName) else: uniValue = self.unicodeForGlyphName(glyphName) if uniValue is None: return if uniValue is not None: decomposition = recursiveDecomposition(uniValue) if decomposition != -1: if decomposition in font.unicodeData: baseGlyphName = font.unicodeData[decomposition][0] if "." in glyphName.unicodeData: suffix = glyphName.split(".", 1)[1] baseWithSuffix = baseGlyphName + "." + suffix if baseWithSuffix in font: baseGlyphName = baseWithSuffix return baseGlyphName return glyphName | c98e12cf1c999c74780023e96158ae51f079d422 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/8851/c98e12cf1c999c74780023e96158ae51f079d422/cmap.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
4720,
17731,
7423,
2171,
1290,
15141,
12,
2890,
16,
9440,
461,
16,
1699,
26716,
16532,
4672,
309,
1699,
26716,
16532,
30,
7738,
620,
273,
365,
18,
26023,
16532,
1290,
15141,
461,
12,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
4720,
17731,
7423,
2171,
1290,
15141,
12,
2890,
16,
9440,
461,
16,
1699,
26716,
16532,
4672,
309,
1699,
26716,
16532,
30,
7738,
620,
273,
365,
18,
26023,
16532,
1290,
15141,
461,
12,
... |
f = open(self.logfile) | f = open("%s/%s" % (self.dir, self.logfile)) | def retrieveLog(self): f = open(self.logfile) self.logText = f.read() f.close() | c5ffc4ffec54b8f4af65e9d57389559f566007ec /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/13005/c5ffc4ffec54b8f4af65e9d57389559f566007ec/LocalVermontInstance.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
4614,
1343,
12,
2890,
4672,
284,
273,
1696,
27188,
87,
5258,
87,
6,
738,
261,
2890,
18,
1214,
16,
365,
18,
28806,
3719,
365,
18,
1330,
1528,
273,
284,
18,
896,
1435,
284,
18,
4412,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
4614,
1343,
12,
2890,
4672,
284,
273,
1696,
27188,
87,
5258,
87,
6,
738,
261,
2890,
18,
1214,
16,
365,
18,
28806,
3719,
365,
18,
1330,
1528,
273,
284,
18,
896,
1435,
284,
18,
4412,
1... |
def find_vcs(self,ids={}): if not ids: ids = self.ids result=[] for item in pooler.get_pool(self.cr.dbname).get('account.invoice').browse(self.cr,self.uid,ids): res={} | def find_vcs(self,invoice_id): item = pooler.get_pool(self.cr.dbname).get('account.invoice').browse(self.cr,self.uid,invoice_id) vcs ='' if item.number: vcs3=str(item.number).split('/')[1] | def find_vcs(self,ids={}): if not ids: ids = self.ids result=[] | e6ce698235d83897de680b4a435bcaa8ef6fed04 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/7339/e6ce698235d83897de680b4a435bcaa8ef6fed04/report_account_invoice_layout.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1104,
67,
18982,
12,
2890,
16,
2232,
12938,
4672,
309,
486,
3258,
30,
3258,
273,
365,
18,
2232,
563,
33,
8526,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1104,
67,
18982,
12,
2890,
16,
2232,
12938,
4672,
309,
486,
3258,
30,
3258,
273,
365,
18,
2232,
563,
33,
8526,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
self.set_build_kernel_vars(addlargs) | def __init__(self,spec,addlargs): self.valid_values = [ "netboot/kernel/sources", "netboot/kernel/config", "netboot/kernel/prebuilt", | ee4c1ce1819c41d7d379774b832b7bda41a24f6b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7327/ee4c1ce1819c41d7d379774b832b7bda41a24f6b/netboot_target.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
2738,
972,
12,
2890,
16,
2793,
16,
1289,
80,
1968,
4672,
365,
18,
877,
67,
2372,
273,
306,
315,
2758,
7137,
19,
8111,
19,
10141,
3113,
315,
2758,
7137,
19,
8111,
19,
1425,
3113,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
2738,
972,
12,
2890,
16,
2793,
16,
1289,
80,
1968,
4672,
365,
18,
877,
67,
2372,
273,
306,
315,
2758,
7137,
19,
8111,
19,
10141,
3113,
315,
2758,
7137,
19,
8111,
19,
1425,
3113,
... | |
strip.lblName.setText("IN %d/%d" % (input_id+1, input_id+2)) | strip.lblName.setText("In %d/%d" % (input_id+1, input_id+2)) | def buildMixer(self): log.debug("Building mixer") self.MatrixButtonControls={} self.MatrixRotaryControls={} self.MatrixVolumeControls={} self.VolumeControls={} self.SelectorControls={} self.SPDIFmodeControls={} self.TriggerControls={} | 89a90d3806d33a9441e38874e03b201dde0730bf /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11526/89a90d3806d33a9441e38874e03b201dde0730bf/audiofire.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1361,
21294,
264,
12,
2890,
4672,
613,
18,
4148,
2932,
16713,
6843,
264,
7923,
365,
18,
4635,
3616,
16795,
12938,
365,
18,
4635,
8570,
814,
16795,
12938,
365,
18,
4635,
4545,
16795,
12938,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1361,
21294,
264,
12,
2890,
4672,
613,
18,
4148,
2932,
16713,
6843,
264,
7923,
365,
18,
4635,
3616,
16795,
12938,
365,
18,
4635,
8570,
814,
16795,
12938,
365,
18,
4635,
4545,
16795,
12938,... |
def NumberField(polynomial, name='a', check=False): | def NumberField(polynomial, name='a', check=True): r""" Return {\em the} number field defined by the given irreducible polynomial and with variable with the given name. If check is True (the default), also verify that the defining polynomial is irreducible and over Q. INPUT: polynomial -- a polynomial over Q (for now) name -- a string (default: 'a'), the name of the generator check -- bool (default: True); do type checking and irreducibility checking. \note{Relative extensions are not directly supported yet (but will be soon). However, you can make a quotient of a polynomial ring over a number field, hence at least construct relative extensions. See the examples below.} EXAMPLES: sage: z = QQ['z'].0 sage: K = NumberField(z^2 - 2,'s'); K Number Field in s with defining polynomial z^2 - 2 sage: s = K.0; s s sage: s*s 2 sage: s^2 2 EXAMPLE: Relative number field as polynomial quotient ring. """ | def NumberField(polynomial, name='a', check=False): global _objsNumberField key = (polynomial, name) if _objsNumberField.has_key(key): K = _objsNumberField[key]() if K != None: return K if polynomial.degree() == 2: K = NumberField_quadratic(polynomial, name, check) else: K = NumberField_generic(polynomial, name, check) _objsNumberField[key] = weakref.ref(K) return K | 43f8843c72a7b540aa8c8372f583216476d11299 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9890/43f8843c72a7b540aa8c8372f583216476d11299/number_field.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3588,
974,
12,
3915,
13602,
16,
508,
2218,
69,
2187,
866,
33,
5510,
4672,
436,
8395,
2000,
18890,
351,
326,
97,
1300,
652,
2553,
635,
326,
864,
9482,
1118,
5286,
1523,
16991,
471,
598,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3588,
974,
12,
3915,
13602,
16,
508,
2218,
69,
2187,
866,
33,
5510,
4672,
436,
8395,
2000,
18890,
351,
326,
97,
1300,
652,
2553,
635,
326,
864,
9482,
1118,
5286,
1523,
16991,
471,
598,
... |
revnum = self.revnum(rev) if revnum in self.modulemap: new_module = self.modulemap[revnum] if new_module != self.module: self.module = new_module self.reparent(self.module) | new_module, revnum = self.revsplit(rev)[1:] if new_module != self.module: self.module = new_module self.reparent(self.module) | def get_entry_from_path(path, module=self.module): # Given the repository url of this wc, say # "http://server/plone/CMFPlone/branches/Plone-2_0-branch" # extract the "entry" portion (a relative path) from what # svn log --xml says, ie # "/CMFPlone/branches/Plone-2_0-branch/tests/PloneTestCase.py" # that is to say "tests/PloneTestCase.py" if path.startswith(module): relative = path[len(module):] if relative.startswith('/'): return relative[1:] else: return relative | c6a1068cdcfcb9641c61c95fff848144537955b7 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/11312/c6a1068cdcfcb9641c61c95fff848144537955b7/subversion.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
336,
67,
4099,
67,
2080,
67,
803,
12,
803,
16,
1605,
33,
2890,
18,
2978,
4672,
468,
16803,
326,
3352,
880,
434,
333,
14310,
16,
12532,
468,
282,
315,
2505,
2207,
3567,
19,
412,
476,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
336,
67,
4099,
67,
2080,
67,
803,
12,
803,
16,
1605,
33,
2890,
18,
2978,
4672,
468,
16803,
326,
3352,
880,
434,
333,
14310,
16,
12532,
468,
282,
315,
2505,
2207,
3567,
19,
412,
476,
... |
updates.append((previous_update,field_changes,comment)) | updates.append((previous_update,field_changes,comment, this_summary)) | def get_timeline_events(self, req, start, stop, filters): if 'ticket_details' in filters: db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute("SELECT tc.time, tc.ticket, " " tc.field, tc.oldvalue, tc.newvalue, tc.author " "FROM ticket_change tc" " LEFT JOIN ticket t ON t.id = tc.ticket " "AND tc.time>=%s AND tc.time<=%s ORDER BY tc.time" % (start, stop)) previous_update = None updates = [] for time,id,field,oldvalue,newvalue,author in cursor: if (time,id,author) != previous_update: if previous_update: updates.append((previous_update,field_changes,comment)) field_changes = [] comment = '' previous_update = (time,id,author) if field == 'comment': comment = newvalue else: field_changes.append(field) if previous_update: updates.append((previous_update,field_changes,comment)) | 3f8ebe11ae78c26fccce599155ca7391f969fb44 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/3f8ebe11ae78c26fccce599155ca7391f969fb44/Ticket.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
336,
67,
26237,
67,
5989,
12,
2890,
16,
1111,
16,
787,
16,
2132,
16,
3415,
4672,
309,
296,
16282,
67,
6395,
11,
316,
3415,
30,
1319,
273,
365,
18,
3074,
18,
588,
67,
1966,
67,
10305,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
336,
67,
26237,
67,
5989,
12,
2890,
16,
1111,
16,
787,
16,
2132,
16,
3415,
4672,
309,
296,
16282,
67,
6395,
11,
316,
3415,
30,
1319,
273,
365,
18,
3074,
18,
588,
67,
1966,
67,
10305,... |
def SetPoint( self, i, x, y, z ): | def SetPoint( self, i, x, y, z = 0): | def SetPoint( self, i, x, y, z ): return _gdal.OGR_G_SetPoint( self._o, i, x, y, z ) | 3168cde22e4a9933a110dc046a57cda148cf2a16 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10290/3168cde22e4a9933a110dc046a57cda148cf2a16/ogr.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1000,
2148,
12,
365,
16,
277,
16,
619,
16,
677,
16,
998,
273,
374,
4672,
327,
389,
19016,
287,
18,
51,
6997,
67,
43,
67,
694,
2148,
12,
365,
6315,
83,
16,
277,
16,
619,
16,
677,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1000,
2148,
12,
365,
16,
277,
16,
619,
16,
677,
16,
998,
273,
374,
4672,
327,
389,
19016,
287,
18,
51,
6997,
67,
43,
67,
694,
2148,
12,
365,
6315,
83,
16,
277,
16,
619,
16,
677,
... |
'kwa': {'fill': ' | 'kwb': {'fill': ' | def inserter(self, syntax, text): # Get SVG highlighted output p = Popen(["highlight", "--syntax", syntax, "--svg"], stdin=PIPE, stdout=PIPE) out = p.communicate(text)[0] tree = inkex.etree.parse(StringIO(out)) group = tree.getroot()[1] | 58ee253ba13069cf94d8ce2351e023625412faad /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/356/58ee253ba13069cf94d8ce2351e023625412faad/inksyntax.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
316,
550,
387,
12,
2890,
16,
6279,
16,
977,
4672,
468,
968,
11281,
24375,
876,
293,
273,
14339,
3816,
6,
15978,
3113,
5238,
14308,
3113,
6279,
16,
5238,
11451,
6,
6487,
8801,
33,
27602,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
316,
550,
387,
12,
2890,
16,
6279,
16,
977,
4672,
468,
968,
11281,
24375,
876,
293,
273,
14339,
3816,
6,
15978,
3113,
5238,
14308,
3113,
6279,
16,
5238,
11451,
6,
6487,
8801,
33,
27602,
... |
self.firewallCustomizeRadio.set_active(gtk.TRUE) | def fillData(self): if self.kickstartData.getFirewall(): opts, args = getopt.getopt(self.kickstartData.getFirewall(), "d:h", ["high", "medium", "enabled", "disabled", "trust=", "port=", "dhcp", "ssh", "telnet", "smtp", "http", "ftp"]) | 11ac8012b750b63c575c3d69a0a9747e254a3d79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/5376/11ac8012b750b63c575c3d69a0a9747e254a3d79/firewall.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3636,
751,
12,
2890,
4672,
309,
365,
18,
79,
1200,
1937,
751,
18,
588,
18950,
13332,
1500,
16,
833,
273,
336,
3838,
18,
588,
3838,
12,
2890,
18,
79,
1200,
1937,
751,
18,
588,
18950,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
3636,
751,
12,
2890,
4672,
309,
365,
18,
79,
1200,
1937,
751,
18,
588,
18950,
13332,
1500,
16,
833,
273,
336,
3838,
18,
588,
3838,
12,
2890,
18,
79,
1200,
1937,
751,
18,
588,
18950,
... | |
tables[ "type%s" % name ] = { 'Fields' : fieldsDict, | tables[ self.__getTableName( "type", name ) ] = { 'Fields' : fieldsDict, | def registerType( self, name, definitionKeyFields, definitionAccountingFields, bucketsLength ): """ Register a new type """ keyFieldsList = [] valueFieldsList = [] for t in definitionKeyFields: keyFieldsList.append( t[0] ) for t in definitionAccountingFields: valueFieldsList.append( t[0] ) for field in definitionKeyFields: if field in valueFieldsList: return S_ERROR( "Key field %s is also in the list of value fields" % field ) for field in definitionAccountingFields: if field in keyFieldsList: return S_ERROR( "Value field %s is also in the list of key fields" % field ) for bucket in bucketsLength: if type( bucket ) != types.TupleType: return S_ERROR( "Length of buckets should be a list of tuples" ) if len( bucket ) != 2: return S_ERROR( "Length of buckets should have 2d tuples" ) if name in self.dbCatalog: gLogger.error( "Type %s is already registered" % name ) return S_ERROR( "Type %s already exists in db" % name ) tables = {} for key in definitionKeyFields: if key[0] not in self.dbKeys: gLogger.info( "Table for key %s has to be created" % key[0] ) tables[ "key%s" % key[0] ] = { 'Fields' : { 'id' : 'INTEGER NOT NULL AUTO_INCREMENT', 'value' : '%s UNIQUE' % key[1] }, 'Indexes' : { 'valueindex' : [ 'value' ] }, 'PrimaryKey' : 'id' } #Registering type fieldsDict = {} bucketFieldsDict = {} indexesDict = {} for field in definitionKeyFields: indexesDict[ "%sIndex" % field[0] ] = [ field[0] ] fieldsDict[ field[0] ] = "INTEGER" bucketFieldsDict[ field[0] ] = "INTEGER" for field in definitionAccountingFields: fieldsDict[ field[0] ] = field[1] bucketFieldsDict[ field[0] ] = "FLOAT" fieldsDict[ 'startTime' ] = "DATETIME" fieldsDict[ 'endTime' ] = "DATETIME" bucketFieldsDict[ 'startTime' ] = "DATETIME" bucketFieldsDict[ 'bucketLength' ] = "INT" tables[ "bucket%s" % name ] = { 'Fields' : bucketFieldsDict, 'Indexes' : indexesDict, } tables[ "type%s" % name ] = { 'Fields' : fieldsDict, 'Indexes' : indexesDict, } retVal = self._createTables( tables ) | 7663d95782c4987a99eb5394bb9f465c2ab982d5 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/12864/7663d95782c4987a99eb5394bb9f465c2ab982d5/AccountingDB.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1744,
559,
12,
365,
16,
508,
16,
2379,
653,
2314,
16,
2379,
3032,
310,
2314,
16,
9169,
1782,
262,
30,
3536,
5433,
279,
394,
618,
3536,
498,
2314,
682,
273,
5378,
460,
2314,
682,
273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1744,
559,
12,
365,
16,
508,
16,
2379,
653,
2314,
16,
2379,
3032,
310,
2314,
16,
9169,
1782,
262,
30,
3536,
5433,
279,
394,
618,
3536,
498,
2314,
682,
273,
5378,
460,
2314,
682,
273,
... |
self.assertRaises(Exception, self.CheckTree()) | self.CheckTree() | def test0040delete(self): ''' Delete. ''' record_ids = self.mptt.search([], CONTEXT) for record_id in record_ids: if record_id % 2: self.mptt.delete(record_id, CONTEXT) self.assertRaises(Exception, self.CheckTree()) record_ids = self.mptt.search([], CONTEXT) self.mptt.delete(record_ids[:len(record_ids)/2], CONTEXT) self.assertRaises(Exception, self.CheckTree()) record_ids = self.mptt.search([], CONTEXT) self.mptt.delete(record_ids, CONTEXT) self.assertRaises(Exception, self.CheckTree()) | 4eb41eb13692d42bf9b2de715e54289debf04e4c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9266/4eb41eb13692d42bf9b2de715e54289debf04e4c/test_tryton.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
713,
7132,
3733,
12,
2890,
4672,
9163,
2504,
18,
9163,
1409,
67,
2232,
273,
365,
18,
81,
337,
88,
18,
3072,
3816,
6487,
13862,
13,
364,
1409,
67,
350,
316,
1409,
67,
2232,
30,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
713,
7132,
3733,
12,
2890,
4672,
9163,
2504,
18,
9163,
1409,
67,
2232,
273,
365,
18,
81,
337,
88,
18,
3072,
3816,
6487,
13862,
13,
364,
1409,
67,
350,
316,
1409,
67,
2232,
30,
... |
name, vardict = func.__name__, dict() defstr, callstr = cargdefstr(func) | func_obj = func[1] if istup else func name, vardict = func_obj.__name__, dict() defstr, callstr = cargdefstr(func_obj) | def _func_settings(self, func): #{{{ mk_sig = self._vars['global_settings'].pop('MAKE_SIGNAL', 0) s = self._csettings() block = set(['ismethod', 'callmethod']) news = dict((k, v) for k, v in s.iteritems() if k not in block) ism = bool(s.get('ismethod', False)) istup = isinstance(func, tuple) meth_app = self._vars['methods'].append # Add to methods var so callfunc can process both # conditional callables and target callables if ism: callmeth = bool(s.get('callmethod', False)) if callmeth and not mk_sig: name, vardict = func.__name__, dict() defstr, callstr = cargdefstr(func) self_str = defstr.split(',', 1)[0].strip() callstr = callstr.split(',', 1)[1].strip() fstr = """ def f(%s): return getattr(%s, '%s')(%s) """ %(defstr, self_str, name, callstr) exec compile(fstr.strip(), '<string>', 'exec') in vardict f = vardict['f'] func = (func[0], f) if istup else f if istup: for f in func: meth_app(f) else: meth_app(func) return func, news | 07e9426644cf327fe138db6e1a06b8c3dd395579 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/2635/07e9426644cf327fe138db6e1a06b8c3dd395579/deco.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
644,
67,
4272,
12,
2890,
16,
1326,
4672,
3735,
12187,
5028,
67,
7340,
273,
365,
6315,
4699,
3292,
6347,
67,
4272,
29489,
5120,
2668,
5535,
6859,
67,
11260,
1013,
2187,
374,
13,
272,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
644,
67,
4272,
12,
2890,
16,
1326,
4672,
3735,
12187,
5028,
67,
7340,
273,
365,
6315,
4699,
3292,
6347,
67,
4272,
29489,
5120,
2668,
5535,
6859,
67,
11260,
1013,
2187,
374,
13,
272,... |
self.vlist = pyglet.graphics.vertex_list_indexed( len(verts)/2, indices, ('v2f', verts), ('0t2f', texcoords0) ) | self.vlist = pyglet.graphics.vertex_list_indexed( len(verts)/2, indices, ('v2f', verts), ('t2f', texcoords0) ) | def __init__(self, sx, sy, tint=[1,1,1,1]): self.tint = tint verts = [-sx,-sy, sx,-sy, sx,sy, -sx,sy] texcoords0 = [0,0, 1,0, 1,1, 0,1] indices = [0,1,2, 0,2,3] self.vlist = pyglet.graphics.vertex_list_indexed( len(verts)/2, indices, ('v2f', verts), ('0t2f', texcoords0) ) | d577b28772a899c5afa4060c2068827fc6c6c0cd /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/4896/d577b28772a899c5afa4060c2068827fc6c6c0cd/sprite.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
2738,
972,
12,
2890,
16,
13280,
16,
1393,
16,
268,
474,
22850,
21,
16,
21,
16,
21,
16,
21,
65,
4672,
365,
18,
88,
474,
273,
268,
474,
225,
19853,
273,
23059,
30319,
16,
17,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
2738,
972,
12,
2890,
16,
13280,
16,
1393,
16,
268,
474,
22850,
21,
16,
21,
16,
21,
16,
21,
65,
4672,
365,
18,
88,
474,
273,
268,
474,
225,
19853,
273,
23059,
30319,
16,
17,
9... |
pass | pass | def badNameFilter(self, name, force = False): if not globalvar.filtBadName: return False #initialize blacklist if not hasattr(self, '_blacklist') or force: elenco = [ ' ano', ' anus', 'anal ', 'babies', 'baldracca', 'balle', 'bastardo', 'bestiali', 'bestiale', 'bastarda', 'b.i.t.c.h.', 'bitch', 'boobie', 'bordello', 'breast', 'cacata', 'cacca', 'cachapera', 'cagata', 'cane', 'cazz', 'cazzo', 'cazzata', 'chiavare', 'chiavata', 'chick', 'christ ', 'cristo', 'clitoride', 'coione', 'cojdioonear', 'cojones', 'cojo', 'coglione', 'coglioni', 'cornuto', 'cula', 'culatone', 'culattone', 'culo', 'deficiente', 'deficente', 'dio', 'die ', 'died ', 'ditalino', 'ejackulate', 'enculer', 'eroticunt', 'fanculo', 'fellatio', 'fica ', 'ficken', 'figa', 'sfiga', 'fottere', 'fotter', 'fottuto', 'fuck', 'f.u.c.k.', "funkyass", 'gay', 'hentai.com', 'horne', 'horney', 'virgin', 'hotties', 'idiot', '@alice.it', 'incest', 'jesus', 'gesu', 'gesù', 'kazzo', 'kill', 'leccaculo', 'lesbian', 'lesbica', 'lesbo', 'masturbazione', 'masturbare', 'masturbo', 'merda', 'merdata', 'merdoso', 'mignotta', 'minchia', 'minkia', 'minchione', 'mona', 'nudo', 'nuda', 'nudi', 'oral', 'sex', 'orgasmso', 'porc', 'pompa', 'pompino', 'porno', 'puttana', 'puzza', 'puzzone', "racchia", 'sborone', 'sborrone', 'sborata', 'sborolata', 'sboro', 'scopata', 'scopare', 'scroto', 'scrotum', 'sega', 'sesso', 'shit', 'shiz', 's.h.i.t.', 'sadomaso', 'sodomist', 'stronzata', 'stronzo', 'succhiamelo', 'succhiacazzi', 'testicol', 'troia', 'universetoday.net', 'vaffanculo', 'vagina', 'vibrator', "vacca", 'yiddiot', "zoccola", ] elenco_others = ['@', ".com", ".sex", ".org", ".uk", ".en", ".it", "admin", "administrator", "amministratore", '@yahoo.com', '@alice.com', "amministratrice", "burocrate", "checkuser", "developer", "http://", "jimbo", "mediawiki", "on wheals", "on wheal", "on wheel", "planante", "razinger", "sysop", "troll", "vandal", " v.f. ", "v. fighter", "vandal f.", "vandal fighter", 'wales jimmy', "wheels", "wales", "www.", ] #blacklist from wikipage badword_page = wikipedia.Page(self.site, wikipedia.translate(self.site, bad_pag) ) list_loaded = list() if badword_page.exists(): wikipedia.output(u'\nLoading the bad words list from %s...' % self.site ) list_loaded = load_word_function(badword_page.get()) else: showStatus(4) wikipedia.output(u'The bad word page doesn\'t exist!') self._blacklist = elenco + elenco_others + list_loaded del elenco, elenco_others, list_loaded if not hasattr(self, '_whitelist') or force: #initialize whitelist whitelist_default = ['emiliano'] wtlpg = wikipedia.translate(self.site, whitelist_pg) list_white = list() if wtlpg: whitelist_page = wikipedia.Page(self.site, wtlpg) if whitelist_page.exists(): wikipedia.output(u'\nLoading the whitelist from %s...' % self.site ) list_white = load_word_function(whitelist_page.get()) else: showStatus(4) wikipedia.output(u"The whitelist's page doesn't exist!") else: showStatus(4) wikipedia.output(u"WARNING: The whitelist hasn't been setted!") # Join the whitelist words. self._whitelist = list_white + whitelist_default del list_white, whitelist_default try: for bname in self._blacklist: if bname.lower() in str(name.lower()): #bad name positive self.bname = bname return True except UnicodeEncodeError: pass try: for wname in self._whitelist: if wname.lower() in str(name.lower()): name = name.replace(wname.lower(), '') for bname in self._blacklist: return bname.lower() in name.lower() except UnicodeEncodeError: pass return False | aea9db864f057bfad35a2a04b7ff04bb5f0b3e12 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/4404/aea9db864f057bfad35a2a04b7ff04bb5f0b3e12/welcome.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
5570,
461,
1586,
12,
2890,
16,
508,
16,
2944,
273,
1083,
4672,
309,
486,
2552,
1401,
18,
30991,
6434,
461,
30,
327,
1083,
225,
468,
11160,
11709,
309,
486,
3859,
12,
2890,
16,
2070,
22... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
5570,
461,
1586,
12,
2890,
16,
508,
16,
2944,
273,
1083,
4672,
309,
486,
2552,
1401,
18,
30991,
6434,
461,
30,
327,
1083,
225,
468,
11160,
11709,
309,
486,
3859,
12,
2890,
16,
2070,
22... |
elif len(components) == 1: return done[0] else: return Sum(tuple(done)) | for i in it: result = result + i return result | def sum(components): components = tuple(c for c in components if c) # flatten any potential sub-sums queue = list(components) done = [] while queue: item = queue.pop(0) if isinstance(item, Sum): queue += item.children else: done.append(item) if len(done) == 0: return 0 elif len(components) == 1: return done[0] else: return Sum(tuple(done)) | a33fa241cdc076132e5683058339e2b747fae123 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/12571/a33fa241cdc076132e5683058339e2b747fae123/primitives.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2142,
12,
8119,
4672,
4085,
273,
3193,
12,
71,
364,
276,
316,
4085,
309,
276,
13,
225,
468,
5341,
1281,
8555,
720,
17,
1364,
87,
2389,
273,
666,
12,
8119,
13,
2731,
273,
5378,
225,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2142,
12,
8119,
4672,
4085,
273,
3193,
12,
71,
364,
276,
316,
4085,
309,
276,
13,
225,
468,
5341,
1281,
8555,
720,
17,
1364,
87,
2389,
273,
666,
12,
8119,
13,
2731,
273,
5378,
225,
1... |
def init_html (self, source): "initializes a Tiddler from HTML source code" | def initHtml (self, source): """Initializes a Tiddler from HTML source code.""" | def init_html (self, source): "initializes a Tiddler from HTML source code" # title self.title = 'untitled passage' title_re = re.compile(r'tiddler="(.*?)"') title = title_re.search(source) if title: self.title = title.group(1) # tags self.tags = [] tags_re = re.compile(r'tags="(.*?)"') tags = tags_re.search(source) if tags and tags.group(1) != '': self.tags = tags.group(1).split(' ') # creation date self.created = time.localtime() created_re = re.compile(r'created="(.*?)"') created = created_re.search(source) if created: self.created = decode_date(created.group(1)) # modification date self.modified = time.localtime() modified_re = re.compile(r'modified="(.*?)"') modified = modified_re.search(source) if (modified): self.modified = decode_date(modified.group(1)) # body text self.text = '' text_re = re.compile(r'<div.*?>(.*)</div>') text = text_re.search(source) if (text): self.text = decode_text(text.group(1)) | 6c1969959d8e0961fa5075dac2f76e60b7f2c5fe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11433/6c1969959d8e0961fa5075dac2f76e60b7f2c5fe/tiddlywiki.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1208,
4353,
261,
2890,
16,
1084,
4672,
3536,
9685,
279,
399,
1873,
749,
628,
3982,
1084,
981,
12123,
225,
468,
2077,
225,
365,
18,
2649,
273,
296,
10032,
305,
1259,
1342,
410,
11,
2077,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1208,
4353,
261,
2890,
16,
1084,
4672,
3536,
9685,
279,
399,
1873,
749,
628,
3982,
1084,
981,
12123,
225,
468,
2077,
225,
365,
18,
2649,
273,
296,
10032,
305,
1259,
1342,
410,
11,
2077,
... |
name += '(%s)' % limit | if name == '`rev`': name += '(%s)' % 20 elif name == '`path`': name += '(%s)' % 255 elif name == '`change_type`': name += '(%s)' % 2 else: name += '(%s)' % limit | def _collist(self, table, columns): """Take a list of columns and impose limits on each so that indexing works properly. Some Versions of MySQL limit each index prefix to 500 bytes total, with a max of 255 bytes per column. """ cols = [] limit = 500 / len(columns) if limit > 255: limit = 255 for c in columns: name = '`%s`' % c table_col = filter((lambda x: x.name == c), table.columns) if len(table_col) == 1 and table_col[0].type.lower() == 'text': name += '(%s)' % limit # For non-text columns, we simply throw away the extra bytes. # That could certainly be optimized better, but for now let's KISS. cols.append(name) return ','.join(cols) | cff106b0e08e4f55aefea2824174b88c7f904858 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/2831/cff106b0e08e4f55aefea2824174b88c7f904858/mysql_backend.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
1293,
1098,
12,
2890,
16,
1014,
16,
2168,
4672,
3536,
13391,
279,
666,
434,
2168,
471,
709,
4150,
8181,
603,
1517,
1427,
716,
14403,
6330,
8214,
18,
225,
10548,
28375,
434,
13485,
1... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
1293,
1098,
12,
2890,
16,
1014,
16,
2168,
4672,
3536,
13391,
279,
666,
434,
2168,
471,
709,
4150,
8181,
603,
1517,
1427,
716,
14403,
6330,
8214,
18,
225,
10548,
28375,
434,
13485,
1... |
gz = gzip.GzipFile(fileobj=self.__member, mode='r') self.__tgz = tarfile.TarFile(fileobj=gz, mode='r') | name = self.__member.name if name.endswith('.gz'): gz = gzip.GzipFile(fileobj=self.__member, mode='r') self.__tgz = tarfile.TarFile(fileobj=gz, mode='r') elif name.endswith('.bz2'): self.__tgz = tarfile.open(fileobj=self.__member, mode='r:bz2') else: raise DebError("part '%s' has unexpected extension" % name) | def tgz(self): """Return a TarFile object corresponding to this part of a .deb package.""" | c1bccb8a81da832139931b12f33f201fb6399b30 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/12282/c1bccb8a81da832139931b12f33f201fb6399b30/debfile.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
268,
9764,
12,
2890,
4672,
3536,
990,
279,
20334,
812,
733,
4656,
358,
333,
1087,
434,
279,
263,
31888,
2181,
12123,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
268,
9764,
12,
2890,
4672,
3536,
990,
279,
20334,
812,
733,
4656,
358,
333,
1087,
434,
279,
263,
31888,
2181,
12123,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
print 'Check move parent' | def check_move(self, cr, uid, ids, context=None): print 'Check move' for procurement in self.browse(cr, uid, ids): for line in procurement.product_id.flow_pull_ids: if line.location_id==procurement.location_id: if not line.location_src_id: self.write(cr, uid, procurement.id, {'message': _('No source location defined to generate the picking !')}) return (line.type_proc=='move') and (line.location_src_id) print 'Check move parent' return False | 08d47ef29ff511841dc03781ea6d891a014b3d39 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7339/08d47ef29ff511841dc03781ea6d891a014b3d39/mrp_pull.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
866,
67,
8501,
12,
2890,
16,
4422,
16,
4555,
16,
3258,
16,
819,
33,
7036,
4672,
1172,
296,
1564,
3635,
11,
364,
5418,
594,
475,
316,
365,
18,
25731,
12,
3353,
16,
4555,
16,
3258,
467... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
866,
67,
8501,
12,
2890,
16,
4422,
16,
4555,
16,
3258,
16,
819,
33,
7036,
4672,
1172,
296,
1564,
3635,
11,
364,
5418,
594,
475,
316,
365,
18,
25731,
12,
3353,
16,
4555,
16,
3258,
467... | |
fields = ('wbNumber','siNo','numberUnitsLoaded','numberUnitsGood','numberUnitsLost','numberUnitsDamaged','unitsLostReason','unitsDamagedReason','unitsDamagedType','unitsLostType','overloadedUnits') | fields = ('wbNumber','siNo','numberUnitsGood','numberUnitsLost','numberUnitsDamaged','unitsLostReason','unitsDamagedReason','unitsDamagedType','unitsLostType','overloadedUnits') | def waybill_reception(request,wb_code): # get the LTI info profile = '' try: profile=request.user.get_profile() except: pass current_wb = Waybill.objects.get(id=wb_code) current_lti = current_wb.ltiNumber class LoadingDetailRecForm(ModelForm): siNo= ModelChoiceField(queryset=ltioriginal.objects.filter(CODE = current_lti),label='Commodity',) #siNo= forms.CharField(widget=forms.HiddenInput()) numberUnitsLoaded= forms.CharField(widget=forms.HiddenInput()) numberUnitsGood= forms.CharField(widget=forms.TextInput(attrs={'size':'5'}),required=False) numberUnitsLost= forms.CharField(widget=forms.TextInput(attrs={'size':'5'}),required=False) numberUnitsDamaged= forms.CharField(widget=forms.TextInput(attrs={'size':'5'}),required=False) class Meta: model = LoadingDetail fields = ('wbNumber','siNo','numberUnitsLoaded','numberUnitsGood','numberUnitsLost','numberUnitsDamaged','unitsLostReason','unitsDamagedReason','unitsDamagedType','unitsLostType','overloadedUnits') LDFormSet = inlineformset_factory(Waybill, LoadingDetail,LoadingDetailRecForm,fk_name="wbNumber", extra=0) if request.method == 'POST': form = WaybillRecieptForm(request.POST,instance=current_wb) formset = LDFormSet(request.POST,instance=current_wb) if form.is_valid() and formset.is_valid(): form.recipientTitle = profile.compasUser.title form.recipientName= profile.compasUser.person_pk wb_new = form.save() wb_new.recipientTitle = profile.compasUser.title wb_new.recipientName= profile.compasUser.person_pk wb_new.save() instances =formset.save() return HttpResponseRedirect('../viewwb_reception/'+ str(current_wb.id)) # else: if current_wb.recipientArrivalDate: form = WaybillRecieptForm(instance=current_wb) form.recipientTitle = profile.compasUser.title form.recipientName= profile.compasUser.last_name + ', ' +profile.compasUser.first_name else: form = WaybillRecieptForm(instance=current_wb, initial={ 'recipientArrivalDate':datetime.date.today(), 'recipientStartDischargeDate':datetime.date.today(), 'recipientEndDischargeDate':datetime.date.today(), 'recipientName': profile.compasUser.last_name + ', ' +profile.compasUser.first_name, 'recipientTitle': profile.compasUser.title, } ) formset = LDFormSet(instance=current_wb) return render_to_response('recieveWaybill.html', {'form': form,'lti_list':current_lti,'formset':formset,'profile':profile}, context_instance=RequestContext(request)) | 3221cdf289d9780b17ca471374f99593b06f4927 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12559/3221cdf289d9780b17ca471374f99593b06f4927/views.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
4031,
17240,
67,
266,
472,
12,
2293,
16,
9464,
67,
710,
4672,
468,
336,
326,
11807,
45,
1123,
3042,
273,
875,
775,
30,
3042,
33,
2293,
18,
1355,
18,
588,
67,
5040,
1435,
1335,
30,
13... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
4031,
17240,
67,
266,
472,
12,
2293,
16,
9464,
67,
710,
4672,
468,
336,
326,
11807,
45,
1123,
3042,
273,
875,
775,
30,
3042,
33,
2293,
18,
1355,
18,
588,
67,
5040,
1435,
1335,
30,
13... |
self.__bad_macro_chars = re.compile(r'-_]') | self.__bad_macro_chars = re.compile(r'[-_]') | def __init__(self, universe, executable): """ universe = the condor universe to run the job in. executable = the executable to run in the DAG. """ CondorJob.__init__(self, universe, executable, 1) self.__notifcation = 'never' self.__var_args = [] self.__bad_macro_chars = re.compile(r'-_]') | cd714dfb2e4db32e3b041e6fb112ff40a19dca07 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3589/cd714dfb2e4db32e3b041e6fb112ff40a19dca07/pipeline.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
2738,
972,
12,
2890,
16,
29235,
16,
9070,
4672,
3536,
29235,
273,
326,
6941,
280,
29235,
358,
1086,
326,
1719,
316,
18,
9070,
273,
326,
9070,
358,
1086,
316,
326,
463,
1781,
18,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
2738,
972,
12,
2890,
16,
29235,
16,
9070,
4672,
3536,
29235,
273,
326,
6941,
280,
29235,
358,
1086,
326,
1719,
316,
18,
9070,
273,
326,
9070,
358,
1086,
316,
326,
463,
1781,
18,
... |
session.execute(update(PackageListingTable, values={PackageListingTable.c.statuscode:20})) | engine.execute("UPDATE packagelisting SET statuscode=14 WHERE owner='orphan'") | def transform(relation, table, attribute): ''' Transforms userids into usernames table - pkgdb.model attribute - string 'owner' or 'userid' ''' print 'transforming ' + relation.__name__ for id, owner in zip(select([relation.id]).execute(), select([getattr(relation, attribute)]).execute()): ownername = people[int(owner[0])]['username'] table.update('id=%s' % id[0], values={attribute:ownername}).execute() print 'flushing ' + relation.__name__ session.flush() | f8da11248bff1618d73709bab80ecff38b48dffa /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/9953/f8da11248bff1618d73709bab80ecff38b48dffa/pkgdb-0.3.10-0.3.11.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2510,
12,
5488,
16,
1014,
16,
1566,
4672,
9163,
2604,
9741,
31892,
1368,
27675,
225,
1014,
300,
3475,
1966,
18,
2284,
1566,
300,
533,
296,
8443,
11,
578,
296,
8339,
11,
9163,
1172,
296,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2510,
12,
5488,
16,
1014,
16,
1566,
4672,
9163,
2604,
9741,
31892,
1368,
27675,
225,
1014,
300,
3475,
1966,
18,
2284,
1566,
300,
533,
296,
8443,
11,
578,
296,
8339,
11,
9163,
1172,
296,
... |
print "expanded = ",expanded return expanded | for key in self.cmds.keys(): cmd = self.cmds[key] pid = os.fork() if not pid: os.execvp(cmd[0], cmd) os.wait()[0] | def expandPolicies(self, pipelinePolicies): expanded = [] totalCount = 1 for policy in pipelinePolicies: # default to 1, if runCount doesn't exist runCount = 1 if policy.exists("runCount"): runCount = policy.get("runCount") for i in range(0,runCount): print "policy name = %s dot %d" % (policy.get("shortName"), i+1) expanded.append((policy,i+1, totalCount)) totalCount = totalCount + 1 | 534d03e07aa0f958c0c01cda65fd8f47273bd317 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6549/534d03e07aa0f958c0c01cda65fd8f47273bd317/MultiPipelineWorkflowLauncher.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
4542,
8825,
12,
2890,
16,
5873,
8825,
4672,
8406,
273,
5378,
20578,
273,
404,
364,
3329,
316,
5873,
8825,
30,
468,
805,
358,
404,
16,
309,
1086,
1380,
3302,
1404,
1005,
1086,
1380,
273,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
4542,
8825,
12,
2890,
16,
5873,
8825,
4672,
8406,
273,
5378,
20578,
273,
404,
364,
3329,
316,
5873,
8825,
30,
468,
805,
358,
404,
16,
309,
1086,
1380,
3302,
1404,
1005,
1086,
1380,
273,
... |
self._url_entry.insert(0, opts.get('pkg_url', '')) | if opts.get('pkg_url'): self._url_entry.insert(0, opts['pkg_url']) | def open(self, prjfile): self._filename = prjfile if 1:#try: opts = load(open(prjfile, 'r')) self._name_entry.delete(0, 'end') self._name_entry.insert(0, opts.get('pkg_name', '')) self._url_entry.delete(0, 'end') self._url_entry.insert(0, opts.get('pkg_url', '')) self._out_entry.delete(0, 'end') self._out_entry.insert(0, opts.get('outdir', '')) self._css_entry.delete(0, 'end') if opts.get('css', 'default') in STYLESHEETS.keys(): self._css_var.set(opts.get('css', 'default')) else: self._css_var.set('-other-') self._css_entry.insert(0, opts.get('css', 'default')) for (file, name) in opts.get('modules', []): if not self.add_module(file, 0): self.add_module(name, 0) #except: # self._top.bell() | f425610d16e8429d13cc4252fa20dcd11fbfd312 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11420/f425610d16e8429d13cc4252fa20dcd11fbfd312/gui.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1696,
12,
2890,
16,
27378,
768,
4672,
365,
6315,
3459,
273,
27378,
768,
309,
404,
27363,
698,
30,
1500,
273,
1262,
12,
3190,
12,
683,
78,
768,
16,
296,
86,
26112,
365,
6315,
529,
67,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1696,
12,
2890,
16,
27378,
768,
4672,
365,
6315,
3459,
273,
27378,
768,
309,
404,
27363,
698,
30,
1500,
273,
1262,
12,
3190,
12,
683,
78,
768,
16,
296,
86,
26112,
365,
6315,
529,
67,
... |
def _value(self): if self._renderedValueSet(): value = self._data else: tokens = self.request.form.get(self.name) for name, queryview in self.queryviews: if name+'.apply' in self.request: newtokens = self.request.form.get(name+'.selection') if newtokens: if tokens: tokens = tokens + newtokens else: tokens = newtokens if tokens: remove = self.request.form.get(self.name+'.checked') if remove and (self.name+'.remove' in self.request): tokens = [token for token in tokens if token not in remove ] | def _input_value(self): tokens = self.request.form.get(self.name) for name, queryview in self.queryviews: if name+'.apply' in self.request: newtokens = self.request.form.get(name+'.selection') if newtokens: if tokens: tokens = tokens + newtokens else: tokens = newtokens if tokens: remove = self.request.form.get(self.name+'.checked') if remove and (self.name+'.remove' in self.request): tokens = [token for token in tokens if token not in remove ] value = [] for token in tokens: try: v = self.terms.getValue(str(token)) except LookupError: pass else: value.append(v) else: if self.name+'.displayed' in self.request: | def _value(self): if self._renderedValueSet(): value = self._data else: tokens = self.request.form.get(self.name) for name, queryview in self.queryviews: if name+'.apply' in self.request: newtokens = self.request.form.get(name+'.selection') if newtokens: if tokens: tokens = tokens + newtokens else: tokens = newtokens if tokens: remove = self.request.form.get(self.name+'.checked') if remove and (self.name+'.remove' in self.request): tokens = [token for token in tokens if token not in remove ] value = [] for token in tokens: try: v = self.terms.getValue(str(token)) except LookupError: pass # skip invalid tokens (shrug) else: value.append(v) else: value = self.context.missing_value | 859b5f8d35d97a1a7aaf7870bbd8c0ce5e0b1da9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9530/859b5f8d35d97a1a7aaf7870bbd8c0ce5e0b1da9/source.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
2630,
67,
1132,
12,
2890,
4672,
2430,
273,
365,
18,
2293,
18,
687,
18,
588,
12,
2890,
18,
529,
13,
364,
508,
16,
843,
1945,
316,
365,
18,
2271,
7061,
30,
309,
508,
6797,
18,
9... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
389,
2630,
67,
1132,
12,
2890,
4672,
2430,
273,
365,
18,
2293,
18,
687,
18,
588,
12,
2890,
18,
529,
13,
364,
508,
16,
843,
1945,
316,
365,
18,
2271,
7061,
30,
309,
508,
6797,
18,
9... |
"""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. | 577e004d95c9196437c824fbb55b80e4410b47a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3187/577e004d95c9196437c824fbb55b80e4410b47a7/cgi.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1221,
67,
768,
12,
2890,
16,
3112,
33,
7036,
4672,
3536,
22042,
27621,
30,
327,
279,
7471,
473,
9691,
585,
18,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1221,
67,
768,
12,
2890,
16,
3112,
33,
7036,
4672,
3536,
22042,
27621,
30,
327,
279,
7471,
473,
9691,
585,
18,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
except (IOError, OSError): info('failed to remove file %s' % path) | except IOError, (errno, detail): info('failed to remove file %s: %s' % (path, detail)) except OSError, detail: info('failed to remove file %s: %s' % (path, detail)) | def run (self): """Remove files.""" print UNINSTALL_WARNING response = raw_input('Continue [y/N]? ') if response.lower() != 'y': return | 81889475a41d52b6cb1972ded80f1bb6d56539d3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12852/81889475a41d52b6cb1972ded80f1bb6d56539d3/setup.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1086,
261,
2890,
4672,
3536,
3288,
1390,
12123,
225,
1172,
5019,
28865,
67,
9511,
766,
273,
1831,
67,
2630,
2668,
12378,
306,
93,
19,
50,
26717,
8624,
309,
766,
18,
8167,
1435,
480,
296,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1086,
261,
2890,
4672,
3536,
3288,
1390,
12123,
225,
1172,
5019,
28865,
67,
9511,
766,
273,
1831,
67,
2630,
2668,
12378,
306,
93,
19,
50,
26717,
8624,
309,
766,
18,
8167,
1435,
480,
296,... |
self.assertEqual(self.cur.execute("insert into users \ | self.assertEqual(self.cur.execute("insert into users (userid, username) \ | def test_insert_select(self, userid='Frank', username='Frank Millman'): self.assertEqual(self.cur.execute("insert into users \ values (?,?)", [userid, username]),1) self.assertEqual(self.cur.execute("select * from users \ where userid = ?", [userid.lower()]),0) self.assertEqual(self.cur.execute("select * from users \ where username = ?", [username.lower()]),0) | e38ee95c8b8a0d1ad4366089679e20d6587ced57 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/677/e38ee95c8b8a0d1ad4366089679e20d6587ced57/test_odbc.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
67,
6387,
67,
4025,
12,
2890,
16,
6709,
2218,
7167,
2304,
2187,
2718,
2218,
7167,
2304,
490,
737,
4728,
11,
4672,
365,
18,
11231,
5812,
12,
2890,
18,
1397,
18,
8837,
2932,
6387,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1842,
67,
6387,
67,
4025,
12,
2890,
16,
6709,
2218,
7167,
2304,
2187,
2718,
2218,
7167,
2304,
490,
737,
4728,
11,
4672,
365,
18,
11231,
5812,
12,
2890,
18,
1397,
18,
8837,
2932,
6387,
... |
vList.append(Violation(self, line.number)) | vList.append(Violation(self, line)) | def apply(self, lines): vList = [] | cb6d1c1b9da3a15f55b42e7ffc55f274aee325d2 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6529/cb6d1c1b9da3a15f55b42e7ffc55f274aee325d2/style.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2230,
12,
2890,
16,
2362,
4672,
331,
682,
273,
5378,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
2230,
12,
2890,
16,
2362,
4672,
331,
682,
273,
5378,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
... |
use_statcache -- Do not stat() each file directly: go through the statcache module for more efficiency. | use_statcache -- obsolete argument. | def cmp(f1, f2, shallow=1, use_statcache=0): """Compare two files. Arguments: f1 -- First file name f2 -- Second file name shallow -- Just check stat signature (do not read the files). defaults to 1. use_statcache -- Do not stat() each file directly: go through the statcache module for more efficiency. Return value: True if the files are the same, False otherwise. This function uses a cache for past comparisons and the results, with a cache invalidation mechanism relying on stale signatures. Of course, if 'use_statcache' is true, this mechanism is defeated, and the cache will never grow stale. """ if use_statcache: stat_function = statcache.stat else: stat_function = os.stat s1 = _sig(stat_function(f1)) s2 = _sig(stat_function(f2)) if s1[0] != stat.S_IFREG or s2[0] != stat.S_IFREG: return False if shallow and s1 == s2: return True if s1[1] != s2[1]: return False result = _cache.get((f1, f2)) if result and (s1, s2) == result[:2]: return result[2] outcome = _do_cmp(f1, f2) _cache[f1, f2] = s1, s2, outcome return outcome | 5431895243cb65d1e342bf9e2509299153917607 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5431895243cb65d1e342bf9e2509299153917607/filecmp.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
9411,
12,
74,
21,
16,
284,
22,
16,
18501,
33,
21,
16,
999,
67,
5642,
2493,
33,
20,
4672,
3536,
8583,
2795,
1390,
18,
225,
13599,
30,
225,
284,
21,
1493,
5783,
585,
508,
225,
284,
2... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
9411,
12,
74,
21,
16,
284,
22,
16,
18501,
33,
21,
16,
999,
67,
5642,
2493,
33,
20,
4672,
3536,
8583,
2795,
1390,
18,
225,
13599,
30,
225,
284,
21,
1493,
5783,
585,
508,
225,
284,
2... |
tamseq=end-start global compone global lccsal | tamseq=len(seq) seq=seq.upper() | def lcc_mult(seq,wsize,start,end): """Return a list called lccsal, the LCC, a complexity measure | 3d45bf521c4adc9e7c82272c7e26271842ba064f /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/7167/3d45bf521c4adc9e7c82272c7e26271842ba064f/lcc.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
328,
952,
67,
5421,
12,
5436,
16,
91,
1467,
16,
1937,
16,
409,
4672,
3536,
990,
279,
666,
2566,
328,
952,
21982,
16,
326,
511,
6743,
16,
279,
21610,
6649,
2,
0,
0,
0,
0,
0,
0,
0,... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
328,
952,
67,
5421,
12,
5436,
16,
91,
1467,
16,
1937,
16,
409,
4672,
3536,
990,
279,
666,
2566,
328,
952,
21982,
16,
326,
511,
6743,
16,
279,
21610,
6649,
2,
-100,
-100,
-100,
-100,
... |
if ( self.getTag( pxl_tags_dict['sint32'] ) ): | new_tag = unpack('B', self.data[self.index])[0] if ( new_tag == pxl_tags_dict['sint32'] ): self.index = self.index + 1 | def Tag_sint32(self): if ( self.getTag( pxl_tags_dict['sint32'] ) ): print "sint32", self.unpack_string = 'l' self.size_of_element = 4 return 1 return 0 | 56f3b40c49b4c8c2c1bf30f153b578ada70886f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/675/56f3b40c49b4c8c2c1bf30f153b578ada70886f5/pxldis.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
4034,
67,
87,
474,
1578,
12,
2890,
4672,
394,
67,
2692,
273,
6167,
2668,
38,
2187,
365,
18,
892,
63,
2890,
18,
1615,
5717,
63,
20,
65,
225,
309,
261,
394,
67,
2692,
422,
10318,
80,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
4034,
67,
87,
474,
1578,
12,
2890,
4672,
394,
67,
2692,
273,
6167,
2668,
38,
2187,
365,
18,
892,
63,
2890,
18,
1615,
5717,
63,
20,
65,
225,
309,
261,
394,
67,
2692,
422,
10318,
80,
... |
def __getPilotOptions(self,queue,pilotsToSubmit): | def __getPilotOptions( self, queue, pilotsToSubmit ): | def __getPilotOptions(self,queue,pilotsToSubmit): """ Prepare pilot options """ queueDict = self.queueDict[queue]['ParametersDict'] vo = gConfig.getValue( "/DIRAC/VirtualOrganization", "unknown" ) if vo == 'unknown': self.log.error('Virtual Organization is not defined in the configuration') return None pilotOptions = [ "-V '%s'" % vo ] setup = gConfig.getValue( "/DIRAC/Setup", "unknown" ) if setup == 'unknown': self.log.error('Setup is not defined in the configuration') return None pilotOptions.append( '-S %s' % setup ) diracVersion = gConfig.getValue( "/Operations/%s/%s/Versions/PilotVersion" % (vo,setup), "unknown" ) if diracVersion == 'unknown': self.log.error('PilotVersion is not defined in the configuration') return None pilotOptions.append( '-r %s' % diracVersion ) ownerDN = self.genericPilotDN ownerGroup = self.genericPilotGroup result = gProxyManager.requestToken( ownerDN, ownerGroup, pilotsToSubmit*5 ) if not result[ 'OK' ]: self.log.error( ERROR_TOKEN, result['Message'] ) return S_ERROR( ERROR_TOKEN ) ( token, numberOfUses ) = result[ 'Value' ] pilotOptions.append( '-o /Security/ProxyToken=%s' % token ) # Use Filling mode pilotOptions.append( '-M %s' % 5 ) | fecf3d418a4e3a08002c58982e809e7e4b152546 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12864/fecf3d418a4e3a08002c58982e809e7e4b152546/SiteDirector.py | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
588,
52,
22797,
1320,
12,
365,
16,
2389,
16,
24970,
6968,
774,
11620,
262,
30,
3536,
7730,
293,
22797,
702,
3536,
225,
2389,
5014,
273,
365,
18,
4000,
5014,
63,
4000,
23962,
2402,
... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
1,
8585,
326,
22398,
316,
326,
981,
30,
1652,
1001,
588,
52,
22797,
1320,
12,
365,
16,
2389,
16,
24970,
6968,
774,
11620,
262,
30,
3536,
7730,
293,
22797,
702,
3536,
225,
2389,
5014,
273,
365,
18,
4000,
5014,
63,
4000,
23962,
2402,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.