Python 3 has no cmp function in sorted

This commit is contained in:
Leonel Câmara
2018-09-27 16:22:48 +01:00
committed by GitHub
parent 904ca403a2
commit f5638c8f6b

View File

@@ -311,7 +311,7 @@ def write_plural_dict(filename, contents):
try:
fp = LockedFile(filename, 'w')
fp.write('#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n{\n# "singular form (0)": ["first plural form (1)", "second plural form (2)", ...],\n')
for key in sorted(contents, cmp=sort_function):
for key in sorted(contents, key=sort_function):
forms = '[' + ','.join([repr(Utf8(form))
for form in contents[key]]) + ']'
fp.write('%s: %s,\n' % (repr(Utf8(key)), forms))
@@ -326,7 +326,7 @@ def write_plural_dict(filename, contents):
def sort_function(x, y):
return cmp(unicode(x, 'utf-8').lower(), unicode(y, 'utf-8').lower())
return unicode(x, 'utf-8').lower()
def write_dict(filename, contents):