diff options
-rw-r--r-- | slixmpp/jid.py | 22 |
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 |