MigraciĆ³ 4.8 a 5.0 Dev

configparser

-try:
-    from configparser import ConfigParser
-except ImportError:
-    from ConfigParser import ConfigParser
+from configparser import ConfigParser

metaclass

-class Party:
-    __metaclass__ = PoolMeta
+class Party(metaclass=PoolMeta):

urlib

-import urllib
+import urllib.request, urllib.parse, urllib.error

-                location = urllib.urlretrieve(self.remote_path)[0]
+                location = urllib.request.urlretrieve(self.remote_path)[0]

umask

-                os.makedirs(directory, 0775)
-            os.umask(0022)
+                os.makedirs(directory, 0o775)
+            os.umask(0o022)

utf8

-        if isinstance(value, unicode):
-            name = slug.slug(value)
-        else:
-            name = slug.slug(unicode(value, 'UTF-8'))
+        name = slug.slug(value)

- return u''
+ return ''

try/except

-    except Exception, e:
+    except Exception as e:

-    except TypeError, e:
+    except TypeError as e:

Dict

- .iteritems()
+ .items()

Migracio4.8-5.0-dev (last edited 2018-09-15 08:04:24 by resteve)

Contenidos creados por el equipo de Zikzakmedia. Creative Commons By-NC-SA

PythonZikzakmedia