Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits: cb5aef14 by lovetox at 2020-04-13T15:08:25+02:00 Protocol: Cache JID parsing results
- - - - - 2fd29576 by lovetox at 2020-04-13T15:09:04+02:00 Fix pylint error
- - - - -
1 changed file:
- nbxmpp/protocol.py
Changes:
===================================== nbxmpp/protocol.py ===================================== @@ -21,6 +21,7 @@ sub- stanzas) handling routines import time import hashlib import socket +import functools from base64 import b64encode
from precis_i18n import get_profile @@ -707,31 +708,32 @@ class DiscoInfoMalformed(Exception): pass
stream_exceptions = {'bad-format': BadFormat, - 'bad-namespace-prefix': BadNamespacePrefix, - 'conflict': Conflict, - 'connection-timeout': ConnectionTimeout, - 'host-gone': HostGone, - 'host-unknown': HostUnknown, - 'improper-addressing': ImproperAddressing, - 'internal-server-error': InternalServerError, - 'invalid-from': InvalidFrom, - 'invalid-id': InvalidID, - 'invalid-namespace': InvalidNamespace, - 'invalid-xml': InvalidXML, - 'not-authorized': NotAuthorized, - 'policy-violation': PolicyViolation, - 'remote-connection-failed': RemoteConnectionFailed, - 'resource-constraint': ResourceConstraint, - 'restricted-xml': RestrictedXML, - 'see-other-host': SeeOtherHost, - 'system-shutdown': SystemShutdown, - 'undefined-condition': UndefinedCondition, - 'unsupported-encoding': UnsupportedEncoding, - 'unsupported-stanza-type': UnsupportedStanzaType, - 'unsupported-version': UnsupportedVersion, - 'xml-not-well-formed': XMLNotWellFormed} - - + 'bad-namespace-prefix': BadNamespacePrefix, + 'conflict': Conflict, + 'connection-timeout': ConnectionTimeout, + 'host-gone': HostGone, + 'host-unknown': HostUnknown, + 'improper-addressing': ImproperAddressing, + 'internal-server-error': InternalServerError, + 'invalid-from': InvalidFrom, + 'invalid-id': InvalidID, + 'invalid-namespace': InvalidNamespace, + 'invalid-xml': InvalidXML, + 'not-authorized': NotAuthorized, + 'policy-violation': PolicyViolation, + 'remote-connection-failed': RemoteConnectionFailed, + 'resource-constraint': ResourceConstraint, + 'restricted-xml': RestrictedXML, + 'see-other-host': SeeOtherHost, + 'system-shutdown': SystemShutdown, + 'undefined-condition': UndefinedCondition, + 'unsupported-encoding': UnsupportedEncoding, + 'unsupported-stanza-type': UnsupportedStanzaType, + 'unsupported-version': UnsupportedVersion, + 'xml-not-well-formed': XMLNotWellFormed} + + +@functools.lru_cache(maxsize=None) def parse_jid(jid): # https://tools.ietf.org/html/rfc7622#section-3.2
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/compare/b169eb1a940d9ee06115c301...