Ejemplo n.º 1
0
    'Y',
    'Z',
]
log("Working on Nodes:")
for node in root.findall('node'):
    for tag in node.findall('tag'):
        k = tag.attrib['k']
        if k == 'name':
            name = tag.attrib['v']
            if any(char in name for char in ignore_list):
                log("    id:" + node.attrib['id'] + "  name:'" + name +
                    "' matched in ignore_list , it didn't get touched")
                continue
            if any(char in name for char in accepted_chars):
                temp = tag.attrib['v']
                v_fixed = persian.convert_ar_numbers(name)
                if temp != v_fixed:
                    ar_numbers = ar_numbers + 1
                    issuecounter = issuecounter + 1
                    temp = v_fixed
                v_fixed = persian.convert_en_numbers(v_fixed)
                if temp != v_fixed:
                    en_numbers = en_numbers + 1
                    issuecounter = issuecounter + 1
                    temp = v_fixed
                if v_fixed != name:
                    counter = counter + 1
                    tag.attrib['v'] = v_fixed
                    node.set('action', 'modify')
                    logchanges(counter, "node/" + node.attrib['id'], name,
                               v_fixed)
Ejemplo n.º 2
0
 def test_convert_arabic_numbers(self):
     self.assertEqual("۱۲۳۴۵۶۷۸۹۰",
                      persian.convert_ar_numbers("١٢٣٤٥٦٧٨٩٠"))