diff options
author | László Németh <nemeth@numbertext.org> | 2014-05-15 13:21:49 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2014-05-15 13:21:49 +0200 |
commit | 28e50957d99a0773690f4d3663c544bfb61c54dc (patch) | |
tree | f182ff2ffa76a59333c5ea3c9fac5f7f16fc5710 | |
parent | c5694c1ae68832772fdba3a3038af65d25f88531 (diff) |
Python 3 port of measurement conversion (en, hu modules)
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/en/en.dat | 2 | ||||
-rw-r--r-- | src/hu_HU/hu_HU.dat | 2 |
3 files changed, 6 insertions, 2 deletions
@@ -1,3 +1,7 @@ +2014-05-15 László Németh <nemeth@numbertext.org>: + - Python 3.3 port of the measurement conversion in + the English and Hungarian modules + 2013-11-20 László Németh <nemeth@numbertext.org>: - Python 3.3 port of build environment of the editor diff --git a/src/en/en.dat b/src/en/en.dat index 789a405..4a8a965 100644 --- a/src/en/en.dat +++ b/src/en/en.dat @@ -378,6 +378,6 @@ def measurement(mnum, min, mout, mstr, decimal, remove): mnum = mnum.replace(" 1/2", ".5").replace(u" ½", ".5").replace(u"½",".5") m = calc("CONVERT_ADD", (float(eval(mnum.replace(remove, "").replace(decimal, ".").replace(u"−", "-"))), 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"−") + mstr diff --git a/src/hu_HU/hu_HU.dat b/src/hu_HU/hu_HU.dat index 99d16ae..0b79b32 100644 --- a/src/hu_HU/hu_HU.dat +++ b/src/hu_HU/hu_HU.dat @@ -914,5 +914,5 @@ megint <- option("hyphen") -> megint|megint # Elválasztás: def measurement(mnum, min, mout, mstr): m = calc("CONVERT_ADD", (float(mnum.replace(",", ".").replace(u"−", "-")), 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"−") + mstr |