From 18a2ac5b21b9afd9e8d7638e18cfdc37b116d5d5 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Thu, 5 Mar 2020 12:09:03 -0800 Subject: [PATCH] Fix sort comparison function In python3 you can't use a cmp function and have to use a key function when sorting. Python2 supports both so we switch to a key function that takes a single arg in the sort of supported languages in the pasting script. Change-Id: Ib49bcb22653bd577078a386750027fc5acee3180 --- scripts/lodgeit.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/lodgeit.py b/scripts/lodgeit.py index 7ebf7f2..8a2a67b 100755 --- a/scripts/lodgeit.py +++ b/scripts/lodgeit.py @@ -186,9 +186,7 @@ def print_languages(): """Print a list of all supported languages, with description.""" xmlrpc = get_xmlrpc_service() languages = xmlrpc.pastes.getLanguages().items() - languages.sort( - lambda a, b: (a[1].lower() > b[1].lower())-(a[1].lower() < b[1].lower()) - ) + languages.sort(key=lambda a: a[1].lower()) print('Supported Languages:') for alias, name in languages: print(' %-30s%s' % (alias, name))