xrange() -> list(range())
This commit is contained in:
parent
2c21353a8b
commit
3fdefe20b7
|
@ -916,7 +916,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
|||
scroll = False if pos == size else True # are we scrolling?
|
||||
# we don't want size of the buffer to grow indefinately
|
||||
max_size = gajim.config.get('key_up_lines')
|
||||
for i in xrange(size - max_size + 1):
|
||||
for i in range(size - max_size + 1):
|
||||
if pos == 0:
|
||||
break
|
||||
history.pop(0)
|
||||
|
|
|
@ -68,7 +68,7 @@ class Execute(CommandContainer):
|
|||
|
||||
@classmethod
|
||||
def poller(cls, processor, popen):
|
||||
for x in xrange(cls.POLL_COUNT):
|
||||
for x in list(range(cls.POLL_COUNT)):
|
||||
yield cls.brush(processor, popen)
|
||||
cls.overdue(processor, popen)
|
||||
yield False
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||
##
|
||||
|
||||
from functools import cmp_to_key
|
||||
|
||||
try:
|
||||
from common import caps_cache
|
||||
from common.account import Account
|
||||
|
@ -848,7 +850,7 @@ class MetacontactManager():
|
|||
Which of the family will be the big brother under wich all others will be
|
||||
?
|
||||
"""
|
||||
family.sort(cmp=self._compare_metacontacts)
|
||||
family.sort(key=cmp_to_key(self._compare_metacontacts))
|
||||
return family[-1]
|
||||
|
||||
|
||||
|
|
|
@ -781,7 +781,7 @@ class Socks5:
|
|||
auth_mechanisms = []
|
||||
try:
|
||||
num_auth = struct.unpack('!xB', buff[:2])[0]
|
||||
for i in xrange(num_auth):
|
||||
for i in list(range(num_auth)):
|
||||
mechanism, = struct.unpack('!B', buff[1 + i])
|
||||
auth_mechanisms.append(mechanism)
|
||||
except Exception:
|
||||
|
|
|
@ -173,7 +173,7 @@ class PreferencesWindow:
|
|||
if dir_ != '.svn':
|
||||
l.append(dir_)
|
||||
l.append(_('Disabled'))
|
||||
for i in xrange(len(l)):
|
||||
for i in range(len(l)):
|
||||
model.append([l[i]])
|
||||
if gajim.config.get('emoticons_theme') == l[i]:
|
||||
emoticons_combobox.set_active(i)
|
||||
|
@ -243,7 +243,7 @@ class PreferencesWindow:
|
|||
l.append(dir)
|
||||
if l.count == 0:
|
||||
l.append(' ')
|
||||
for i in xrange(len(l)):
|
||||
for i in range(len(l)):
|
||||
preview = Gtk.Image()
|
||||
files = []
|
||||
files.append(os.path.join(helpers.get_iconset_path(l[i]), '16x16',
|
||||
|
@ -1279,7 +1279,7 @@ class PreferencesWindow:
|
|||
model.clear()
|
||||
l = gajim.config.get_per('proxies')
|
||||
l.insert(0, _('None'))
|
||||
for i in xrange(len(l)):
|
||||
for i in range(len(l)):
|
||||
model.append([l[i]])
|
||||
if our_proxy == l[i]:
|
||||
proxy_combobox.set_active(i)
|
||||
|
@ -1766,7 +1766,7 @@ class AccountsWindow:
|
|||
proxy_combobox.set_model(model)
|
||||
l = gajim.config.get_per('proxies')
|
||||
l.insert(0, _('None'))
|
||||
for i in xrange(len(l)):
|
||||
for i in range(len(l)):
|
||||
model.append([l[i]])
|
||||
if our_proxy == l[i]:
|
||||
proxy_combobox.set_active(i)
|
||||
|
@ -3757,7 +3757,7 @@ class AccountCreationWizardWindow:
|
|||
proxies_combobox.set_model(model)
|
||||
l = gajim.config.get_per('proxies')
|
||||
l.insert(0, _('None'))
|
||||
for i in xrange(len(l)):
|
||||
for i in range(len(l)):
|
||||
model.append([l[i]])
|
||||
proxies_combobox.set_active(0)
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ class DataFormWidget(Gtk.Alignment, object):
|
|||
selection = self.records_treeview.get_selection()
|
||||
model, rowrefs = selection.get_selected_rows()
|
||||
# rowref is a list of paths
|
||||
for i in xrange(len(rowrefs)):
|
||||
for i in list(range(len(rowrefs))):
|
||||
rowrefs[i] = Gtk.TreeRowReference(model, rowrefs[i])
|
||||
# rowref is a list of row references; need to convert because we will
|
||||
# modify the model, paths would change
|
||||
|
@ -566,8 +566,7 @@ class SingleForm(Gtk.Table, object):
|
|||
for uri in field.media.uris:
|
||||
if uri.type_.startswith('image/'):
|
||||
try:
|
||||
img_data = base64.b64decode(uri.uri_data.encode(
|
||||
'utf-8')).decode('utf-8')
|
||||
img_data = base64.decodestring(uri.uri_data)
|
||||
pixbuf_l = GdkPixbuf.PixbufLoader()
|
||||
pixbuf_l.write(img_data)
|
||||
pixbuf_l.close()
|
||||
|
|
|
@ -317,7 +317,7 @@ class HashDigest:
|
|||
|
||||
def __str__(self):
|
||||
prettydigest = ''
|
||||
for i in xrange(0, len(self.digest), 2):
|
||||
for i in list(range(0, len(self.digest), 2)):
|
||||
prettydigest += self.digest[i:i + 2] + ':'
|
||||
return prettydigest[:-1]
|
||||
|
||||
|
@ -1102,7 +1102,7 @@ def label_set_autowrap(widget):
|
|||
"""
|
||||
if isinstance (widget, Gtk.Container):
|
||||
children = widget.get_children()
|
||||
for i in xrange (len (children)):
|
||||
for i in list(range (len (children))):
|
||||
label_set_autowrap(children[i])
|
||||
elif isinstance(widget, Gtk.Label):
|
||||
widget.set_line_wrap(True)
|
||||
|
|
|
@ -106,7 +106,7 @@ class MessageWindow(object):
|
|||
'<Control>b', '<Control>F4',
|
||||
'<Control>w', '<Control>Page_Up', '<Control>Page_Down', '<Alt>Right',
|
||||
'<Alt>Left', '<Alt>d', '<Alt>c', '<Alt>m', '<Alt>t', 'Escape'] + \
|
||||
['<Alt>'+str(i) for i in xrange(10)]
|
||||
['<Alt>'+str(i) for i in list(range(10))]
|
||||
accel_group = Gtk.AccelGroup()
|
||||
for key in keys:
|
||||
keyval, mod = Gtk.accelerator_parse(key)
|
||||
|
@ -856,7 +856,7 @@ class MessageWindow(object):
|
|||
to_right = False
|
||||
horiz = self.notebook.get_tab_pos() == Gtk.PositionType.TOP or \
|
||||
self.notebook.get_tab_pos() == Gtk.PositionType.BOTTOM
|
||||
for i in xrange(self.notebook.get_n_pages()):
|
||||
for i in list(range(self.notebook.get_n_pages())):
|
||||
page = self.notebook.get_nth_page(i)
|
||||
tab = self.notebook.get_tab_label(page)
|
||||
tab_alloc = tab.get_allocation()
|
||||
|
@ -882,7 +882,7 @@ class MessageWindow(object):
|
|||
Find the page num of the tab label
|
||||
"""
|
||||
page_num = -1
|
||||
for i in xrange(self.notebook.get_n_pages()):
|
||||
for i in list(range(self.notebook.get_n_pages())):
|
||||
page = self.notebook.get_nth_page(i)
|
||||
tab = self.notebook.get_tab_label(page)
|
||||
if tab == tab_label:
|
||||
|
|
|
@ -264,7 +264,7 @@ class PluginsWindow(object):
|
|||
return
|
||||
model = self.installed_plugins_model
|
||||
|
||||
for row in xrange(len(model)):
|
||||
for row in list(range(len(model))):
|
||||
if plugin == model[row][PLUGIN]:
|
||||
model.remove(model.get_iter((row, PLUGIN)))
|
||||
break
|
||||
|
|
|
@ -3225,7 +3225,7 @@ class RosterWindow:
|
|||
'attached_gpg_keys').split()
|
||||
keys = {}
|
||||
keyID = _('None')
|
||||
for i in xrange(len(attached_keys)/2):
|
||||
for i in list(range(len(attached_keys)/2)):
|
||||
keys[attached_keys[2*i]] = attached_keys[2*i+1]
|
||||
if attached_keys[2*i] == contact.jid:
|
||||
keyID = attached_keys[2*i+1]
|
||||
|
|
Loading…
Reference in New Issue