jenkins-bot has submitted this change and it was merged.
Change subject: Use key function instead of comparator for sorting interwikis ......................................................................
Use key function instead of comparator for sorting interwikis
Change-Id: Ic7cde6334eb9e07c2e550ef4e2c88a4ccd84f49b --- M pywikibot/family.py 1 file changed, 1 insertion(+), 5 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/family.py b/pywikibot/family.py index e446471..8129aa8 100644 --- a/pywikibot/family.py +++ b/pywikibot/family.py @@ -98,13 +98,9 @@ ]
# Order for fy: alphabetical by code, but y counts as i - def fycomp(x, y): - x = x.replace("y", "i") + x.count("y") * "!" - y = y.replace("y", "i") + y.count("y") * "!" - return cmp(x, y) self.fyinterwiki = self.alphabetic[:] self.fyinterwiki.remove('nb') - self.fyinterwiki.sort(fycomp) + self.fyinterwiki.sort(key=lambda x: x.replace("y", "i") + x.count("y") * "!")
self.langs = {}
pywikibot-commits@lists.wikimedia.org