diff sat/plugins/plugin_xep_0297.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 5060cbeec01e
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0297.py	Wed Jun 27 07:51:29 2018 +0200
+++ b/sat/plugins/plugin_xep_0297.py	Wed Jun 27 20:14:46 2018 +0200
@@ -21,9 +21,11 @@
 from sat.core.constants import Const as C
 from sat.core.i18n import _, D_
 from sat.core.log import getLogger
+
 log = getLogger(__name__)
 
 from wokkel import disco, iwokkel
+
 try:
     from twisted.words.protocols.xmlstream import XMPPHandler
 except ImportError:
@@ -41,7 +43,7 @@
     C.PI_PROTOCOLS: [u"XEP-0297"],
     C.PI_MAIN: "XEP_0297",
     C.PI_HANDLER: u"yes",
-    C.PI_DESCRIPTION: D_(u"""Implementation of Stanza Forwarding""")
+    C.PI_DESCRIPTION: D_(u"""Implementation of Stanza Forwarding"""),
 }
 
 
@@ -70,7 +72,7 @@
             if isinstance(child, domish.Element) and not child.uri:
                 XEP_0297.updateUri(child, uri)
 
-    def forward(self, stanza, to_jid, stamp, body='', profile_key=C.PROF_KEY_NONE):
+    def forward(self, stanza, to_jid, stamp, body="", profile_key=C.PROF_KEY_NONE):
         """Forward a message to the given JID.
 
         @param stanza (domish.Element): original stanza to be forwarded.
@@ -82,27 +84,29 @@
         """
         # FIXME: this method is not used and doesn't use mess_data which should be used for client.sendMessageData
         #        should it be deprecated? A method constructing the element without sending it seems more natural
-        log.warning(u"THIS METHOD IS DEPRECATED") # FIXME: we use this warning until we check the method
-        msg = domish.Element((None, 'message'))
-        msg['to'] = to_jid.full()
-        msg['type'] = stanza['type']
+        log.warning(
+            u"THIS METHOD IS DEPRECATED"
+        )  #  FIXME: we use this warning until we check the method
+        msg = domish.Element((None, "message"))
+        msg["to"] = to_jid.full()
+        msg["type"] = stanza["type"]
 
-        body_elt = domish.Element((None, 'body'))
+        body_elt = domish.Element((None, "body"))
         if body:
             body_elt.addContent(body)
 
-        forwarded_elt = domish.Element((NS_SF, 'forwarded'))
-        delay_elt = self.host.plugins['XEP-0203'].delay(stamp)
+        forwarded_elt = domish.Element((NS_SF, "forwarded"))
+        delay_elt = self.host.plugins["XEP-0203"].delay(stamp)
         forwarded_elt.addChild(delay_elt)
         if not stanza.uri:  # None or ''
-            XEP_0297.updateUri(stanza, 'jabber:client')
+            XEP_0297.updateUri(stanza, "jabber:client")
         forwarded_elt.addChild(stanza)
 
         msg.addChild(body_elt)
         msg.addChild(forwarded_elt)
 
         client = self.host.getClient(profile_key)
-        return client.sendMessageData({u'xml': msg})
+        return client.sendMessageData({u"xml": msg})
 
 
 class XEP_0297_handler(XMPPHandler):
@@ -113,8 +117,8 @@
         self.host = plugin_parent.host
         self.profile = profile
 
-    def getDiscoInfo(self, requestor, target, nodeIdentifier=''):
+    def getDiscoInfo(self, requestor, target, nodeIdentifier=""):
         return [disco.DiscoFeature(NS_SF)]
 
-    def getDiscoItems(self, requestor, target, nodeIdentifier=''):
+    def getDiscoItems(self, requestor, target, nodeIdentifier=""):
         return []