[tor-commits] [stem/master] Revert changes to ordereddict.py

atagar at torproject.org atagar at torproject.org
Sun Jan 4 02:29:03 UTC 2015


commit e4d38f6a4f0a44152b49ec4e1378e57c62091cfc
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Jan 3 14:43:40 2015 -0800

    Revert changes to ordereddict.py
    
    Our only reason for having ordereddict.py is python 2.6 compatibility (in
    python 2.7 and 3.x OrderedDict is a builtin). As such no reason to make this
    python 3.x compatible.
---
 stem/util/ordereddict.py |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/stem/util/ordereddict.py b/stem/util/ordereddict.py
index f3f278a..07c7d4e 100644
--- a/stem/util/ordereddict.py
+++ b/stem/util/ordereddict.py
@@ -76,9 +76,9 @@ class OrderedDict(dict, DictMixin):
     if not self:
       raise KeyError('dictionary is empty')
     if last:
-      key = next(reversed(self))
+      key = reversed(self).next()
     else:
-      key = next(iter(self))
+      key = iter(self).next()
     value = self.pop(key)
     return key, value
 
@@ -107,7 +107,7 @@ class OrderedDict(dict, DictMixin):
   def __repr__(self):
     if not self:
       return '%s()' % (self.__class__.__name__,)
-    return '%s(%r)' % (self.__class__.__name__, list(self.items()))
+    return '%s(%r)' % (self.__class__.__name__, self.items())
 
   def copy(self):
     return self.__class__(self)
@@ -123,7 +123,7 @@ class OrderedDict(dict, DictMixin):
     if isinstance(other, OrderedDict):
       if len(self) != len(other):
         return False
-      for p, q in zip(list(self.items()), list(other.items())):
+      for p, q in zip(self.items(), other.items()):
         if p != q:
           return False
       return True





More information about the tor-commits mailing list