changeset d815b4a240ba in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=d815b4a240ba
description: xrange() -> list(range())

diffstat:

 src/chat_control.py                          |   2 +-
 src/command_system/implementation/execute.py |   2 +-
 src/common/contacts.py                       |   4 +++-
 src/common/socks5.py                         |   2 +-
 src/config.py                                |  10 +++++-----
 src/dataforms_widget.py                      |   5 ++---
 src/gtkgui_helpers.py                        |   4 ++--
 src/message_window.py                        |   6 +++---
 src/plugins/gui.py                           |   2 +-
 src/roster_window.py                         |   2 +-
 10 files changed, 20 insertions(+), 19 deletions(-)

diffs (202 lines):

diff -r 5f81631ea012 -r d815b4a240ba src/chat_control.py
--- a/src/chat_control.py       Wed Jan 02 17:53:42 2013 +0100
+++ b/src/chat_control.py       Wed Jan 02 18:17:51 2013 +0100
@@ -916,7 +916,7 @@
         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)
diff -r 5f81631ea012 -r d815b4a240ba 
src/command_system/implementation/execute.py
--- a/src/command_system/implementation/execute.py      Wed Jan 02 17:53:42 
2013 +0100
+++ b/src/command_system/implementation/execute.py      Wed Jan 02 18:17:51 
2013 +0100
@@ -68,7 +68,7 @@
 
     @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
diff -r 5f81631ea012 -r d815b4a240ba src/common/contacts.py
--- a/src/common/contacts.py    Wed Jan 02 17:53:42 2013 +0100
+++ b/src/common/contacts.py    Wed Jan 02 18:17:51 2013 +0100
@@ -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 @@
         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]
 
 
diff -r 5f81631ea012 -r d815b4a240ba src/common/socks5.py
--- a/src/common/socks5.py      Wed Jan 02 17:53:42 2013 +0100
+++ b/src/common/socks5.py      Wed Jan 02 18:17:51 2013 +0100
@@ -781,7 +781,7 @@
         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:
diff -r 5f81631ea012 -r d815b4a240ba src/config.py
--- a/src/config.py     Wed Jan 02 17:53:42 2013 +0100
+++ b/src/config.py     Wed Jan 02 18:17:51 2013 +0100
@@ -173,7 +173,7 @@
             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 @@
                 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 @@
         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 @@
         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 @@
         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)
 
diff -r 5f81631ea012 -r d815b4a240ba src/dataforms_widget.py
--- a/src/dataforms_widget.py   Wed Jan 02 17:53:42 2013 +0100
+++ b/src/dataforms_widget.py   Wed Jan 02 18:17:51 2013 +0100
@@ -277,7 +277,7 @@
         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 @@
                 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()
diff -r 5f81631ea012 -r d815b4a240ba src/gtkgui_helpers.py
--- a/src/gtkgui_helpers.py     Wed Jan 02 17:53:42 2013 +0100
+++ b/src/gtkgui_helpers.py     Wed Jan 02 18:17:51 2013 +0100
@@ -317,7 +317,7 @@
 
     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 @@
     """
     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)
diff -r 5f81631ea012 -r d815b4a240ba src/message_window.py
--- a/src/message_window.py     Wed Jan 02 17:53:42 2013 +0100
+++ b/src/message_window.py     Wed Jan 02 18:17:51 2013 +0100
@@ -106,7 +106,7 @@
                 '<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 @@
         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 @@
         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:
diff -r 5f81631ea012 -r d815b4a240ba src/plugins/gui.py
--- a/src/plugins/gui.py        Wed Jan 02 17:53:42 2013 +0100
+++ b/src/plugins/gui.py        Wed Jan 02 18:17:51 2013 +0100
@@ -264,7 +264,7 @@
                     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
diff -r 5f81631ea012 -r d815b4a240ba src/roster_window.py
--- a/src/roster_window.py      Wed Jan 02 17:53:42 2013 +0100
+++ b/src/roster_window.py      Wed Jan 02 18:17:51 2013 +0100
@@ -3225,7 +3225,7 @@
                 '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]
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to