Remove wrong usage of the list(range(…)) pattern.

This commit is contained in:
Emmanuel Gil Peyrot 2017-02-07 20:05:27 +00:00
parent 5f91455fb9
commit fb221a692b
7 changed files with 11 additions and 11 deletions

View File

@ -68,7 +68,7 @@ class Execute(CommandContainer):
@classmethod @classmethod
def poller(cls, processor, popen): def poller(cls, processor, popen):
for x in list(range(cls.POLL_COUNT)): for _ in range(cls.POLL_COUNT):
yield cls.brush(processor, popen) yield cls.brush(processor, popen)
cls.overdue(processor, popen) cls.overdue(processor, popen)
yield False yield False

View File

@ -825,7 +825,7 @@ class Socks5(object):
auth_mechanisms = [] auth_mechanisms = []
try: try:
num_auth = struct.unpack('!xB', buff[:2])[0] num_auth = struct.unpack('!xB', buff[:2])[0]
for i in list(range(num_auth)): for i in range(num_auth):
mechanism, = struct.unpack('!B', buff[1 + i]) mechanism, = struct.unpack('!B', buff[1 + i])
auth_mechanisms.append(mechanism) auth_mechanisms.append(mechanism)
except Exception: except Exception:

View File

@ -279,7 +279,7 @@ class DataFormWidget(Gtk.Alignment, object):
selection = self.records_treeview.get_selection() selection = self.records_treeview.get_selection()
model, rowrefs = selection.get_selected_rows() model, rowrefs = selection.get_selected_rows()
# rowref is a list of paths # rowref is a list of paths
for i in list(range(len(rowrefs))): for i in range(len(rowrefs)):
rowrefs[i] = Gtk.TreeRowReference.new(model, rowrefs[i]) rowrefs[i] = Gtk.TreeRowReference.new(model, rowrefs[i])
# rowref is a list of row references; need to convert because we will # rowref is a list of row references; need to convert because we will
# modify the model, paths would change # modify the model, paths would change

View File

@ -362,7 +362,7 @@ class HashDigest:
def __str__(self): def __str__(self):
prettydigest = '' prettydigest = ''
for i in list(range(0, len(self.digest), 2)): for i in range(0, len(self.digest), 2):
prettydigest += self.digest[i:i + 2] + ':' prettydigest += self.digest[i:i + 2] + ':'
return prettydigest[:-1] return prettydigest[:-1]

View File

@ -120,7 +120,7 @@ class MessageWindow(object):
'<Control>b', '<Control>F4', '<Control>b', '<Control>F4',
'<Control>w', '<Control>Page_Up', '<Control>Page_Down', '<Alt>Right', '<Control>w', '<Control>Page_Up', '<Control>Page_Down', '<Alt>Right',
'<Alt>Left', '<Alt>d', '<Alt>c', '<Alt>m', '<Alt>t', 'Escape'] + \ '<Alt>Left', '<Alt>d', '<Alt>c', '<Alt>m', '<Alt>t', 'Escape'] + \
['<Alt>'+str(i) for i in list(range(10))] ['<Alt>'+str(i) for i in range(10)]
accel_group = Gtk.AccelGroup() accel_group = Gtk.AccelGroup()
for key in keys: for key in keys:
keyval, mod = Gtk.accelerator_parse(key) keyval, mod = Gtk.accelerator_parse(key)
@ -877,7 +877,7 @@ class MessageWindow(object):
to_right = False to_right = False
horiz = self.notebook.get_tab_pos() == Gtk.PositionType.TOP or \ horiz = self.notebook.get_tab_pos() == Gtk.PositionType.TOP or \
self.notebook.get_tab_pos() == Gtk.PositionType.BOTTOM self.notebook.get_tab_pos() == Gtk.PositionType.BOTTOM
for i in list(range(self.notebook.get_n_pages())): for i in range(self.notebook.get_n_pages()):
page = self.notebook.get_nth_page(i) page = self.notebook.get_nth_page(i)
tab = self.notebook.get_tab_label(page) tab = self.notebook.get_tab_label(page)
tab_alloc = tab.get_allocation() tab_alloc = tab.get_allocation()
@ -903,7 +903,7 @@ class MessageWindow(object):
Find the page num of the tab label Find the page num of the tab label
""" """
page_num = -1 page_num = -1
for i in list(range(self.notebook.get_n_pages())): for i in range(self.notebook.get_n_pages()):
page = self.notebook.get_nth_page(i) page = self.notebook.get_nth_page(i)
tab = self.notebook.get_tab_label(page) tab = self.notebook.get_tab_label(page)
if tab == tab_label: if tab == tab_label:

View File

@ -270,9 +270,9 @@ class PluginsWindow(object):
return return
model = self.installed_plugins_model model = self.installed_plugins_model
for row in list(range(len(model))): for i, row in enumerate(model):
if plugin == model[row][PLUGIN]: if plugin == row[PLUGIN]:
model.remove(model.get_iter((row, PLUGIN))) model.remove(model.get_iter((i, PLUGIN)))
break break
iter_ = model.append([plugin, plugin.name, False, iter_ = model.append([plugin, plugin.name, False,

View File

@ -3081,7 +3081,7 @@ class RosterWindow:
'attached_gpg_keys').split() 'attached_gpg_keys').split()
keys = {} keys = {}
keyID = _('None') keyID = _('None')
for i in list(range(int(len(attached_keys)/2))): for i in range(len(attached_keys) // 2):
keys[attached_keys[2*i]] = attached_keys[2*i+1] keys[attached_keys[2*i]] = attached_keys[2*i+1]
if attached_keys[2*i] == contact.jid: if attached_keys[2*i] == contact.jid:
keyID = attached_keys[2*i+1] keyID = attached_keys[2*i+1]