Mercurial > libervia-backend
diff sat/plugins/plugin_xep_0313.py @ 2624:56f94936df1e
code style reformatting using black
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 27 Jun 2018 20:14:46 +0200 |
parents | 26edcf3a30eb |
children | 2ea2369ae7de |
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0313.py Wed Jun 27 07:51:29 2018 +0200 +++ b/sat/plugins/plugin_xep_0313.py Wed Jun 27 20:14:46 2018 +0200 @@ -21,6 +21,7 @@ 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 @@ -45,12 +46,11 @@ C.PI_PROTOCOLS: ["XEP-0313"], C.PI_MAIN: "XEP_0313", C.PI_HANDLER: "yes", - C.PI_DESCRIPTION: _("""Implementation of Message Archive Management""") + C.PI_DESCRIPTION: _("""Implementation of Message Archive Management"""), } class XEP_0313(object): - def __init__(self, host): log.info(_("Message Archive Management plugin initialization")) self.host = host @@ -86,7 +86,7 @@ def _queryFinished(self, iq_result, client, elt_list, event): client.xmlstream.removeObserver(event, self._appendMessage) try: - fin_elt = iq_result.elements(mam.NS_MAM, 'fin').next() + fin_elt = iq_result.elements(mam.NS_MAM, "fin").next() except StopIteration: raise exceptions.DataError(u"Invalid MAM result") @@ -119,14 +119,21 @@ # http://xmpp.org/extensions/xep-0313.html#prefs return client._mam.queryPrefs(service) - def _setPrefs(self, service_s=None, default='roster', always=None, never=None, profile_key=C.PROF_KEY_NONE): + def _setPrefs( + self, + service_s=None, + default="roster", + always=None, + never=None, + profile_key=C.PROF_KEY_NONE, + ): service = jid.JID(service_s) if service_s else None always_jid = [jid.JID(entity) for entity in always] never_jid = [jid.JID(entity) for entity in never] - #TODO: why not build here a MAMPrefs object instead of passing the args separately? + # TODO: why not build here a MAMPrefs object instead of passing the args separately? return self.setPrefs(service, default, always_jid, never_jid, profile_key) - def setPrefs(self, client, service=None, default='roster', always=None, never=None): + def setPrefs(self, client, service=None, default="roster", always=None, never=None): """Set news user preferences. @param service: entity offering the MAM service (None for user archives) @@ -143,8 +150,8 @@ class SatMAMClient(mam.MAMClient): implements(disco.IDisco) - def getDiscoInfo(self, requestor, target, nodeIdentifier=''): + def getDiscoInfo(self, requestor, target, nodeIdentifier=""): return [disco.DiscoFeature(mam.NS_MAM)] - def getDiscoItems(self, requestor, target, nodeIdentifier=''): + def getDiscoItems(self, requestor, target, nodeIdentifier=""): return []