-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
31 lines (21 loc) · 859 Bytes
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import unicodedata
class RecofUnicode():
flag = False
def __new__(self, arg):
self.texto_tratado: str = ''
self.lista_tratada: list = list()
if not isinstance(arg, list):
self.get(self, arg)
return self.texto_tratado
else:
RecofUnicode.flag = True
self.get(self, arg)
return self.lista_tratada
def get(self, objeto):
recof = lambda item: ''.join(x for x in unicodedata.normalize('NFD', item) if unicodedata.category(x) != 'Mn')
if not RecofUnicode.flag:
self.texto_tratado = recof(objeto)
else:
self.lista_tratada = [recof(each) for each in objeto]
if __name__=="__main__":
print(RecofUnicode(['çáãÀâ','ãçâé']))