actions, move parse_decimal
This commit is contained in:
parent
d50d242c45
commit
07dcc77950
7 changed files with 44 additions and 33 deletions
|
|
@ -3,6 +3,7 @@
|
|||
# vi:si:et:sw=4:sts=4:ts=4
|
||||
#
|
||||
import errno
|
||||
from decimal import Decimal
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
|
|
@ -14,6 +15,13 @@ import ox.iso
|
|||
from ox.normalize import normalizeName, normalizeTitle, canonicalTitle
|
||||
|
||||
|
||||
def parse_decimal(string):
|
||||
string = string.replace(':', '/')
|
||||
if '/' not in string:
|
||||
string = '%s/1' % string
|
||||
d = string.split('/')
|
||||
return Decimal(d[0]) / Decimal(d[1])
|
||||
|
||||
def plural_key(term):
|
||||
return {
|
||||
'country': 'countries',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue