jenkins-bot has submitted this change and it was merged.
Change subject: Minor change to make use of NON_LATIN_DIGITS in archivebot. ......................................................................
Minor change to make use of NON_LATIN_DIGITS in archivebot.
Made it a dictionary
Change-Id: I736c0de5d2bc115609d2ac7ec38c4d737592154b --- M pywikibot/textlib.py 1 file changed, 10 insertions(+), 10 deletions(-)
Approvals: Ladsgroup: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 64da90b..c343286 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -36,15 +36,15 @@
TEMP_REGEX = re.compile( '{{(?:msg:)?(?P<name>[^{|]+?)(?:|(?P<params>[^{]+?(?:{[^{]+?}[^{]*?)?))?}}') -NON_LATIN_DIGITS = [ - u'٠١٢٣٤٥٦٧٨٩', # ckb - u'۰۱۲۳۴۵۶۷۸۹', # fa - u'೦೧೨೩೪೫೬೭೮೯', # kn - u'०१२३४५६७८९', # hi and some other - u'০১২৩৪৫৬৭৮৯', # bn - u'૦૧૨૩૪૫૬૭૮૯', # gu - u'୦୧୨୩୪୫୬୭୮୯', # or -] +NON_LATIN_DIGITS = { + 'ckb': u'٠١٢٣٤٥٦٧٨٩', + 'fa': u'۰۱۲۳۴۵۶۷۸۹', + 'kn': u'೦೧೨೩೪೫೬೭೮೯', + 'hi': u'०१२३४५६७८९', + 'bn': u'০১২৩৪৫৬৭৮৯', + 'gu': u'૦૧૨૩૪૫૬૭૮૯', + 'or': u'୦୧୨୩୪୫୬୭୮୯', +}
def unescape(s): @@ -1254,7 +1254,7 @@
def fix_digits(self, line): """Make non-latin digits like Persian to latin to parse.""" - for system in NON_LATIN_DIGITS: + for system in NON_LATIN_DIGITS.values(): for i in range(0, 10): line = line.replace(system[i], str(i)) return line
pywikibot-commits@lists.wikimedia.org