summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-03-07 21:12:22 +0100
committermathieui <mathieui@mathieui.net>2021-03-07 21:12:22 +0100
commit5ff46d6245a54bb351cd6fce9f74ca8caef1d402 (patch)
tree715fa920128dc2a542a702b43145fc3e2d54a925
parentc1a598c34be8ca5b85b69ce9a442363686261e35 (diff)
downloadslixmpp-5ff46d6245a54bb351cd6fce9f74ca8caef1d402.tar.gz
slixmpp-5ff46d6245a54bb351cd6fce9f74ca8caef1d402.tar.bz2
slixmpp-5ff46d6245a54bb351cd6fce9f74ca8caef1d402.tar.xz
slixmpp-5ff46d6245a54bb351cd6fce9f74ca8caef1d402.zip
JID: add some forgotten type hints
-rw-r--r--slixmpp/jid.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/slixmpp/jid.py b/slixmpp/jid.py
index c84b4aa0..ee5ef987 100644
--- a/slixmpp/jid.py
+++ b/slixmpp/jid.py
@@ -5,12 +5,16 @@
# Part of Slixmpp: The Slick XMPP Library
# :copyright: (c) 2011 Nathanael C. Fritz
# :license: MIT, see LICENSE for more details
+from __future__ import annotations
+
import re
import socket
-from copy import deepcopy
from functools import lru_cache
-from typing import Optional
+from typing import (
+ Optional,
+ Union,
+)
from slixmpp.stringprep import nodeprep, resourceprep, idna, StringprepError
@@ -42,7 +46,7 @@ JID_UNESCAPE_TRANSFORMATIONS = {'\\20': ' ',
# TODO: Find the best cache size for a standard usage.
@lru_cache(maxsize=1024)
-def _parse_jid(data):
+def _parse_jid(data: str):
"""
Parse string data into the node, domain, and resource
components of a JID, if possible.
@@ -305,7 +309,7 @@ class JID:
__slots__ = ('_node', '_domain', '_resource', '_bare', '_full')
- def __init__(self, jid: Optional[str] = None):
+ def __init__(self, jid: Optional[Union[str, 'JID']] = None):
if not jid:
self._node = ''
self._domain = ''
@@ -347,23 +351,23 @@ class JID:
else self._bare)
@property
- def node(self):
+ def node(self) -> str:
return self._node
@property
- def domain(self):
+ def domain(self) -> str:
return self._domain
@property
- def resource(self):
+ def resource(self) -> str:
return self._resource
@property
- def bare(self):
+ def bare(self) -> str:
return self._bare
@property
- def full(self):
+ def full(self) -> str:
return self._full
@node.setter