Commit d6f02426 authored by Philipp Hörist's avatar Philipp Hörist

Fix redefined-argument-from-local pylint errors

parent cbe335b2
......@@ -59,9 +59,9 @@ class StandardCommonCommands(CommandContainer):
return '\n\n'.join(text)
elif all:
for cmd in self.list_commands():
names = ', '.join(cmd.names)
description = cmd.extract_description()
for cmd_ in self.list_commands():
names = ', '.join(cmd_.names)
description = cmd_.extract_description()
self.echo("%s - %s" % (names, description))
else:
......
......@@ -809,11 +809,10 @@ class MetacontactManager():
if not tag:
return []
answers = []
for account in self._metacontacts_tags:
if tag in self._metacontacts_tags[account]:
for data in self._metacontacts_tags[account][tag]:
data['account'] = account
answers.append(data)
if tag in self._metacontacts_tags[account]:
for data in self._metacontacts_tags[account][tag]:
data['account'] = account
answers.append(data)
return answers
def _metacontact_key(self, data):
......
......@@ -38,8 +38,8 @@ class FilesProp:
def getFilePropByAccount(cls, account):
# Returns a list of file_props in one account
file_props = []
for account, sid in cls._files_props:
if account == account:
for account_, sid in cls._files_props:
if account_ == account:
file_props.append(cls._files_props[account, sid])
return file_props
......
......@@ -337,14 +337,15 @@ class ChooseGPGKeyDialog:
class ChangeActivityDialog:
PAGELIST = ['doing_chores', 'drinking', 'eating', 'exercising', 'grooming',
'having_appointment', 'inactive', 'relaxing', 'talking', 'traveling',
'working']
PAGELIST = [
'doing_chores', 'drinking', 'eating', 'exercising', 'grooming',
'having_appointment', 'inactive', 'relaxing', 'talking', 'traveling',
'working']
def __init__(self, on_response, activity=None, subactivity=None, text=''):
def __init__(self, on_response, activity_=None, subactivity_=None, text=''):
self.on_response = on_response
self.activity = activity
self.subactivity = subactivity
self.activity = activity_
self.subactivity = subactivity_
self.text = text
self.xml = gtkgui_helpers.get_gtk_builder('change_activity_dialog.ui')
self.window = self.xml.get_object('change_activity_dialog')
......@@ -360,7 +361,7 @@ class ChangeActivityDialog:
for category in ACTIVITIES:
item = self.xml.get_object(category + '_image')
item.set_from_pixbuf(
gtkgui_helpers.load_activity_icon(category).get_pixbuf())
gtkgui_helpers.load_activity_icon(category).get_pixbuf())
item.set_tooltip_text(ACTIVITIES[category]['category'])
vbox = self.xml.get_object(category + '_vbox')
......@@ -375,21 +376,19 @@ class ChangeActivityDialog:
else:
rbtns[act] = group = Gtk.RadioButton()
icon = gtkgui_helpers.load_activity_icon(category, self.activity)
hbox = Gtk.HBox(homogeneous=False, spacing=5)
hbox.pack_start(gtkgui_helpers.load_activity_icon(category,
activity), False, False, 0)
lbl = Gtk.Label(label='<b>' + ACTIVITIES[category]['category'] \
+ '</b>')
hbox.pack_start(icon, False, False, 0)
lbl = Gtk.Label(
label='<b>%s</b>' % ACTIVITIES[category]['category'])
lbl.set_use_markup(True)
hbox.pack_start(lbl, False, False, 0)
rbtns[act].add(hbox)
rbtns[act].connect('toggled', self.on_rbtn_toggled,
[category, 'other'])
rbtns[act].connect(
'toggled', self.on_rbtn_toggled, [category, 'other'])
vbox.pack_start(rbtns[act], False, False, 0)
activities = []
for activity in ACTIVITIES[category]:
activities.append(activity)
activities = list(ACTIVITIES[category].keys())
activities.sort()
for activity in activities:
if activity == 'category':
......@@ -403,13 +402,13 @@ class ChangeActivityDialog:
else:
rbtns[act] = group = Gtk.RadioButton()
icon = gtkgui_helpers.load_activity_icon(category, activity)
label = Gtk.Label(label=ACTIVITIES[category][activity])
hbox = Gtk.HBox(homogeneous=False, spacing=5)
hbox.pack_start(gtkgui_helpers.load_activity_icon(category,
activity), False, False, 0)
hbox.pack_start(Gtk.Label(label=ACTIVITIES[category][activity]),
False, False, 0)
rbtns[act].connect('toggled', self.on_rbtn_toggled,
[category, activity])
hbox.pack_start(icon, False, False, 0)
hbox.pack_start(label, False, False, 0)
rbtns[act].connect(
'toggled', self.on_rbtn_toggled, [category, activity])
rbtns[act].add(hbox)
vbox.pack_start(rbtns[act], False, False, 0)
......@@ -427,8 +426,7 @@ class ChangeActivityDialog:
self.entry.set_sensitive(True)
self.notebook.set_current_page(
self.PAGELIST.index(self.activity))
self.PAGELIST.index(self.activity))
self.entry.set_text(text)
else:
......@@ -454,8 +452,8 @@ class ChangeActivityDialog:
Return activity and messsage (None if no activity selected)
"""
if self.checkbutton.get_active():
self.on_response(self.activity, self.subactivity,
self.entry.get_text())
self.on_response(
self.activity, self.subactivity, self.entry.get_text())
else:
self.on_response(None, None, '')
self.window.destroy()
......@@ -466,9 +464,9 @@ class ChangeActivityDialog:
class ChangeMoodDialog:
COLS = 11
def __init__(self, on_response, mood=None, text=''):
def __init__(self, on_response, mood_=None, text=''):
self.on_response = on_response
self.mood = mood
self.mood = mood_
self.text = text
self.xml = gtkgui_helpers.get_gtk_builder('change_mood_dialog.ui')
......@@ -1418,18 +1416,18 @@ class TransformChatToMUC:
# transports, zeroconf contacts, minimized groupchats
def invitable(contact, contact_transport=None):
return (contact.jid not in self.auto_jids and
contact.jid != app.get_jid_from_account(self.account) and
contact.jid != app.get_jid_from_account(account) and
contact.jid not in app.interface.minimized_controls[account] and
not contact.is_transport() and
contact_transport in ('jabber', None))
# set jabber id and pseudos
for account in app.contacts.get_accounts():
if app.connections[account].is_zeroconf:
for account_ in app.contacts.get_accounts():
if app.connections[account_].is_zeroconf:
continue
for jid in app.contacts.get_jid_list(account):
for jid in app.contacts.get_jid_list(account_):
contact = app.contacts.get_contact_with_highest_priority(
account, jid)
account_, jid)
contact_transport = app.get_transport_name_from_jid(jid)
# Add contact if it can be invited
if invitable(contact, contact_transport) and \
......
......@@ -126,7 +126,7 @@ class Section(Gtk.Box):
else:
# We dont have a image for the base codepoint
# so skip all modifiers of it
for codepoint, attrs in variations.items():
for _entry in variations:
pixbuf = self._get_next_pixbuf()
return True
......
......@@ -438,12 +438,12 @@ class GajimRemote(Server):
contact = app.contacts.get_contact_with_highest_priority(
account, jid)
else:
for account in accounts:
for account_ in accounts:
contact = app.contacts.get_contact_with_highest_priority(
account, jid)
if contact and app.connections[account].connected > 1:
if contact and app.connections[account_].connected > 1:
# account is connected
connected_account = account
connected_account = account_
break
if not contact:
contact = jid
......@@ -468,12 +468,12 @@ class GajimRemote(Server):
# account and groupchat are connected
connected_account = account
else:
for account in accounts:
if app.connections[account].connected > 1 and \
room_jid in app.gc_connected[account] and \
app.gc_connected[account][room_jid]:
for account_ in accounts:
if app.connections[account_].connected > 1 and \
room_jid in app.gc_connected[account_] and \
app.gc_connected[account_][room_jid]:
# account and groupchat are connected
connected_account = account
connected_account = account_
break
return connected_account
......@@ -813,13 +813,13 @@ class GajimRemote(Server):
if account:
accounts = [account]
contact_exists = False
for account in accounts:
contacts = app.contacts.get_contacts(account, jid)
for account_ in accounts:
contacts = app.contacts.get_contacts(account_, jid)
if contacts:
app.connections[account].get_module('Presence').unsubscribe(jid)
app.connections[account_].get_module('Presence').unsubscribe(jid)
for contact in contacts:
app.interface.roster.remove_contact(contact, account)
app.contacts.remove_jid(account, jid)
app.interface.roster.remove_contact(contact, account_)
app.contacts.remove_jid(account_, jid)
contact_exists = True
return contact_exists
......@@ -841,14 +841,14 @@ class GajimRemote(Server):
if jid.startswith('xmpp:'):
return jid[5:] # len('xmpp:') = 5
nick_in_roster = None # Is jid a nick ?
for account in accounts:
for account_ in accounts:
# Does jid exists in roster of one account ?
if app.contacts.get_contacts(account, jid):
if app.contacts.get_contacts(account_, jid):
return jid
if not nick_in_roster:
# look in all contact if one has jid as nick
for jid_ in app.contacts.get_jid_list(account):
c = app.contacts.get_contacts(account, jid_)
for jid_ in app.contacts.get_jid_list(account_):
c = app.contacts.get_contacts(account_, jid_)
if c[0].name == jid:
nick_in_roster = jid_
break
......
......@@ -3842,7 +3842,7 @@ class RosterWindow:
self._toggeling_row = True
model = widget.get_model()
child_model = model.get_model()
child_iter = model.convert_iter_to_child_iter(titer)
child_iter = model.convert_iter_to_child_iter(titer)
if self.regroup: # merged accounts
accounts = list(app.connections.keys())
......@@ -3867,8 +3867,8 @@ class RosterWindow:
app.contacts.is_big_brother(account, jid, accounts) and \
account + group + jid not in self.collapsed_rows:
titers = self._get_contact_iter(jid, account)
for titer in titers:
path = model.get_path(titer)
for titer_ in titers:
path = model.get_path(titer_)
self.tree.expand_row(path, False)
elif type_ == 'account':
account = list(accounts)[0] # There is only one cause we don't use merge
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment