optimize: xrange instead of range
This commit is contained in:
parent
af826817fc
commit
1f1d87019f
|
@ -1346,7 +1346,7 @@ class Chat:
|
||||||
#we don't want size of the buffer to grow indefinately
|
#we don't want size of the buffer to grow indefinately
|
||||||
max_size = gajim.config.get('key_up_lines')
|
max_size = gajim.config.get('key_up_lines')
|
||||||
if size >= max_size:
|
if size >= max_size:
|
||||||
for i in range(0, size - 1):
|
for i in xrange(0, size - 1):
|
||||||
self.sent_history[jid][i] = self.sent_history[jid][i+1]
|
self.sent_history[jid][i] = self.sent_history[jid][i+1]
|
||||||
self.sent_history[jid][max_size - 1] = message
|
self.sent_history[jid][max_size - 1] = message
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -136,7 +136,7 @@ class PreferencesWindow:
|
||||||
l.append(dir)
|
l.append(dir)
|
||||||
if l.count == 0:
|
if l.count == 0:
|
||||||
l.append(' ')
|
l.append(' ')
|
||||||
for i in range(len(l)):
|
for i in xrange(len(l)):
|
||||||
preview = gtk.Image()
|
preview = gtk.Image()
|
||||||
files = []
|
files = []
|
||||||
files.append(os.path.join(gajim.DATA_DIR, 'iconsets', l[i], '16x16', 'online.png'))
|
files.append(os.path.join(gajim.DATA_DIR, 'iconsets', l[i], '16x16', 'online.png'))
|
||||||
|
@ -1097,7 +1097,7 @@ class AccountModificationWindow:
|
||||||
self.proxy_combobox.set_model(model)
|
self.proxy_combobox.set_model(model)
|
||||||
l = gajim.config.get_per('proxies')
|
l = gajim.config.get_per('proxies')
|
||||||
l.insert(0, 'None')
|
l.insert(0, 'None')
|
||||||
for i in range(len(l)):
|
for i in xrange(len(l)):
|
||||||
model.append([l[i]])
|
model.append([l[i]])
|
||||||
if our_proxy == l[i]:
|
if our_proxy == l[i]:
|
||||||
self.proxy_combobox.set_active(i)
|
self.proxy_combobox.set_active(i)
|
||||||
|
|
|
@ -388,7 +388,7 @@ Please specify account for sending the message.') % sys.argv[2])
|
||||||
is_float = True
|
is_float = True
|
||||||
else:
|
else:
|
||||||
is_float = False
|
is_float = False
|
||||||
for i in range(len(value) - 1):
|
for i in xrange(len(value) - 1):
|
||||||
chr = value[i+1]
|
chr = value[i+1]
|
||||||
if chr == '.':
|
if chr == '.':
|
||||||
is_float = True
|
is_float = True
|
||||||
|
@ -410,7 +410,7 @@ Please specify account for sending the message.') % sys.argv[2])
|
||||||
_str = ''
|
_str = ''
|
||||||
previous_slash = False
|
previous_slash = False
|
||||||
slashes = 0
|
slashes = 0
|
||||||
for i in range(len(value) - 1):
|
for i in xrange(len(value) - 1):
|
||||||
chr = value[i+1]
|
chr = value[i+1]
|
||||||
if previous_slash:
|
if previous_slash:
|
||||||
previous_slash = False
|
previous_slash = False
|
||||||
|
|
|
@ -781,7 +781,7 @@ class RosterWindow:
|
||||||
'attached_gpg_keys').split()
|
'attached_gpg_keys').split()
|
||||||
keys = {}
|
keys = {}
|
||||||
keyID = 'None'
|
keyID = 'None'
|
||||||
for i in range(0, len(attached_keys)/2):
|
for i in xrange(0, 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] == user.jid:
|
if attached_keys[2*i] == user.jid:
|
||||||
keyID = attached_keys[2*i+1]
|
keyID = attached_keys[2*i+1]
|
||||||
|
|
|
@ -98,7 +98,7 @@ class SystrayWINAPI:
|
||||||
cblist = self._message_map[key]
|
cblist = self._message_map[key]
|
||||||
if isinstance(cblist, list):
|
if isinstance(cblist, list):
|
||||||
if not len(cblist) < 2:
|
if not len(cblist) < 2:
|
||||||
for i in range(len(cblist)):
|
for i in xrange(len(cblist)):
|
||||||
if cblist[i] == callback:
|
if cblist[i] == callback:
|
||||||
del self._message_map[key][i]
|
del self._message_map[key][i]
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue