diff sat/plugins/plugin_misc_account.py @ 2765:378188abe941

misc: replaced all "dummy" by the more conventional and readable "__" ("_" being used for gettext)
author Goffi <goffi@goffi.org>
date Fri, 11 Jan 2019 11:13:15 +0100
parents 56f94936df1e
children 003b8b4b56a7
line wrap: on
line diff
--- a/sat/plugins/plugin_misc_account.py	Fri Jan 11 10:18:02 2019 +0100
+++ b/sat/plugins/plugin_misc_account.py	Fri Jan 11 11:13:15 2019 +0100
@@ -225,7 +225,7 @@
         @return Deferred
         """
         d = self.createProfile(password, jid_s, profile)
-        d.addCallback(lambda dummy: self.sendEmails(email, profile))
+        d.addCallback(lambda __: self.sendEmails(email, profile))
         return d
 
     def createProfile(self, password, jid_s, profile):
@@ -246,7 +246,7 @@
             return defer.fail(Failure(exceptions.ConflictError))
 
         d = self.host.memory.createProfile(profile, password)
-        d.addCallback(lambda dummy: self.profileCreated(password, jid_s, profile))
+        d.addCallback(lambda __: self.profileCreated(password, jid_s, profile))
         return d
 
     def profileCreated(self, password, jid_s, profile):
@@ -267,7 +267,7 @@
             jid_ = jid.JID(jid_s)
             d = self.host.plugins["XEP-0077"].registerNewAccount(jid_, password)
 
-        def setParams(dummy):
+        def setParams(__):
             self.host.memory.setParam(
                 "JabberID", jid_s, "Connection", profile_key=profile
             )
@@ -280,9 +280,9 @@
             self.host.memory.asyncDeleteProfile(profile)
             return failure
 
-        d.addCallback(lambda dummy: self.host.memory.startSession(password, profile))
+        d.addCallback(lambda __: self.host.memory.startSession(password, profile))
         d.addCallback(setParams)
-        d.addCallback(lambda dummy: self.host.memory.stopSession(profile))
+        d.addCallback(lambda __: self.host.memory.stopSession(profile))
         d.addErrback(removeProfile)
         return d
 
@@ -317,12 +317,12 @@
 
         admins_emails_txt = u", ".join([u"<" + addr + u">" for addr in admins_emails])
         d_admin.addCallbacks(
-            lambda dummy: log.debug(
+            lambda __: log.debug(
                 u"Account creation notification sent to admin(s) {}".format(
                     admins_emails_txt
                 )
             ),
-            lambda dummy: log.error(
+            lambda __: log.error(
                 u"Failed to send account creation notification to admin {}".format(
                     admins_emails_txt
                 )
@@ -343,7 +343,7 @@
         # FIXME: delete the profile if the email could not been sent?
         d_user = sat_email.sendEmail(self.host, [email], subject, body)
         d_user.addCallbacks(
-            lambda dummy: log.debug(
+            lambda __: log.debug(
                 u"Account creation confirmation sent to <{}>".format(email)
             ),
             self._sendEmailEb,
@@ -485,7 +485,7 @@
         @param password (str): the new password
         @param profile (str): %(doc_profile)s
         """
-        session_id, dummy = self._sessions.newSession(
+        session_id, __ = self._sessions.newSession(
             {"new_password": password}, profile=profile
         )
         form_ui = xml_tools.XMLUI(
@@ -511,7 +511,7 @@
         password = self._sessions.profileGet(data["session_id"], profile)["new_password"]
         del self._sessions[data["session_id"]]
 
-        def passwordChanged(dummy):
+        def passwordChanged(__):
             d = self.host.memory.setParam(
                 C.PROFILE_PASS_PATH[1],
                 password,
@@ -519,7 +519,7 @@
                 profile_key=profile,
             )
             d.addCallback(
-                lambda dummy: self.host.memory.setParam(
+                lambda __: self.host.memory.setParam(
                     "Password", password, "Connection", profile_key=profile
                 )
             )
@@ -576,7 +576,7 @@
         """
         client = self.host.getClient(profile)
 
-        def userDeleted(dummy):
+        def userDeleted(__):
 
             # FIXME: client should be disconnected at this point, so 2 next loop should be removed (to be confirmed)
             for jid_ in client.roster._jids:  # empty roster
@@ -594,7 +594,7 @@
                 d = self.host.plugins["GROUPBLOG"].deleteAllGroupBlogsAndComments(
                     profile_key=profile
                 )
-                d.addCallback(lambda dummy: delete_profile())
+                d.addCallback(lambda __: delete_profile())
             else:
                 delete_profile()
 
@@ -739,7 +739,7 @@
 
         d = self.createProfile(password, jid_s, jid_s)
         d.addCallback(
-            lambda dummy: self.host.memory.getProfileName(jid_s)
+            lambda __: self.host.memory.getProfileName(jid_s)
         )  # checks if the profile has been successfuly created
         d.addCallback(self.host.connect, password, {}, 0)