Fix redefined-builtin pylint errors

This commit is contained in:
Philipp Hörist 2018-09-18 13:54:25 +02:00 committed by Philipp Hörist
parent f12dfb811d
commit c156f02cc0
11 changed files with 47 additions and 47 deletions

View File

@ -89,8 +89,8 @@ class ChatCommandProcessor(CommandProcessor):
# the /help command. Don't forget to pass self, as all commands
# are unbound. And also don't forget to print output.
if 'h' in kwargs or 'help' in kwargs:
help = self.get_command('help')
self.echo(help(self, name))
help_ = self.get_command('help')
self.echo(help_(self, name))
return True
def command_postprocessor(self, command, name, arguments, args, kwargs, value):
@ -111,29 +111,29 @@ class CommandTools:
self.install_tags()
def install_tags(self):
buffer = self.conv_textview.tv.get_buffer()
buffer_ = self.conv_textview.tv.get_buffer()
name = "Monospace"
font = Pango.FontDescription(name)
command_ok_tag = buffer.create_tag("command_ok")
command_ok_tag = buffer_.create_tag("command_ok")
command_ok_tag.set_property("font-desc", font)
command_ok_tag.set_property("foreground", "#3465A4")
command_error_tag = buffer.create_tag("command_error")
command_error_tag = buffer_.create_tag("command_error")
command_error_tag.set_property("font-desc", font)
command_error_tag.set_property("foreground", "#F57900")
def shift_line(self):
buffer = self.conv_textview.tv.get_buffer()
iter = buffer.get_end_iter()
if iter.ends_line() and not iter.is_start():
buffer.insert_with_tags_by_name(iter, "\n", "eol")
buffer_ = self.conv_textview.tv.get_buffer()
iter_ = buffer_.get_end_iter()
if iter_.ends_line() and not iter_.is_start():
buffer_.insert_with_tags_by_name(iter_, "\n", "eol")
def append_with_tags(self, text, *tags):
buffer = self.conv_textview.tv.get_buffer()
iter = buffer.get_end_iter()
buffer.insert_with_tags_by_name(iter, text, *tags)
buffer_ = self.conv_textview.tv.get_buffer()
iter_ = buffer_.get_end_iter()
buffer_.insert_with_tags_by_name(iter_, text, *tags)
def echo(self, text, tag="command_ok"):
"""

View File

@ -66,8 +66,8 @@ class StandardCommonCommands(CommandContainer):
self.echo("%s - %s" % (names, description))
else:
help = self.get_command('help')
self.echo(help(self, 'help'))
help_ = self.get_command('help')
self.echo(help_(self, 'help'))
@command(raw=True)
@doc(_("Send a message to the contact"))

View File

@ -415,8 +415,8 @@ class CapsCache:
def forget_caps(self, client_caps):
hash_method = client_caps._hash_method
hash = client_caps._hash
key = (hash_method, hash)
hash_ = client_caps._hash
key = (hash_method, hash_)
if key in self.__cache:
del self.__cache[key]

View File

@ -503,8 +503,8 @@ def sanitize_filename(filename):
"""
# 48 is the limit
if len(filename) > 48:
hash = hashlib.md5(filename.encode('utf-8'))
filename = base64.b64encode(hash.digest()).decode('utf-8')
hash_ = hashlib.md5(filename.encode('utf-8'))
filename = base64.b64encode(hash_.digest()).decode('utf-8')
# make it latin chars only
filename = punycode_encode(filename).decode('utf-8')
@ -729,7 +729,7 @@ def check_soundfile_path(file_, dirs=None):
return d
return None
def strip_soundfile_path(file_, dirs=None, abs=True):
def strip_soundfile_path(file_, dirs=None, abs_=True):
"""
Remove knowns paths from a sound file
@ -737,7 +737,7 @@ def strip_soundfile_path(file_, dirs=None, abs=True):
So config have no hardcoded path to DATA_DIR and text in textfield is shorther.
param: file_: the filename to strip.
param: dirs: list of knowns paths from which the filename should be stripped.
param: abs: force absolute path on dirs
param: abs_: force absolute path on dirs
"""
if not file_:
return None
@ -749,7 +749,7 @@ def strip_soundfile_path(file_, dirs=None, abs=True):
name = os.path.basename(file_)
for d in dirs:
d = os.path.join(d, 'sounds', name)
if abs:
if abs_:
d = os.path.abspath(d)
if file_ == d:
return name

View File

@ -331,12 +331,12 @@ class SocksQueue:
result = sender.send_file()
self.process_result(result, sender)
def isHashInSockObjs(self, sockobjs, hash):
def isHashInSockObjs(self, sockobjs, hash_):
'''
It tells wether there is a particular hash in sockobjs or not
'''
for key in sockobjs:
if hash in key:
if hash_ in key:
return True
return False

View File

@ -429,8 +429,8 @@ class SingleForm(Gtk.Table):
else:
# more than 5 options: show combobox
def on_list_multi_treeview_changed(selection, f):
def for_selected(treemodel, path, iter):
vals.append(treemodel[iter][1])
def for_selected(treemodel, path, iter_):
vals.append(treemodel[iter_][1])
vals = []
selection.selected_foreach(for_selected)
field.values = vals[:]

View File

@ -1989,9 +1989,9 @@ class DiscussionGroupsBrowser(AgentBrowser):
def _get_iter(self, node):
''' Look for an iter with the given node '''
self.found_iter = None
def is_node(model, path, iter, node):
if model[iter][1] == node:
self.found_iter = iter
def is_node(model, path, iter_, node):
if model[iter_][1] == node:
self.found_iter = iter_
return True
self.model.foreach(is_node, node)
return self.found_iter

View File

@ -180,12 +180,12 @@ class Preferences(Gtk.ApplicationWindow):
self.iconset_combobox.add_attribute(renderer_image, 'image', 0)
self.iconset_combobox.set_model(model)
l = []
for dir in iconsets_list:
if not os.path.isdir(os.path.join(configpaths.get('DATA'), 'iconsets', dir)) \
and not os.path.isdir(os.path.join(configpaths.get('MY_ICONSETS'), dir)):
for dir_ in iconsets_list:
if not os.path.isdir(os.path.join(configpaths.get('DATA'), 'iconsets', dir_)) \
and not os.path.isdir(os.path.join(configpaths.get('MY_ICONSETS'), dir_)):
continue
if dir != '.svn' and dir != 'transports':
l.append(dir)
if dir_ not in ('.svn', 'transports'):
l.append(dir_)
if l.count == 0:
l.append(' ')
for i in range(len(l)):

View File

@ -555,9 +555,9 @@ def create_list_multi(value_list, selected_values=None):
col.pack_start(cell, True)
col.set_attributes(cell, text=0)
for value in value_list:
iter = liststore.append(value)
iter_ = liststore.append(value)
if value[1] in selected_values:
treeview.get_selection().select_iter(iter)
treeview.get_selection().select_iter(iter_)
treeview.show_all()
return treeview

View File

@ -122,9 +122,9 @@ class PluginsWindow:
@log_calls('PluginsWindow')
def installed_plugins_treeview_selection_changed(self, treeview_selection):
model, iter = treeview_selection.get_selected()
if iter:
plugin = model.get_value(iter, Column.PLUGIN)
model, iter_ = treeview_selection.get_selected()
if iter_:
plugin = model.get_value(iter_, Column.PLUGIN)
self._display_installed_plugin_info(plugin)
else:
self._clear_installed_plugin_info()
@ -207,9 +207,9 @@ class PluginsWindow:
@log_calls('PluginsWindow')
def on_configure_plugin_button_clicked(self, widget):
selection = self.installed_plugins_treeview.get_selection()
model, iter = selection.get_selected()
if iter:
plugin = model.get_value(iter, Column.PLUGIN)
model, iter_ = selection.get_selected()
if iter_:
plugin = model.get_value(iter_, Column.PLUGIN)
if isinstance(plugin.config_dialog, GajimPluginConfigDialog):
plugin.config_dialog.run(self.window)
@ -225,16 +225,16 @@ class PluginsWindow:
@log_calls('PluginsWindow')
def on_uninstall_plugin_button_clicked(self, widget):
selection = self.installed_plugins_treeview.get_selection()
model, iter = selection.get_selected()
if iter:
plugin = model.get_value(iter, Column.PLUGIN)
model, iter_ = selection.get_selected()
if iter_:
plugin = model.get_value(iter_, Column.PLUGIN)
try:
app.plugin_manager.uninstall_plugin(plugin)
except PluginsystemError as e:
WarningDialog(_('Unable to properly remove the plugin'),
str(e), self.window)
return
model.remove(iter)
model.remove(iter_)
@log_calls('PluginsWindow')
def on_install_plugin_button_clicked(self, widget):

View File

@ -3401,8 +3401,8 @@ class RosterWindow:
def expand_group_row(self, path):
self.tree.expand_row(path, False)
iter = self.modelfilter.get_iter(path)
child_iter = self.modelfilter.iter_children(iter)
iter_ = self.modelfilter.get_iter(path)
child_iter = self.modelfilter.iter_children(iter_)
while child_iter:
type_ = self.modelfilter[child_iter][Column.TYPE]
account = self.modelfilter[child_iter][Column.ACCOUNT]