comparison libervia/backend/plugins/plugin_xep_0106.py @ 4298:060d695ae98e

plugin XEP-0106, tools (common/email): type hints.
author Goffi <goffi@goffi.org>
date Fri, 06 Sep 2024 17:44:08 +0200
parents 0d7bb4df2343
children
comparison
equal deleted inserted replaced
4297:0f953ce5f0a8 4298:060d695ae98e
59 self.reverse_map = {v: k for k, v in ESCAPE_MAP.items()} 59 self.reverse_map = {v: k for k, v in ESCAPE_MAP.items()}
60 60
61 def get_handler(self, client): 61 def get_handler(self, client):
62 return XEP_0106_handler() 62 return XEP_0106_handler()
63 63
64 def escape(self, text): 64 def escape(self, text) -> str:
65 """Escape text 65 """Escape text
66 66
67 @param text(unicode): text to escape 67 @param text(unicode): text to escape
68 @return (unicode): escaped text 68 @return (unicode): escaped text
69 @raise ValueError: text can't be escaped 69 @raise ValueError: text can't be escaped
76 escaped.append(ESCAPE_MAP[c]) 76 escaped.append(ESCAPE_MAP[c])
77 else: 77 else:
78 escaped.append(c) 78 escaped.append(c)
79 return "".join(escaped) 79 return "".join(escaped)
80 80
81 def unescape(self, escaped): 81 def unescape(self, escaped) -> str:
82 """Unescape text 82 """Unescape text
83 83
84 @param escaped(unicode): text to unescape 84 @param escaped(unicode): text to unescape
85 @return (unicode): unescaped text 85 @return (unicode): unescaped text
86 @raise ValueError: text can't be unescaped 86 @raise ValueError: text can't be unescaped