summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2014-05-15 13:21:49 +0200
committerLászló Németh <nemeth@numbertext.org>2014-05-15 13:21:49 +0200
commit28e50957d99a0773690f4d3663c544bfb61c54dc (patch)
treef182ff2ffa76a59333c5ea3c9fac5f7f16fc5710
parentc5694c1ae68832772fdba3a3038af65d25f88531 (diff)
Python 3 port of measurement conversion (en, hu modules)
-rw-r--r--ChangeLog4
-rw-r--r--src/en/en.dat2
-rw-r--r--src/hu_HU/hu_HU.dat2
3 files changed, 6 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0808d99..2d21272 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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") -> me­gint|meg­int # 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