Skip to content

Commit

Permalink
Use next() built-in
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvaandering committed Oct 21, 2015
1 parent e09f3bf commit e22f459
Show file tree
Hide file tree
Showing 43 changed files with 943 additions and 943 deletions.
4 changes: 2 additions & 2 deletions Alignment/MuonAlignment/python/geometryCSVtoXML.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from re import split, sub

# Skip the first two lines (headers)
stdin.next()
stdin.next()
next(stdin)
next(stdin)

print "<MuonAlignment>"
print ""
Expand Down
1,510 changes: 755 additions & 755 deletions Alignment/MuonAlignment/python/svgfig.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions CondCore/TagCollection/python/CommonUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def tagInTrees(dbsession,tagname,pfn=''):
invquery.addToOutputList('pfn')
cursor = invquery.execute()
tagidmap={}
while ( cursor.next() ):
while ( next(cursor) ):
tagid=cursor.currentRow()['tagid'].data()
pfn=cursor.currentRow()['pfn'].data()
tagidmap[pfn]=tagid
Expand Down Expand Up @@ -76,7 +76,7 @@ def tagInTrees(dbsession,tagname,pfn=''):
q.defineOutput(myresult)
q.setCondition(condition,conditionBind)
cr=q.execute()
while (cr.next()):
while (next(cr)):
if cr.currentRow()['count'].data()!=0:
result[pfn].append(t[len('TAGTREE_TABLE_'):])
cr.close()
Expand Down
14 changes: 7 additions & 7 deletions CondCore/TagCollection/python/DBCopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def copyInventory( self ):
source_query.defineOutput(data)
bulkOperation=my_editor.bulkInsert(data,self.__rowcachesize)
cursor=source_query.execute()
while (cursor.next() ):
while (next(cursor) ):
bulkOperation.processNextIteration()
bulkOperation.flush()
del bulkOperation
Expand All @@ -48,7 +48,7 @@ def copyInventory( self ):
source_query.defineOutput(iddata)
bulkOperation=my_ideditor.bulkInsert(iddata,self.__rowcachesize)
cursor=source_query.execute()
while cursor.next():
while next(cursor):
bulkOperation.processNextIteration()
bulkOperation.flush()
del bulkOperation
Expand All @@ -68,7 +68,7 @@ def copyInventory( self ):
source_query.defineOutput(commentdata)
bulkOperation=my_commenteditor.bulkInsert(commentdata,self.__rowcachesize)
cursor=source_query.execute()
while cursor.next():
while next(cursor):
bulkOperation.processNextIteration()
bulkOperation.flush()
del bulkOperation
Expand Down Expand Up @@ -130,7 +130,7 @@ def copyTrees( self, treenames ):
source_query.defineOutput(data)
bulkOperation=dest_editor.bulkInsert(data,self.__rowcachesize)
cursor=source_query.execute()
while cursor.next():
while next(cursor):
bulkOperation.processNextIteration()
bulkOperation.flush()
del bulkOperation
Expand All @@ -146,7 +146,7 @@ def copyTrees( self, treenames ):
source_query.defineOutput(iddata)
bulkOperation=dest_editor.bulkInsert(iddata,self.__rowcachesize)
cursor=source_query.execute()
while cursor.next():
while next(cursor):
bulkOperation.processNextIteration()
bulkOperation.flush()
del bulkOperation
Expand All @@ -165,7 +165,7 @@ def copyTrees( self, treenames ):
source_query.defineOutput(data)
bulkOperation=dest_editor.bulkInsert(data,self.__rowcachesize)
cursor=source_query.execute()
while cursor.next():
while next(cursor):
bulkOperation.processNextIteration()
bulkOperation.flush()
del bulkOperation
Expand Down Expand Up @@ -248,7 +248,7 @@ def copyDB( self ):
source_query.defineOutput(data)
bulkOperation=my_editor.bulkInsert(data,self.__rowcachesize)
cursor=source_query.execute()
while cursor.next():
while next(cursor):
bulkOperation.processNextIteration()
bulkOperation.flush()
del bulkOperation
Expand Down
2 changes: 1 addition & 1 deletion CondCore/TagCollection/python/DBImpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def existRow( self, tableName, condition, conditionbindDict):
query.setCondition(condition,conditionbindDict)
cursor = query.execute()
result=False
while ( cursor.next() ):
while ( next(cursor) ):
result=True
cursor.close()
del query
Expand Down
4 changes: 2 additions & 2 deletions CondCore/TagCollection/python/IdGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def getNewID( self, IDtableName):
query.setForUpdate() #lock it
cursor = query.execute()
result = 0
while ( cursor.next() ):
while ( next(cursor) ):
result = cursor.currentRow()[self.__idTableColumnName].data()
del query
return result
Expand All @@ -35,7 +35,7 @@ def incrementNextID( self, IDtableName ):
query.setForUpdate() #lock it
cursor = query.execute()
result = 0
while ( cursor.next() ):
while ( next(cursor) ):
result = cursor.currentRow()[0].data()
del query
dataEditor = tableHandle.dataEditor()
Expand Down
16 changes: 8 additions & 8 deletions CondCore/TagCollection/python/TagTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def renameNodes( self, nodenamemap):
query = schema.tableHandle(self.__tagTreeTableName).newQuery()
query.addToOutputList('nodelabel')
cursor = query.execute()
while ( cursor.next() ):
while ( next(cursor) ):
nodelabel=cursor.currentRow()['nodelabel'].data()
if nodenamemap.has_key(nodelabel):
allnodes[nodelabel]=nodenamemap[nodelabel]
Expand Down Expand Up @@ -257,7 +257,7 @@ def getNodeById( self, nodeid ):
conditionData['nodeid'].setData(nodeid)
query.setCondition( condition, conditionData)
cursor = query.execute()
while ( cursor.next() ):
while ( next(cursor) ):
result.tagid=cursor.currentRow()['tagid'].data()
result.nodeid=cursor.currentRow()['nodeid'].data()
result.nodelabel=cursor.currentRow()['nodelabel'].data()
Expand Down Expand Up @@ -294,7 +294,7 @@ def getNode( self, label='ROOT' ):
query.setCondition( condition, conditionData)
conditionData['nodelabel'].setData(label)
cursor = query.execute()
while ( cursor.next() ):
while ( next(cursor) ):
result.tagid=cursor.currentRow()['tagid'].data()
result.nodeid=cursor.currentRow()['nodeid'].data()
result.nodelabel=cursor.currentRow()['nodelabel'].data()
Expand Down Expand Up @@ -339,7 +339,7 @@ def getPath( self, label ):
query.setCondition( condition, conditionData)
query.addToOrderList( 'lft' )
cursor = query.execute()
while ( cursor.next() ):
while ( next(cursor) ):
resultNodeLabel = cursor.currentRow()['nodelabel'].data()
result.append( resultNodeLabel )
transaction.commit()
Expand All @@ -366,7 +366,7 @@ def getAllLeaves( self ):
conditionData = coral.AttributeList()
query.setCondition( condition, conditionData)
cursor = query.execute()
while ( cursor.next() ):
while ( next(cursor) ):
resultNode=Node.Node()
resultNode.tagid=cursor.currentRow()['tagid'].data()
resultNode.nodeid=cursor.currentRow()['nodeid'].data()
Expand Down Expand Up @@ -404,7 +404,7 @@ def getSubtree( self, label='ROOT' ):
for columnName in self.__tagTreeTableColumns:
query.addToOutputList(columnName)
cursor = query.execute()
while ( cursor.next() ):
while ( next(cursor) ):
resultNode=Node.Node()
resultNode.tagid=cursor.currentRow()['tagid'].data()
resultNode.nodeid=cursor.currentRow()['nodeid'].data()
Expand Down Expand Up @@ -437,7 +437,7 @@ def getSubtree( self, label='ROOT' ):
conditionData['nodelabel'].setData(label)
query.setCondition( condition, conditionData)
cursor = query.execute()
while ( cursor.next() ):
while ( next(cursor) ):
resultNode=Node.Node()
resultNode.tagid=cursor.currentRow()['p1.tagid'].data()
resultNode.nodeid=cursor.currentRow()['p1.nodeid'].data()
Expand Down Expand Up @@ -474,7 +474,7 @@ def nChildren( self, label='ROOT' ):
mycounts.extend('ct', 'unsigned long');
query.defineOutput( mycounts );
cursor = query.execute();
while ( cursor.next() ):
while ( next(cursor) ):
n= cursor.currentRow()['ct'].data()
transaction.commit()
del query
Expand Down
4 changes: 2 additions & 2 deletions CondCore/TagCollection/python/entryComment.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def getCommentForId( self, tableName, entryid ):
query.addToOutputList('comment')
query.setCondition(condition,conditionbindDict)
cursor=query.execute()
if cursor.next():
if next(cursor):
comment=cursor.currentRow()['comment'].data()
cursor.close()
transaction.commit()
Expand Down Expand Up @@ -124,7 +124,7 @@ def getCommentsForTable( self, tableName ):
query.addToOutputList('comment')
query.setCondition(condition,conditionbindDict)
cursor=query.execute()
while cursor.next():
while next(cursor):
comment=cursor.currentRow()['comment'].data()
entryid=cursor.currentRow()['entryid'].data()
result.append((entryid,comment))
Expand Down
16 changes: 8 additions & 8 deletions CondCore/TagCollection/python/tagInventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def addEntry( self, leafNode ):
query.setCondition(condition,conditionbindDict)
#duplicate=dbop.existRow(self.__tagInventoryTableName,condition,conditionbindDict)
cursor=query.execute()
while( cursor.next() ):
while( next(cursor) ):
duplicate=True
tagid=cursor.currentRow()['tagid'].data()
cursor.close()
Expand Down Expand Up @@ -132,7 +132,7 @@ def addEntriesReplaceService( self, newservicename ):
for columnName in self.__tagInventoryTableColumns:
query.addToOutputList(columnName)
cursor=query.execute()
while cursor.next():
while next(cursor):
tagid=cursor.currentRow()['tagid'].data()
tagname=cursor.currentRow()['tagname'].data()
pfn=cursor.currentRow()['pfn'].data()
Expand Down Expand Up @@ -182,7 +182,7 @@ def modifyEntriesReplaceService( self, newservicename ):
query = self.__session.nominalSchema().tableHandle(self.__tagInventoryTableName).newQuery()
query.addToOutputList('pfn')
cursor=query.execute()
while cursor.next():
while next(cursor):
pfn=cursor.currentRow()['pfn'].data()
allpfns.append(pfn)
transaction.commit()
Expand Down Expand Up @@ -264,7 +264,7 @@ def getEntryByName( self, tagName, pfn ):
query.setCondition(condition,conditionData)
cursor = query.execute()
counter=0
while ( cursor.next() ):
while ( next(cursor) ):
if counter > 0 :
raise ValueError, "tagName "+tagName+" is not unique, please further specify parameter pfn"
counter+=1
Expand Down Expand Up @@ -298,7 +298,7 @@ def getEntryById( self, tagId ):
conditionData['tagid'].setData(tagId)
query.setCondition( condition, conditionData)
cursor = query.execute()
while ( cursor.next() ):
while ( next(cursor) ):
#print 'got it'
leafnode.tagid=cursor.currentRow()['tagid'].data()
leafnode.tagname=cursor.currentRow()['tagname'].data()
Expand All @@ -324,7 +324,7 @@ def getAllEntries( self ):
for columnName in self.__tagInventoryTableColumns:
query.addToOutputList(columnName)
cursor = query.execute()
while ( cursor.next() ):
while ( next(cursor) ):
leafnode = Node.LeafNode()
leafnode.tagid=cursor.currentRow()['tagid'].data()
leafnode.tagname=cursor.currentRow()['tagname'].data()
Expand Down Expand Up @@ -354,7 +354,7 @@ def getIDsByName( self, name ):
query.addToOutputList(tagid)
query.setCondition(condition,conditionBindData)
cursor = query.execute()
while ( cursor.next() ):
while ( next(cursor) ):
tagid=cursor.currentRow()['tagid'].data()
ids.append(tagid)
transaction.commit()
Expand Down Expand Up @@ -442,7 +442,7 @@ def bulkInsertEntries( self, entries ):
query.setForUpdate()
cursor = query.execute()
nextid=0
while cursor.next():
while next(cursor):
nextid=cursor.currentRow()[0].data()
idEditor = self.__session.nominalSchema().tableHandle(self.__tagInventoryIDName).dataEditor()
inputData = coral.AttributeList()
Expand Down
2 changes: 1 addition & 1 deletion CondCore/TagCollection/test/testlonglong.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
query.setCondition( condition, conditionData)
conditionData['nodelabel'].setData('testtest')
cursor = query.execute()
while ( cursor.next() ):
while ( next(cursor) ):
tagid=cursor.currentRow()['tagid'].data()
print 'tagid',tagid
nodeid=cursor.currentRow()['nodeid'].data()
Expand Down
2 changes: 1 addition & 1 deletion CondCore/Utilities/python/generateWrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def guessPackage() :
lines = ( line for line in file('src/plugin.cc')
if (line.find('CondFormats')>0 and line.find('DataRecord')<0)
)
_f = lines.next()
_f = next(lines)
_f = _f[_f.find('CondFormats/')+len('CondFormats/'):]
return _f[:_f.find('/')]

Expand Down
4 changes: 2 additions & 2 deletions DQM/Integration/scripts/filecollector/commonAnTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def prettyPrintUnits(value,unit,decimals=0):
it=iter(units)
v=long(value/1024)
p=0
runit=it.next()
runit=next(it)
while v > 0:
v=long(v/1024)
try:
runit=it.next()
runit=next(it)
p+=1
except:
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def _findAll(self, name, attrs, text, limit, generator, **kwargs):
g = generator()
while True:
try:
i = g.next()
i = next(g)
except StopIteration:
break
if i:
Expand Down
2 changes: 1 addition & 1 deletion FWCore/GuiBrowsers/python/Vispa/Gui/FindDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def findNext(self):
self._findPreviousButton.show()
self._findNextButton.setText("&Next")
else:
object=self._findAlgorithm.next()
object=next(self._findAlgorithm)
self._updateNumberLabel()
self.emit(SIGNAL("found"),object)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def next(self):
""" Calls next() function of current tab controller.
"""
try:
self.application().currentTabController().next()
next(self.application().currentTabController())
except NoCurrentTabControllerException:
logging.warning(self.__class__.__name__ + ": next() - No tab controller found.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def testExample(self):
# self.assertEqual(countDaughterRelations(accessor),3)
# self.assertEqual(int(float(accessor.propertyValue(accessor.children(accessor.children(accessor.topLevelObjects()[0])[0])[2],"Mass"))),92)

accessor.next()
next(accessor)
self.assertEqual(accessor.eventNumber(),2)
# self.assertEqual(int(float(accessor.propertyValue(accessor.children(accessor.children(accessor.topLevelObjects()[0])[0])[2],"Mass"))),96)

Expand Down
2 changes: 1 addition & 1 deletion FWCore/Services/bin/EdgesToViz.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def readtable(flook):
for line in flook.xreadlines():
s = line.split()
if not s[7] in cols:
cols[s[7]] = next.next()
cols[s[7]] = next(next)
s.append(cols[s[7]])
tab[s[0]]=s
return tab,cols
Expand Down
2 changes: 1 addition & 1 deletion RecoBTag/CTagging/test/test_discriminator_presence.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
jet_labels = ["selectedPatJets"]#, "selectedPatJetsAK4PF", "selectedPatJetsAK8PFCHSSoftDropSubjets"]
tested_discriminators = ['pfCombinedCvsLJetTags', 'pfCombinedCvsBJetTags']

evt = events.__iter__().next()
evt = next(events.__iter__())
handle = Handle('std::vector<pat::Jet>')
for label in jet_labels:
evt.getByLabel(label, handle)
Expand Down
Loading

0 comments on commit e22f459

Please sign in to comment.