Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python2to3: cmp to key conversion in list sort substitute #28080

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions FWCore/Concurrency/scripts/edmStreamStallGrapher.py
Expand Up @@ -6,7 +6,7 @@
import sys
from collections import defaultdict
import six

from functools import cmp_to_key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import does not appear to be needed

#----------------------------------------------
def printHelp():
s = '''
Expand Down Expand Up @@ -424,7 +424,7 @@ def printStalledModulesInOrder(stalledModules):

def sumSort(i,j):
return cmp(i[1],j[1])
priorities.sort(cmp=sumSort, reverse=True)
priorities.sort(key=cmp_to_key(sumSort), reverse=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

following should work for both py2 and 3

priorities = sorted(priorities , key=lambda a: a[1], reverse=True)

mrodozov marked this conversation as resolved.
Show resolved Hide resolved

nameColumn = "Stalled Module"
maxNameSize = max(maxNameSize, len(nameColumn))
Expand Down