diff --git a/sat/plugins/plugin_xep_0300.py b/sat/plugins/plugin_xep_0300.py
index 28ee754c..34c1464f 100644
--- a/sat/plugins/plugin_xep_0300.py
+++ b/sat/plugins/plugin_xep_0300.py
@@ -17,21 +17,24 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from sat.core.i18n import _
+from typing import Tuple
+import base64
+from collections import OrderedDict
+import hashlib
+
+from twisted.internet import threads
+from twisted.internet import defer
+from twisted.words.protocols.jabber.xmlstream import XMPPHandler
+from twisted.words.xish import domish
+from wokkel import disco, iwokkel
+from zope.interface import implementer
+
+from sat.core import exceptions
from sat.core.constants import Const as C
+from sat.core.i18n import _
from sat.core.log import getLogger
log = getLogger(__name__)
-from sat.core import exceptions
-from twisted.words.xish import domish
-from twisted.words.protocols.jabber.xmlstream import XMPPHandler
-from twisted.internet import threads
-from twisted.internet import defer
-from zope.interface import implementer
-from wokkel import disco, iwokkel
-from collections import OrderedDict
-import hashlib
-import base64
PLUGIN_INFO = {
@@ -61,6 +64,7 @@ class XEP_0300(object):
("sha-512", hashlib.sha512),
)
)
+ ALGO_DEFAULT = ALGO_DEFAULT
def __init__(self, host):
log.info(_("plugin Hashes initialization"))
@@ -176,12 +180,12 @@ class XEP_0300(object):
hash_elt["algo"] = algo
return hash_elt
- def parseHashElt(self, parent):
+ def parseHashElt(self, parent: domish.Element) -> Tuple[str, bytes]:
"""Find and parse a hash element
if multiple elements are found, the strongest managed one is returned
- @param (domish.Element): parent of element
- @return (tuple[str, bytes]): (algo, hash) tuple
+ @param parent: parent of element
+ @return: (algo, hash) tuple
both values can be None if is empty
@raise exceptions.NotFound: the element is not present
@raise exceptions.DataError: the element is invalid