diff options
author | lovetox <philipp@hoerist.com> | 2021-10-17 12:57:33 +0300 |
---|---|---|
committer | lovetox <philipp@hoerist.com> | 2021-10-17 12:57:33 +0300 |
commit | b48f0f6c8dd704fe7d47c023e3dca53b3730665a (patch) | |
tree | f5f49c69f550bcfd559fb18b2512193350d495f8 /nbxmpp/util.py | |
parent | b2a46b62e1fce675df36465b9161bc3ca82ccd06 (diff) |
Add annotations
Diffstat (limited to 'nbxmpp/util.py')
-rw-r--r-- | nbxmpp/util.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/nbxmpp/util.py b/nbxmpp/util.py index c276a10..25beb90 100644 --- a/nbxmpp/util.py +++ b/nbxmpp/util.py @@ -317,7 +317,7 @@ def get_stream_header(domain, lang, is_websocket): return "<?xml version='1.0'?>%s>" % str(header)[:-3] -def utf8_decode(data): +def utf8_decode(data: bytes) -> tuple[str, bytes]: ''' Decodes utf8 byte string to unicode string Does handle invalid utf8 sequences by splitting @@ -336,7 +336,7 @@ def utf8_decode(data): raise -def get_rand_number(): +def get_rand_number() -> int: return int(binascii.hexlify(os.urandom(6)), 16) @@ -360,7 +360,7 @@ def get_invalid_xml_regex(): return re.compile(r) -def get_tls_error_phrase(tls_error): +def get_tls_error_phrase(tls_error: Gio.TlsCertificateFlags) -> str: phrase = GIO_TLS_ERRORS.get(tls_error) if phrase is None: return GIO_TLS_ERRORS.get(Gio.TlsCertificateFlags.GENERIC_ERROR) |