misc: replaced all "dummy" by the more conventional and readable "__" ("_" being used for gettext)

This commit is contained in:
Goffi 2019-01-11 11:13:15 +01:00
commit 7a9ee35cfc
25 changed files with 215 additions and 215 deletions

View file

@ -306,7 +306,7 @@ class BlogImportPlugin(object):
filename = filename.replace(
u"%", u"_"
) # FIXME: tmp workaround for a bug in prosody http upload
dummy, download_d = yield self._u.upload(
__, download_d = yield self._u.upload(
client, tmp_file, filename, options=upload_options
)
download_url = yield download_d

View file

@ -92,7 +92,7 @@ class FileSharing(object):
os.makedirs(path)
@defer.inlineCallbacks
def _fileTransferedCb(self, dummy, client, peer_jid, file_data, file_path):
def _fileTransferedCb(self, __, client, peer_jid, file_data, file_path):
"""post file reception tasks
on file is received, this method create hash/thumbnails if necessary

View file

@ -612,7 +612,7 @@ class Events(object):
# first we authorize our invitee to see the nodes of interest
yield self._p.setNodeAffiliations(client, service, node, {invitee_jid: u"member"})
log.debug(_(u"affiliation set on event node"))
dummy, event_data = yield self.eventGet(client, service, node, item_id)
__, event_data = yield self.eventGet(client, service, node, item_id)
log.debug(_(u"got event data"))
invitees_service = jid.JID(event_data["invitees_service"])
invitees_node = event_data["invitees_node"]
@ -625,7 +625,7 @@ class Events(object):
yield self._p.setNodeAffiliations(
client, blog_service, blog_node, {invitee_jid: u"member"}
)
blog_items, dummy = yield self._b.mbGet(client, blog_service, blog_node, None)
blog_items, __ = yield self._b.mbGet(client, blog_service, blog_node, None)
for item in blog_items:
try:

View file

@ -291,7 +291,7 @@ class JingleStream(object):
log.warning(u"FIXME: unmanaged action {}".format(action))
return desc_elt
def _finishedCb(self, dummy, client, session, content_name, content_data):
def _finishedCb(self, __, client, session, content_name, content_data):
log.info(u"Pipe transfer completed")
self._j.contentTerminate(client, session, content_name)
content_data["stream_object"].stopStream()

View file

@ -121,8 +121,8 @@ class MercurialHandler(object):
def check(self, repository):
d = MercurialProtocol.run(repository, 'identify')
d.addCallback(lambda dummy: True)
d.addErrback(lambda dummy: False)
d.addCallback(lambda __: True)
d.addErrback(lambda __: False)
return d
def export(self, repository):

View file

@ -225,7 +225,7 @@ class MiscAccount(object):
@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 @@ class MiscAccount(object):
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 @@ class MiscAccount(object):
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 @@ class MiscAccount(object):
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 @@ class MiscAccount(object):
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 @@ class MiscAccount(object):
# 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 @@ class MiscAccount(object):
@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 @@ class MiscAccount(object):
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 @@ class MiscAccount(object):
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 @@ class MiscAccount(object):
"""
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 @@ class MiscAccount(object):
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 @@ class MiscAccount(object):
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)

View file

@ -105,7 +105,7 @@ class NatPort(object):
@return (None, str): found IP address, or None of something got wrong
"""
def getIP(dummy):
def getIP(__):
if self._upnp is None:
return None
# lanaddr can be the empty string if not found,

View file

@ -81,7 +81,7 @@ class RegisterAccount(object):
session_data["user"], host, resource = jid.parse(session_data["JabberID"])
session_data["server"] = session_data[C.FORCE_SERVER_PARAM] or host
session_id, dummy = self._sessions.newSession(session_data, profile=profile)
session_id, __ = self._sessions.newSession(session_data, profile=profile)
form_ui = xml_tools.XMLUI(
"form",
title=D_("Register new account"),
@ -129,7 +129,7 @@ class RegisterAccount(object):
def _registerNewAccount(self, client, jid_, password, email, server):
#  FIXME: port is not set here
def registeredCb(dummy):
def registeredCb(__):
xmlui = xml_tools.XMLUI(u"popup", title=D_(u"Confirmation"))
xmlui.addText(D_("Registration successful."))
return {"xmlui": xmlui.toXml()}

View file

@ -488,7 +488,7 @@ class RoomGame(object):
user_jid = self.host.getJidNStream(profile)[0]
d = self.host.plugins["XEP-0045"].join(room_jid, user_jid.user, {}, profile)
return d.addCallback(
lambda dummy: self._createOrInvite(client, room_jid, other_players)
lambda __: self._createOrInvite(client, room_jid, other_players)
)
def userJoinedTrigger(self, room, user, profile):
@ -520,7 +520,7 @@ class RoomGame(object):
)
return True
other_players = self.invitations[room_jid][batch][1]
(auth, nicks, dummy) = self._checkWaitAuth(room, other_players)
(auth, nicks, __) = self._checkWaitAuth(room, other_players)
if auth:
del self.invitations[room_jid][batch]
nicks.insert(0, profile_nick) # add the referee

View file

@ -87,7 +87,7 @@ class UploadPlugin(object):
"""
def uploadCb(data):
progress_id, dummy = data
progress_id, __ = data
return {"progress": progress_id}
def uploadEb(fail):

View file

@ -131,7 +131,7 @@ class XEP_0033(object):
raise failure.Failure(exceptions.CancelError(u"Cancelled by XEP-0033"))
d = self.host.findFeaturesSet(client, [NS_ADDRESS])
d.addCallbacks(discoCallback, lambda dummy: discoCallback(None))
d.addCallbacks(discoCallback, lambda __: discoCallback(None))
return d
post_xml_treatments.addCallback(treatment)
@ -194,7 +194,7 @@ class XEP_0033(object):
)
d.callback([NS_ADDRESS])
defer_list.append(d)
d = defer.Deferred().addCallback(lambda dummy: self.internal_data.pop(timestamp))
d = defer.Deferred().addCallback(lambda __: self.internal_data.pop(timestamp))
defer.DeferredList(defer_list).chainDeferred(d)
def messageReceivedTrigger(self, client, message, post_treat):

View file

@ -265,7 +265,7 @@ class XEP_0048(object):
# FIXME: failure are badly managed in plugin XEP-0045. Plugin XEP-0045 need to be fixed before managing errors correctly here
return {}
d.addCallbacks(lambda dummy: {}, join_eb)
d.addCallbacks(lambda __: {}, join_eb)
return d
def _bookmarksMenu(self, data, profile):
@ -325,7 +325,7 @@ class XEP_0048(object):
except KeyError:
raise exceptions.InternalError("Can't find mandatory key")
d = self.addBookmark(XEP_0048.MUC_TYPE, location, bm_data, profile_key=profile)
d.addCallback(lambda dummy: {})
d.addCallback(lambda __: {})
return d
@defer.inlineCallbacks
@ -431,7 +431,7 @@ class XEP_0048(object):
ret = {}
ret_d = defer.succeed(ret)
def fillBookmarks(dummy, _storage_location):
def fillBookmarks(__, _storage_location):
bookmarks_ori = getattr(client, "bookmarks_" + _storage_location)
if bookmarks_ori is None:
return ret
@ -449,7 +449,7 @@ class XEP_0048(object):
else:
d = defer.succeed(None)
d.addCallback(fillBookmarks, _storage_location)
ret_d.addCallback(lambda dummy: d)
ret_d.addCallback(lambda __: d)
return ret_d

View file

@ -386,7 +386,7 @@ class XEP_0054(object):
)
return d
def _getCardCb(self, dummy, client, entity):
def _getCardCb(self, __, client, entity):
try:
return client._cache_0054[entity.full()]["avatar"]
except KeyError:
@ -395,7 +395,7 @@ class XEP_0054(object):
def _getAvatar(self, entity, cache_only, hash_only, profile):
client = self.host.getClient(profile)
d = self.getAvatar(client, jid.JID(entity), cache_only, hash_only)
d.addErrback(lambda dummy: "")
d.addErrback(lambda __: "")
return d
@ -442,7 +442,7 @@ class XEP_0054(object):
if full_path is None:
d.addCallback(client.cache.getFilePath)
else:
d.addCallback(lambda dummy: full_path)
d.addCallback(lambda __: full_path)
return d
@defer.inlineCallbacks
@ -573,7 +573,7 @@ class XEP_0054_handler(XMPPHandler):
def getDiscoItems(self, requestor, target, nodeIdentifier=""):
return []
def _checkAvatarHash(self, dummy, client, entity, given_hash):
def _checkAvatarHash(self, __, client, entity, given_hash):
"""check that hash in cash (i.e. computed hash) is the same as given one"""
# XXX: if they differ, the avater will be requested on each connection
# TODO: try to avoid re-requesting avatar in this case

View file

@ -146,9 +146,9 @@ class XEP_0055(object):
d = self._addSimpleSearchUI(services, main_ui, data, profile)
d.addCallback(
lambda dummy: self._addAdvancedSearchUI(services, main_ui, data, profile)
lambda __: self._addAdvancedSearchUI(services, main_ui, data, profile)
)
return d.addCallback(lambda dummy: {"xmlui": main_ui.toXml()})
return d.addCallback(lambda __: {"xmlui": main_ui.toXml()})
def _addSimpleSearchUI(self, services, main_ui, data, profile):
"""Add to the main UI a tab for the simple search.
@ -160,7 +160,7 @@ class XEP_0055(object):
@param data (dict): form data without SAT_FORM_PREFIX
@param profile (unicode): %(doc_profile)s
@return: a dummy Deferred
@return: a __ Deferred
"""
service_jid = services[
0
@ -219,7 +219,7 @@ class XEP_0055(object):
@param data (dict): form data without SAT_FORM_PREFIX
@param profile (unicode): %(doc_profile)s
@return: a dummy Deferred
@return: a __ Deferred
"""
sub_cont = main_ui.main_container.addTab(
"advanced_search",
@ -282,7 +282,7 @@ class XEP_0055(object):
@param data (dict): form data without SAT_FORM_PREFIX
@param profile (unicode): %(doc_profile)s
@return: a dummy Deferred
@return: a __ Deferred
"""
field_list = data_form.Form.fromElement(form_elt).fieldList
adv_fields = [field.var for field in field_list if field.var]

View file

@ -699,7 +699,7 @@ class Socks5ClientFactory(protocol.ClientFactory):
def getSession(self):
return self.session
def startTransfer(self, dummy=None, chunk_size=None):
def startTransfer(self, __=None, chunk_size=None):
self.session[TIMER_KEY].cancel()
self._protocol_instance.startTransfer(chunk_size)
@ -1019,7 +1019,7 @@ class XEP_0065(object):
)
if connection_cb is not None:
d.addCallback(
lambda dummy, candidate=candidate, client=client: connection_cb(
lambda __, candidate=candidate, client=client: connection_cb(
client, candidate
)
)
@ -1203,7 +1203,7 @@ class XEP_0065(object):
log.info(u"A Socks5 proxy is used")
d = self.connectCandidate(client, candidate, session_data["hash"])
d.addCallback(
lambda dummy: candidate.activate(
lambda __: candidate.activate(
session_data["id"], session_data["peer_jid"], client
)
)
@ -1211,7 +1211,7 @@ class XEP_0065(object):
else:
d = defer.succeed(None)
d.addCallback(lambda dummy: candidate.startTransfer(session_data["hash"]))
d.addCallback(lambda __: candidate.startTransfer(session_data["hash"]))
def _activationEb(self, failure):
log.warning(u"Proxy activation error: {}".format(failure.value))

View file

@ -130,7 +130,7 @@ class XEP_0071(object):
):
continue
treat_d.addCallback(
lambda dummy: self._s.convert(
lambda __: self._s.convert(
body_elt.toXml(), self.SYNTAX_XHTML_IM, safe=True
)
)
@ -138,7 +138,7 @@ class XEP_0071(object):
defers.append(treat_d)
d_list = defer.DeferredList(defers)
d_list.addCallback(lambda dummy: data)
d_list.addCallback(lambda __: data)
return d_list
def _fill_body_text(self, text, data, lang):
@ -193,7 +193,7 @@ class XEP_0071(object):
else:
exceptions.InternalError(u"xhtml or rich should be present at this point")
d_list = defer.DeferredList(defers)
d_list.addCallback(lambda dummy: data)
d_list.addCallback(lambda __: data)
return d_list
def messageReceivedTrigger(self, client, message, post_treat):

View file

@ -252,7 +252,7 @@ class XEP_0077(object):
iq_elt = self.buildRegisterIQ(client.xmlstream, client.jid, new_password)
d = iq_elt.send(client.jid.host)
d.addCallback(
lambda dummy: self.host.memory.setParam(
lambda __: self.host.memory.setParam(
"Password", new_password, "Connection", profile_key=client.profile
)
)

View file

@ -80,7 +80,7 @@ class XEP_0092(object):
"""
client = self.host.getClient(profile_key)
def getVersion(dummy):
def getVersion(__):
iq_elt = compat.IQ(client.xmlstream, "get")
iq_elt["to"] = jid_.full()
iq_elt.addElement("query", NS_VERSION)

View file

@ -257,7 +257,7 @@ class XEP_0096(object):
# misc_elts.append(range_elt)
self._si.acceptStream(client, iq_elt, feature_elt, misc_elts)
def _transferCb(self, dummy, client, data):
def _transferCb(self, __, client, data):
"""Called by the stream method when transfer successfuly finished
@param data: session data
@ -382,7 +382,7 @@ class XEP_0096(object):
else:
log.error(u"Error while proposing stream: {}".format(failure))
def _sendCb(self, dummy, client, sid, stream_object):
def _sendCb(self, __, client, sid, stream_object):
log.info(
_(u"transfer {sid} successfuly finished [{profile}]").format(
sid=sid, profile=client.profile

View file

@ -170,7 +170,7 @@ class XEP_0115_handler(XMPPHandler):
% {"hash_method": c_hash, "jid": from_jid, "node": c_node}
)
def cb(dummy):
def cb(__):
computed_hash = self.host.memory.getEntityDatum(
from_jid, C.ENTITY_CAP_HASH, self.profile
)

Some files were not shown because too many files have changed in this diff Show more