libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1448492 - /libcloud/trunk/libcloud/utils/py3.py
Date Thu, 21 Feb 2013 02:49:14 GMT
Author: tomaz
Date: Thu Feb 21 02:49:14 2013
New Revision: 1448492

URL: http://svn.apache.org/r1448492
Log:
Fix some Python 3 compatibility issues.

Modified:
    libcloud/trunk/libcloud/utils/py3.py

Modified: libcloud/trunk/libcloud/utils/py3.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/utils/py3.py?rev=1448492&r1=1448491&r2=1448492&view=diff
==============================================================================
--- libcloud/trunk/libcloud/utils/py3.py (original)
+++ libcloud/trunk/libcloud/utils/py3.py Thu Feb 21 02:49:14 2013
@@ -48,17 +48,22 @@ if PY3:
     import urllib as urllib2
     import urllib.parse as urlparse
     import xmlrpc.client as xmlrpclib
+
     from urllib.parse import quote as urlquote
     from urllib.parse import unquote as urlunquote
     from urllib.parse import urlencode as urlencode
     from os.path import relpath
 
+    from imp import reload
+
+    from builtins import bytes
+    from builtins import next
+
     basestring = str
 
     def method_type(callable, instance, klass):
         return types.MethodType(callable, instance or klass())
 
-    bytes = __builtins__['bytes']
     def b(s):
         if isinstance(s, str):
             return s.encode('utf-8')
@@ -70,7 +75,7 @@ if PY3:
         # assume n is a Latin-1 string of length 1
         return ord(n)
     u = str
-    next = __builtins__['next']
+
     def dictvalues(d):
         return list(d.values())
 
@@ -87,6 +92,8 @@ else:
     from urllib import unquote as urlunquote
     from urllib import urlencode as urlencode
 
+    from __builtin__ import reload
+
     if not PY25:
         from os.path import relpath
 
@@ -122,8 +129,3 @@ if PY25:
         if not rel_list:
             return posixpath.curdir
         return posixpath.join(*rel_list)
-
-if PY32:
-    from imp import reload
-else:
-    from __builtin__ import reload



Mime
View raw message