diff options
Diffstat (limited to 'Lib/lib2to3')
-rw-r--r-- | Lib/lib2to3/fixes/fix_imports.py | 5 | ||||
-rw-r--r-- | Lib/lib2to3/fixes/fix_imports2.py | 2 | ||||
-rw-r--r-- | Lib/lib2to3/fixes/fix_urllib.py | 13 | ||||
-rw-r--r-- | Lib/lib2to3/pgen2/driver.py | 3 |
4 files changed, 15 insertions, 8 deletions
diff --git a/Lib/lib2to3/fixes/fix_imports.py b/Lib/lib2to3/fixes/fix_imports.py index 98d4406..08be543 100644 --- a/Lib/lib2to3/fixes/fix_imports.py +++ b/Lib/lib2to3/fixes/fix_imports.py @@ -25,7 +25,6 @@ MAPPING = {'StringIO': 'io', 'tkFont': 'tkinter.font', 'tkMessageBox': 'tkinter.messagebox', 'ScrolledText': 'tkinter.scrolledtext', - 'turtle': 'tkinter.turtle', 'Tkconstants': 'tkinter.constants', 'Tix': 'tkinter.tix', 'Tkinter': 'tkinter', @@ -89,6 +88,10 @@ class FixImports(fixer_base.BaseFix): # This is overridden in fix_imports2. mapping = MAPPING + # We want to run this fixer late, so fix_import doesn't try to make stdlib + # renames into relative imports. + run_order = 6 + def build_pattern(self): return "|".join(build_pattern(self.mapping)) diff --git a/Lib/lib2to3/fixes/fix_imports2.py b/Lib/lib2to3/fixes/fix_imports2.py index 477bafd..9a33c67 100644 --- a/Lib/lib2to3/fixes/fix_imports2.py +++ b/Lib/lib2to3/fixes/fix_imports2.py @@ -11,6 +11,6 @@ MAPPING = { class FixImports2(fix_imports.FixImports): - run_order = 6 + run_order = 7 mapping = MAPPING diff --git a/Lib/lib2to3/fixes/fix_urllib.py b/Lib/lib2to3/fixes/fix_urllib.py index 1e74bff..89abfc4 100644 --- a/Lib/lib2to3/fixes/fix_urllib.py +++ b/Lib/lib2to3/fixes/fix_urllib.py @@ -15,7 +15,10 @@ MAPPING = {'urllib': [ '_urlopener', 'urlcleanup']), ('urllib.parse', ['quote', 'quote_plus', 'unquote', 'unquote_plus', - 'urlencode', 'pahtname2url', 'url2pathname']), + 'urlencode', 'pathname2url', 'url2pathname', 'splitattr', + 'splithost', 'splitnport', 'splitpasswd', 'splitport', + 'splitquery', 'splittag', 'splittype', 'splituser', + 'splitvalue', ]), ('urllib.error', ['ContentTooShortError'])], 'urllib2' : [ @@ -34,12 +37,12 @@ MAPPING = {'urllib': [ 'FTPHandler', 'CacheFTPHandler', 'UnknownHandler']), ('urllib.error', - ['URLError', 'HTTPError'])], + ['URLError', 'HTTPError']), + ] } - -# def alternates(members): -# return "(" + "|".join(map(repr, members)) + ")" +# Duplicate the url parsing functions for urllib2. +MAPPING["urllib2"].append(MAPPING["urllib"][1]) def build_pattern(): diff --git a/Lib/lib2to3/pgen2/driver.py b/Lib/lib2to3/pgen2/driver.py index b08f1d7..3cff0ac 100644 --- a/Lib/lib2to3/pgen2/driver.py +++ b/Lib/lib2to3/pgen2/driver.py @@ -77,7 +77,8 @@ class Driver(object): column = 0 else: # We never broke out -- EOF is too soon (how can this happen???) - raise parse.ParseError("incomplete input", t, v, x) + raise parse.ParseError("incomplete input", + type, value, (prefix, start)) return p.rootnode def parse_stream_raw(self, stream, debug=False): |