diff options
author | László Németh <nemeth@numbertext.org> | 2014-05-15 13:03:17 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-05-16 10:23:27 +0200 |
commit | 0a68bdc3b29237ab76bce445f3cdc535b1482307 (patch) | |
tree | 0b647dbebc9e4d84833f0a350f9e032be53fad66 | |
parent | 246dddb6ce55587bdbdbf05163b294bbffff72fa (diff) |
fix LightProof measurement conversion for Python 3
Change-Id: I6d36bc804271956e1c8649df0832615311fcf5e1
Reviewed-on: https://gerrit.libreoffice.org/#/c/9367
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
-rw-r--r-- | en/pythonpath/lightproof_impl_en.py | 2 | ||||
-rw-r--r-- | hu_HU/pythonpath/lightproof_impl_hu_HU.py | 2 | ||||
-rw-r--r-- | pt_BR/pythonpath/lightproof_impl_pt_BR.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/en/pythonpath/lightproof_impl_en.py b/en/pythonpath/lightproof_impl_en.py index 2c7072c..ac668dc 100644 --- a/en/pythonpath/lightproof_impl_en.py +++ b/en/pythonpath/lightproof_impl_en.py @@ -328,7 +328,7 @@ def measurement(mnum, min, mout, mstr, decimal, remove): mnum = mnum.replace(" 1/2", ".5").replace(u" \xbd", ".5").replace(u"\xbd",".5") m = calc("CONVERT_ADD", (float(eval(mnum.replace(remove, "").replace(decimal, ".").replace(u"\u2212", "-"))), min, mout)) a = list(set([str(calc("ROUND", (m, 0)))[:-2], str(calc("ROUND", (m, 1))), str(calc("ROUND", (m, 2))), str(m)])) # remove duplicated rounded items - a.sort(lambda x, y: len(x) - len(y)) # sort by string length + a.sort(key=lambda x: len(x)) # sort by string length return (mstr + "\n").join(a).replace(".", decimal).replace("-", u"\u2212") + mstr diff --git a/hu_HU/pythonpath/lightproof_impl_hu_HU.py b/hu_HU/pythonpath/lightproof_impl_hu_HU.py index 62e0025..d88c136 100644 --- a/hu_HU/pythonpath/lightproof_impl_hu_HU.py +++ b/hu_HU/pythonpath/lightproof_impl_hu_HU.py @@ -244,7 +244,7 @@ paralcap = re.compile(u"(?u)^[a-z\xf6\xfc\xf3\u0151\xfa\xe9\xe1\u0171\xed].*[.?! def measurement(mnum, min, mout, mstr): m = calc("CONVERT_ADD", (float(mnum.replace(",", ".").replace(u"\u2212", "-")), min, mout)) a = list(set([str(calc("ROUND", (m, 0)))[:-2], str(calc("ROUND", (m, 1))), str(calc("ROUND", (m, 2))), str(m)])) # remove duplicated rounded items - a.sort(lambda x, y: len(x) - len(y)) # sort by string length + a.sort(key=lambda x: len(x)) # sort by string length return (mstr + "|").join(a).replace(".", ",").replace("-", u"\u2212") + mstr diff --git a/pt_BR/pythonpath/lightproof_impl_pt_BR.py b/pt_BR/pythonpath/lightproof_impl_pt_BR.py index 8d0100f..8611ee5 100644 --- a/pt_BR/pythonpath/lightproof_impl_pt_BR.py +++ b/pt_BR/pythonpath/lightproof_impl_pt_BR.py @@ -24417,7 +24417,7 @@ def measurement(mnum, min, mout, mstr, decimal, remove): mnum = mnum.replace(" 1/2", ".5").replace(u" \xbd", ".5").replace(u"\xbd",".5") m = calc("CONVERT_ADD", (float(eval(mnum.replace(remove, "").replace(decimal, ".").replace(u"\u2212", "-"))), min, mout)) a = list(set([str(calc("ROUND", (m, 0)))[:-2], str(calc("ROUND", (m, 1))), str(calc("ROUND", (m, 2))), str(m)])) # remove duplicated rounded items - a.sort(lambda x, y: len(x) - len(y)) # sort by string length + a.sort(key=lambda x: len(x)) # sort by string length return (mstr + "\n").join(a).replace(".", decimal).replace("-", u"\u2212") + mstr |