Python 3 has no cmp function in sorted
This commit is contained in:
+2
-2
@@ -311,7 +311,7 @@ def write_plural_dict(filename, contents):
|
|||||||
try:
|
try:
|
||||||
fp = LockedFile(filename, 'w')
|
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')
|
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))
|
forms = '[' + ','.join([repr(Utf8(form))
|
||||||
for form in contents[key]]) + ']'
|
for form in contents[key]]) + ']'
|
||||||
fp.write('%s: %s,\n' % (repr(Utf8(key)), forms))
|
fp.write('%s: %s,\n' % (repr(Utf8(key)), forms))
|
||||||
@@ -326,7 +326,7 @@ def write_plural_dict(filename, contents):
|
|||||||
|
|
||||||
|
|
||||||
def sort_function(x, y):
|
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):
|
def write_dict(filename, contents):
|
||||||
|
|||||||
Reference in New Issue
Block a user