Porting code to Python 3 with 2to3

ne

FIXME intro

Python 2 Python 3
if x <> y: if x != y:

has_key

FIXME intro

apply

FIXME intro

intern

FIXME intro

print

FIXME intro

exec

FIXME intro

repr

FIXME intro

except

FIXME intro

raise

FIXME intro

throw

FIXME intro

long

FIXME intro

dict

FIXME intro

xrange

FIXME intro

raw_input

FIXME intro

funcattrs

FIXME intro

xreadlines

FIXME intro

imports

FIXME intro

imports2

FIXME intro

1533: fixer = None

urllib

FIXME intro

input

FIXME intro

tuple_params

FIXME intro

methodattrs

FIXME intro

next

FIXME intro

nonzero

FIXME intro

numliterals

FIXME intro

renames

FIXME intro

unicode

FIXME intro

callable

FIXME intro

filter

FIXME intro

map

FIXME intro

zip

FIXME intro

standarderror

FIXME intro

types

FIXME intro

idioms

FIXME intro

basestring

FIXME intro

buffer

FIXME intro

future

FIXME intro

itertools

FIXME intro

3256: fixer = 'itertools_imports'

import

FIXME intro

set_literal

FIXME intro

sys_exc

FIXME intro

paren

FIXME intro

3657: fixer = 'metaclass' 3822: fixer = 'getcwdu' # Lib/lib2to3/tests/test_fixers.py - <> - has_key - apply() - intern() - print - exec() - repr() - except - raise - throw - long() - dict() - xrange() - raw_input() - input() - func_* attributes - xreadlines() - imports of modules that have been renamed: # Lib/lib2to3/fixes/fix_imports.py MAPPING = {'StringIO': 'io', 'cStringIO': 'io', 'cPickle': 'pickle', '__builtin__' : 'builtins', 'copy_reg': 'copyreg', 'Queue': 'queue', 'SocketServer': 'socketserver', 'ConfigParser': 'configparser', 'repr': 'reprlib', 'FileDialog': 'tkinter.filedialog', 'tkFileDialog': 'tkinter.filedialog', 'SimpleDialog': 'tkinter.simpledialog', 'tkSimpleDialog': 'tkinter.simpledialog', 'tkColorChooser': 'tkinter.colorchooser', 'tkCommonDialog': 'tkinter.commondialog', 'Dialog': 'tkinter.dialog', 'Tkdnd': 'tkinter.dnd', 'tkFont': 'tkinter.font', 'tkMessageBox': 'tkinter.messagebox', 'ScrolledText': 'tkinter.scrolledtext', 'turtle': 'tkinter.turtle', 'Tkconstants': 'tkinter.constants', 'Tix': 'tkinter.tix', 'Tkinter': 'tkinter', 'markupbase': '_markupbase', '_winreg': 'winreg', 'thread': '_thread', 'dummy_thread': '_dummy_thread', # anydbm and whichdb are handled by fix_imports2 'dbhash': 'dbm.bsd', 'dumbdbm': 'dbm.dumb', 'dbm': 'dbm.ndbm', 'gdbm': 'dbm.gnu', 'xmlrpclib': 'xmlrpc.client', 'DocXMLRPCServer': 'xmlrpc.server', 'SimpleXMLRPCServer': 'xmlrpc.server', 'httplib': 'http.client', 'Cookie': 'http.cookies', 'cookielib': 'http.cookiejar', 'BaseHTTPServer': 'http.server', 'SimpleHTTPServer': 'http.server', 'CGIHTTPServer': 'http.server', #'test.test_support': 'test.support', 'commands': 'subprocess', 'UserString' : 'collections', 'UserList' : 'collections', 'urlparse' : 'urllib.parse', 'robotparser' : 'urllib.robotparser', } - imports of urllib/urllib2 # Lib/lib2to3/fixes/fix_urllib.py MAPPING = {'urllib': [ ('urllib.request', ['URLOpener', 'FancyURLOpener', 'urlretrieve', '_urlopener', 'urlcleanup']), ('urllib.parse', ['quote', 'quote_plus', 'unquote', 'unquote_plus', 'urlencode', 'pahtname2url', 'url2pathname']), ('urllib.error', ['ContentTooShortError'])], 'urllib2' : [ ('urllib.request', ['urlopen', 'install_opener', 'build_opener', 'Request', 'OpenerDirector', 'BaseHandler', 'HTTPDefaultErrorHandler', 'HTTPRedirectHandler', 'HTTPCookieProcessor', 'ProxyHandler', 'HTTPPasswordMgr', 'HTTPPasswordMgrWithDefaultRealm', 'AbstractBasicAuthHandler', 'HTTPBasicAuthHandler', 'ProxyBasicAuthHandler', 'AbstractDigestAuthHandler', 'HTTPDigestAuthHander', 'ProxyDigestAuthHandler', 'HTTPHandler', 'HTTPSHandler', 'FileHandler', 'FTPHandler', 'CacheFTPHandler', 'UnknownHandler']), ('urllib.error', ['URLError', 'HTTPError'])], } - tuple params (?!??!) - __class__ special attribute - __nonzero__ special method - next() - sys.maxint and sys.maxsize - number literals - Unicode string literals - callable() - filter() - map() - zip() - StandardError() - types module - basestring type - itertools functions - itertools imports - relative imports - sys.exc_type, sys.exc_value, sys.exc_traceback - list comprehensions over tuples - os.getcwdu() - metaclasses - set literals (EXPLICIT) - whitespace around commas (EXPLICIT) - buffer() (EXPLICIT) - common idioms (EXPLICIT) - while 1 - type(X) == T, type(X) != T - type(X) is T, type(X) is not T - T is type(X), T is not type(X) - list.sort()