Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
"""Fix changes imports of urllib which are now incompatible.
|
|
|
|
This is rather similar to fix_imports, but because of the more
|
|
|
|
complex nature of the fixing for urllib, it has its own fixer.
|
|
|
|
"""
|
|
|
|
# Author: Nick Edds
|
|
|
|
|
|
|
|
# Local imports
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
from lib2to3.fixes.fix_imports import alternates, FixImports
|
|
|
|
from lib2to3 import fixer_base
|
|
|
|
from lib2to3.fixer_util import (Name, Comma, FromImport, Newline,
|
|
|
|
find_indentation)
|
|
|
|
|
|
|
|
MAPPING = {"urllib": [
|
|
|
|
("urllib.request",
|
|
|
|
["URLOpener", "FancyURLOpener", "urlretrieve",
|
|
|
|
"_urlopener", "urlopen", "urlcleanup",
|
|
|
|
"pathname2url", "url2pathname"]),
|
|
|
|
("urllib.parse",
|
|
|
|
["quote", "quote_plus", "unquote", "unquote_plus",
|
|
|
|
"urlencode", "splitattr", "splithost", "splitnport",
|
|
|
|
"splitpasswd", "splitport", "splitquery", "splittag",
|
|
|
|
"splittype", "splituser", "splitvalue", ]),
|
|
|
|
("urllib.error",
|
|
|
|
["ContentTooShortError"])],
|
|
|
|
"urllib2" : [
|
|
|
|
("urllib.request",
|
|
|
|
["urlopen", "install_opener", "build_opener",
|
|
|
|
"Request", "OpenerDirector", "BaseHandler",
|
|
|
|
"HTTPDefaultErrorHandler", "HTTPRedirectHandler",
|
|
|
|
"HTTPCookieProcessor", "ProxyHandler",
|
|
|
|
"HTTPPasswordMgr",
|
|
|
|
"HTTPPasswordMgrWithDefaultRealm",
|
|
|
|
"AbstractBasicAuthHandler",
|
|
|
|
"HTTPBasicAuthHandler", "ProxyBasicAuthHandler",
|
|
|
|
"AbstractDigestAuthHandler",
|
|
|
|
"HTTPDigestAuthHandler", "ProxyDigestAuthHandler",
|
|
|
|
"HTTPHandler", "HTTPSHandler", "FileHandler",
|
|
|
|
"FTPHandler", "CacheFTPHandler",
|
|
|
|
"UnknownHandler"]),
|
|
|
|
("urllib.error",
|
|
|
|
["URLError", "HTTPError"]),
|
Merged revisions 68306-68308,68340,68368,68422 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r68306 | benjamin.peterson | 2009-01-04 12:27:19 -0600 (Sun, 04 Jan 2009) | 1 line
fix_urllib: add mappings for the url parsing functions
........
r68307 | benjamin.peterson | 2009-01-04 12:30:01 -0600 (Sun, 04 Jan 2009) | 1 line
remove duplicated function
........
r68308 | benjamin.peterson | 2009-01-04 12:50:34 -0600 (Sun, 04 Jan 2009) | 1 line
turtle is no longer renamed
........
r68340 | georg.brandl | 2009-01-05 02:11:39 -0600 (Mon, 05 Jan 2009) | 2 lines
Fix undefined locals in parse_tokens().
........
r68368 | benjamin.peterson | 2009-01-06 17:56:10 -0600 (Tue, 06 Jan 2009) | 1 line
fix typo (thanks to Robert Lehmann)
........
r68422 | benjamin.peterson | 2009-01-08 20:01:03 -0600 (Thu, 08 Jan 2009) | 1 line
run the imports fixers after fix_import, so fix_import doesn't try to make stdlib renames into relative imports #4876
........
2009-01-08 22:13:34 -04:00
|
|
|
]
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
}
|
|
|
|
|
Merged revisions 68306-68308,68340,68368,68422 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r68306 | benjamin.peterson | 2009-01-04 12:27:19 -0600 (Sun, 04 Jan 2009) | 1 line
fix_urllib: add mappings for the url parsing functions
........
r68307 | benjamin.peterson | 2009-01-04 12:30:01 -0600 (Sun, 04 Jan 2009) | 1 line
remove duplicated function
........
r68308 | benjamin.peterson | 2009-01-04 12:50:34 -0600 (Sun, 04 Jan 2009) | 1 line
turtle is no longer renamed
........
r68340 | georg.brandl | 2009-01-05 02:11:39 -0600 (Mon, 05 Jan 2009) | 2 lines
Fix undefined locals in parse_tokens().
........
r68368 | benjamin.peterson | 2009-01-06 17:56:10 -0600 (Tue, 06 Jan 2009) | 1 line
fix typo (thanks to Robert Lehmann)
........
r68422 | benjamin.peterson | 2009-01-08 20:01:03 -0600 (Thu, 08 Jan 2009) | 1 line
run the imports fixers after fix_import, so fix_import doesn't try to make stdlib renames into relative imports #4876
........
2009-01-08 22:13:34 -04:00
|
|
|
# Duplicate the url parsing functions for urllib2.
|
|
|
|
MAPPING["urllib2"].append(MAPPING["urllib"][1])
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
|
|
|
|
|
|
|
|
def build_pattern():
|
|
|
|
bare = set()
|
|
|
|
for old_module, changes in MAPPING.items():
|
|
|
|
for change in changes:
|
|
|
|
new_module, members = change
|
|
|
|
members = alternates(members)
|
|
|
|
yield """import_name< 'import' (module=%r
|
|
|
|
| dotted_as_names< any* module=%r any* >) >
|
|
|
|
""" % (old_module, old_module)
|
|
|
|
yield """import_from< 'from' mod_member=%r 'import'
|
|
|
|
( member=%s | import_as_name< member=%s 'as' any > |
|
|
|
|
import_as_names< members=any* >) >
|
|
|
|
""" % (old_module, members, members)
|
|
|
|
yield """import_from< 'from' module_star=%r 'import' star='*' >
|
|
|
|
""" % old_module
|
|
|
|
yield """import_name< 'import'
|
|
|
|
dotted_as_name< module_as=%r 'as' any > >
|
|
|
|
""" % old_module
|
Merged revisions 76160-76161,76250,76252,76447,76506 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r76160 | benjamin.peterson | 2009-11-08 18:53:48 -0600 (Sun, 08 Nov 2009) | 1 line
undeprecate the -p option; it's useful for converting python3 sources
........
r76161 | benjamin.peterson | 2009-11-08 19:05:37 -0600 (Sun, 08 Nov 2009) | 1 line
simplify condition
........
r76250 | benjamin.peterson | 2009-11-13 16:56:48 -0600 (Fri, 13 Nov 2009) | 1 line
fix handling of a utf-8 bom #7313
........
r76252 | benjamin.peterson | 2009-11-13 16:58:36 -0600 (Fri, 13 Nov 2009) | 1 line
remove pdb turd
........
r76447 | benjamin.peterson | 2009-11-22 18:17:40 -0600 (Sun, 22 Nov 2009) | 1 line
#7375 fix nested transformations in fix_urllib
........
r76506 | benjamin.peterson | 2009-11-24 18:34:31 -0600 (Tue, 24 Nov 2009) | 1 line
use generator expressions in any()
........
2009-11-25 14:16:46 -04:00
|
|
|
# bare_with_attr has a special significance for FixImports.match().
|
|
|
|
yield """power< bare_with_attr=%r trailer< '.' member=%s > any* >
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
""" % (old_module, members)
|
|
|
|
|
|
|
|
|
|
|
|
class FixUrllib(FixImports):
|
Merged revisions 67384,67386-67387,67389-67390,67392,67399-67400,67403-67405,67426 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r67384 | benjamin.peterson | 2008-11-25 16:13:31 -0600 (Tue, 25 Nov 2008) | 4 lines
don't duplicate calls to start_tree()
RefactoringTool.pre_order values now holds a list of the fixers while pre_order_mapping holds the dict.
........
r67386 | benjamin.peterson | 2008-11-25 16:44:52 -0600 (Tue, 25 Nov 2008) | 1 line
#4423 fix_imports was still replacing usage of a module if attributes were being used
........
r67387 | benjamin.peterson | 2008-11-25 16:47:54 -0600 (Tue, 25 Nov 2008) | 1 line
fix broken test
........
r67389 | benjamin.peterson | 2008-11-25 17:13:17 -0600 (Tue, 25 Nov 2008) | 1 line
remove compatibility code; we only cater to 2.5+
........
r67390 | benjamin.peterson | 2008-11-25 22:03:36 -0600 (Tue, 25 Nov 2008) | 1 line
fix #3994; the usage of changed imports was fixed in nested cases
........
r67392 | benjamin.peterson | 2008-11-26 11:11:40 -0600 (Wed, 26 Nov 2008) | 1 line
simpilfy and comment fix_imports
........
r67399 | benjamin.peterson | 2008-11-26 11:47:03 -0600 (Wed, 26 Nov 2008) | 1 line
remove more compatibility code
........
r67400 | benjamin.peterson | 2008-11-26 12:07:41 -0600 (Wed, 26 Nov 2008) | 1 line
set svn:ignore
........
r67403 | benjamin.peterson | 2008-11-26 13:11:11 -0600 (Wed, 26 Nov 2008) | 1 line
wrap import
........
r67404 | benjamin.peterson | 2008-11-26 13:29:49 -0600 (Wed, 26 Nov 2008) | 1 line
build the fix_imports pattern in compile_pattern, so MAPPING can be changed and reflected in the pattern
........
r67405 | benjamin.peterson | 2008-11-26 14:01:24 -0600 (Wed, 26 Nov 2008) | 1 line
stop ugly messages about runtime errors being from printed
........
r67426 | benjamin.peterson | 2008-11-28 16:01:40 -0600 (Fri, 28 Nov 2008) | 5 lines
don't replace a module name if it is in the middle of a attribute lookup
This fix also stops module names from being replaced if they are not in an attribute lookup.
........
2008-11-28 18:12:14 -04:00
|
|
|
|
|
|
|
def build_pattern(self):
|
|
|
|
return "|".join(build_pattern())
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
|
|
|
|
def transform_import(self, node, results):
|
|
|
|
"""Transform for the basic import case. Replaces the old
|
|
|
|
import name with a comma separated list of its
|
|
|
|
replacements.
|
|
|
|
"""
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
import_mod = results.get("module")
|
Merged revisions 72523,72950-72951,72994,73003,73033,73036-73040,73091-73093,73096,73179-73181,73192,73231,73244,73255-73256,73365 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r72523 | benjamin.peterson | 2009-05-09 14:42:26 -0500 (Sat, 09 May 2009) | 1 line
remove parenthesis
........
r72950 | benjamin.peterson | 2009-05-26 18:19:45 -0500 (Tue, 26 May 2009) | 1 line
remove unused imports
........
r72951 | benjamin.peterson | 2009-05-26 18:27:00 -0500 (Tue, 26 May 2009) | 1 line
this is no longer executable
........
r72994 | benjamin.peterson | 2009-05-28 15:32:54 -0500 (Thu, 28 May 2009) | 1 line
fix test_all_fixers on Windows #6134
........
r73003 | benjamin.peterson | 2009-05-28 21:57:28 -0500 (Thu, 28 May 2009) | 4 lines
make 2to3 test utilities easier to use with other applications (3to2)
Patch by Joe Amenta
........
r73033 | benjamin.peterson | 2009-05-29 16:58:32 -0500 (Fri, 29 May 2009) | 1 line
update grammar for multi with statement
........
r73036 | benjamin.peterson | 2009-05-29 17:33:20 -0500 (Fri, 29 May 2009) | 1 line
simplify fix_unicode
........
r73037 | benjamin.peterson | 2009-05-29 17:53:03 -0500 (Fri, 29 May 2009) | 1 line
add custom error for pattern syntax errors
........
r73038 | benjamin.peterson | 2009-05-29 17:55:00 -0500 (Fri, 29 May 2009) | 1 line
complain if details are attached to a token
........
r73039 | benjamin.peterson | 2009-05-29 18:00:28 -0500 (Fri, 29 May 2009) | 1 line
add a test for whitespace
........
r73040 | benjamin.peterson | 2009-05-29 18:01:17 -0500 (Fri, 29 May 2009) | 1 line
a fix for emacs highlighting
........
r73091 | benjamin.peterson | 2009-05-31 20:55:25 -0500 (Sun, 31 May 2009) | 1 line
deprecate set_prefix() and get_prefix() in favor of a prefix property
........
r73092 | benjamin.peterson | 2009-05-31 21:00:51 -0500 (Sun, 31 May 2009) | 1 line
change hideous java naming scheme
........
r73093 | benjamin.peterson | 2009-05-31 21:01:39 -0500 (Sun, 31 May 2009) | 1 line
remove dated comment
........
r73096 | benjamin.peterson | 2009-05-31 21:40:53 -0500 (Sun, 31 May 2009) | 1 line
group tests
........
r73179 | benjamin.peterson | 2009-06-03 13:09:53 -0500 (Wed, 03 Jun 2009) | 1 line
handle the case where there's multiple trailers #6185
........
r73180 | benjamin.peterson | 2009-06-03 13:18:05 -0500 (Wed, 03 Jun 2009) | 1 line
scrap __main__ section
........
r73181 | benjamin.peterson | 2009-06-03 13:24:48 -0500 (Wed, 03 Jun 2009) | 1 line
remove shebang lines and __main__ sections
........
r73192 | benjamin.peterson | 2009-06-03 19:16:30 -0500 (Wed, 03 Jun 2009) | 4 lines
actually test something here
Thanks to Joe Amenta for noticing.y
........
r73231 | benjamin.peterson | 2009-06-04 13:38:50 -0500 (Thu, 04 Jun 2009) | 1 line
remove unused variable
........
r73244 | benjamin.peterson | 2009-06-05 08:39:25 -0500 (Fri, 05 Jun 2009) | 1 line
allow fixers to give different options in setUp
........
r73255 | benjamin.peterson | 2009-06-06 11:23:46 -0500 (Sat, 06 Jun 2009) | 1 line
fix the except fixer on one line suites #6222
........
r73256 | benjamin.peterson | 2009-06-06 11:27:40 -0500 (Sat, 06 Jun 2009) | 1 line
test one-line else and finally clauses
........
r73365 | benjamin.peterson | 2009-06-11 17:01:32 -0500 (Thu, 11 Jun 2009) | 1 line
normalize whitespace
........
2009-06-11 19:06:46 -03:00
|
|
|
pref = import_mod.prefix
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
|
|
|
|
names = []
|
|
|
|
|
|
|
|
# create a Node list of the replacement modules
|
|
|
|
for name in MAPPING[import_mod.value][:-1]:
|
|
|
|
names.extend([Name(name[0], prefix=pref), Comma()])
|
|
|
|
names.append(Name(MAPPING[import_mod.value][-1][0], prefix=pref))
|
|
|
|
import_mod.replace(names)
|
|
|
|
|
|
|
|
def transform_member(self, node, results):
|
|
|
|
"""Transform for imports of specific module elements. Replaces
|
|
|
|
the module to be imported from with the appropriate new
|
|
|
|
module.
|
|
|
|
"""
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
mod_member = results.get("mod_member")
|
Merged revisions 72523,72950-72951,72994,73003,73033,73036-73040,73091-73093,73096,73179-73181,73192,73231,73244,73255-73256,73365 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r72523 | benjamin.peterson | 2009-05-09 14:42:26 -0500 (Sat, 09 May 2009) | 1 line
remove parenthesis
........
r72950 | benjamin.peterson | 2009-05-26 18:19:45 -0500 (Tue, 26 May 2009) | 1 line
remove unused imports
........
r72951 | benjamin.peterson | 2009-05-26 18:27:00 -0500 (Tue, 26 May 2009) | 1 line
this is no longer executable
........
r72994 | benjamin.peterson | 2009-05-28 15:32:54 -0500 (Thu, 28 May 2009) | 1 line
fix test_all_fixers on Windows #6134
........
r73003 | benjamin.peterson | 2009-05-28 21:57:28 -0500 (Thu, 28 May 2009) | 4 lines
make 2to3 test utilities easier to use with other applications (3to2)
Patch by Joe Amenta
........
r73033 | benjamin.peterson | 2009-05-29 16:58:32 -0500 (Fri, 29 May 2009) | 1 line
update grammar for multi with statement
........
r73036 | benjamin.peterson | 2009-05-29 17:33:20 -0500 (Fri, 29 May 2009) | 1 line
simplify fix_unicode
........
r73037 | benjamin.peterson | 2009-05-29 17:53:03 -0500 (Fri, 29 May 2009) | 1 line
add custom error for pattern syntax errors
........
r73038 | benjamin.peterson | 2009-05-29 17:55:00 -0500 (Fri, 29 May 2009) | 1 line
complain if details are attached to a token
........
r73039 | benjamin.peterson | 2009-05-29 18:00:28 -0500 (Fri, 29 May 2009) | 1 line
add a test for whitespace
........
r73040 | benjamin.peterson | 2009-05-29 18:01:17 -0500 (Fri, 29 May 2009) | 1 line
a fix for emacs highlighting
........
r73091 | benjamin.peterson | 2009-05-31 20:55:25 -0500 (Sun, 31 May 2009) | 1 line
deprecate set_prefix() and get_prefix() in favor of a prefix property
........
r73092 | benjamin.peterson | 2009-05-31 21:00:51 -0500 (Sun, 31 May 2009) | 1 line
change hideous java naming scheme
........
r73093 | benjamin.peterson | 2009-05-31 21:01:39 -0500 (Sun, 31 May 2009) | 1 line
remove dated comment
........
r73096 | benjamin.peterson | 2009-05-31 21:40:53 -0500 (Sun, 31 May 2009) | 1 line
group tests
........
r73179 | benjamin.peterson | 2009-06-03 13:09:53 -0500 (Wed, 03 Jun 2009) | 1 line
handle the case where there's multiple trailers #6185
........
r73180 | benjamin.peterson | 2009-06-03 13:18:05 -0500 (Wed, 03 Jun 2009) | 1 line
scrap __main__ section
........
r73181 | benjamin.peterson | 2009-06-03 13:24:48 -0500 (Wed, 03 Jun 2009) | 1 line
remove shebang lines and __main__ sections
........
r73192 | benjamin.peterson | 2009-06-03 19:16:30 -0500 (Wed, 03 Jun 2009) | 4 lines
actually test something here
Thanks to Joe Amenta for noticing.y
........
r73231 | benjamin.peterson | 2009-06-04 13:38:50 -0500 (Thu, 04 Jun 2009) | 1 line
remove unused variable
........
r73244 | benjamin.peterson | 2009-06-05 08:39:25 -0500 (Fri, 05 Jun 2009) | 1 line
allow fixers to give different options in setUp
........
r73255 | benjamin.peterson | 2009-06-06 11:23:46 -0500 (Sat, 06 Jun 2009) | 1 line
fix the except fixer on one line suites #6222
........
r73256 | benjamin.peterson | 2009-06-06 11:27:40 -0500 (Sat, 06 Jun 2009) | 1 line
test one-line else and finally clauses
........
r73365 | benjamin.peterson | 2009-06-11 17:01:32 -0500 (Thu, 11 Jun 2009) | 1 line
normalize whitespace
........
2009-06-11 19:06:46 -03:00
|
|
|
pref = mod_member.prefix
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
member = results.get("member")
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
|
|
|
|
# Simple case with only a single member being imported
|
|
|
|
if member:
|
|
|
|
# this may be a list of length one, or just a node
|
|
|
|
if isinstance(member, list):
|
|
|
|
member = member[0]
|
|
|
|
new_name = None
|
|
|
|
for change in MAPPING[mod_member.value]:
|
|
|
|
if member.value in change[1]:
|
|
|
|
new_name = change[0]
|
|
|
|
break
|
|
|
|
if new_name:
|
|
|
|
mod_member.replace(Name(new_name, prefix=pref))
|
|
|
|
else:
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
self.cannot_convert(node, "This is an invalid module element")
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
|
|
|
|
# Multiple members being imported
|
|
|
|
else:
|
|
|
|
# a dictionary for replacements, order matters
|
|
|
|
modules = []
|
|
|
|
mod_dict = {}
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
members = results["members"]
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
for member in members:
|
|
|
|
member = member.value
|
|
|
|
# we only care about the actual members
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
if member != u",":
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
for change in MAPPING[mod_member.value]:
|
|
|
|
if member in change[1]:
|
2008-07-16 15:48:35 -03:00
|
|
|
if change[0] in mod_dict:
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
mod_dict[change[0]].append(member)
|
|
|
|
else:
|
|
|
|
mod_dict[change[0]] = [member]
|
|
|
|
modules.append(change[0])
|
|
|
|
|
|
|
|
new_nodes = []
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
indentation = find_indentation(node)
|
|
|
|
first = True
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
for module in modules:
|
|
|
|
elts = mod_dict[module]
|
|
|
|
names = []
|
|
|
|
for elt in elts[:-1]:
|
|
|
|
names.extend([Name(elt, prefix=pref), Comma()])
|
|
|
|
names.append(Name(elts[-1], prefix=pref))
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
new = FromImport(module, names)
|
|
|
|
if not first or node.parent.prefix.endswith(indentation):
|
|
|
|
new.prefix = indentation
|
|
|
|
new_nodes.append(new)
|
|
|
|
first = False
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
if new_nodes:
|
|
|
|
nodes = []
|
|
|
|
for new_node in new_nodes[:-1]:
|
|
|
|
nodes.extend([new_node, Newline()])
|
|
|
|
nodes.append(new_nodes[-1])
|
|
|
|
node.replace(nodes)
|
|
|
|
else:
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
self.cannot_convert(node, "All module elements are invalid")
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
|
|
|
|
def transform_dot(self, node, results):
|
|
|
|
"""Transform for calls to module members in code."""
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
module_dot = results.get("bare_with_attr")
|
|
|
|
member = results.get("member")
|
Merged revisions 76160-76161,76250,76252,76447,76506 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r76160 | benjamin.peterson | 2009-11-08 18:53:48 -0600 (Sun, 08 Nov 2009) | 1 line
undeprecate the -p option; it's useful for converting python3 sources
........
r76161 | benjamin.peterson | 2009-11-08 19:05:37 -0600 (Sun, 08 Nov 2009) | 1 line
simplify condition
........
r76250 | benjamin.peterson | 2009-11-13 16:56:48 -0600 (Fri, 13 Nov 2009) | 1 line
fix handling of a utf-8 bom #7313
........
r76252 | benjamin.peterson | 2009-11-13 16:58:36 -0600 (Fri, 13 Nov 2009) | 1 line
remove pdb turd
........
r76447 | benjamin.peterson | 2009-11-22 18:17:40 -0600 (Sun, 22 Nov 2009) | 1 line
#7375 fix nested transformations in fix_urllib
........
r76506 | benjamin.peterson | 2009-11-24 18:34:31 -0600 (Tue, 24 Nov 2009) | 1 line
use generator expressions in any()
........
2009-11-25 14:16:46 -04:00
|
|
|
new_name = None
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
if isinstance(member, list):
|
|
|
|
member = member[0]
|
|
|
|
for change in MAPPING[module_dot.value]:
|
|
|
|
if member.value in change[1]:
|
|
|
|
new_name = change[0]
|
|
|
|
break
|
|
|
|
if new_name:
|
|
|
|
module_dot.replace(Name(new_name,
|
Merged revisions 72523,72950-72951,72994,73003,73033,73036-73040,73091-73093,73096,73179-73181,73192,73231,73244,73255-73256,73365 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r72523 | benjamin.peterson | 2009-05-09 14:42:26 -0500 (Sat, 09 May 2009) | 1 line
remove parenthesis
........
r72950 | benjamin.peterson | 2009-05-26 18:19:45 -0500 (Tue, 26 May 2009) | 1 line
remove unused imports
........
r72951 | benjamin.peterson | 2009-05-26 18:27:00 -0500 (Tue, 26 May 2009) | 1 line
this is no longer executable
........
r72994 | benjamin.peterson | 2009-05-28 15:32:54 -0500 (Thu, 28 May 2009) | 1 line
fix test_all_fixers on Windows #6134
........
r73003 | benjamin.peterson | 2009-05-28 21:57:28 -0500 (Thu, 28 May 2009) | 4 lines
make 2to3 test utilities easier to use with other applications (3to2)
Patch by Joe Amenta
........
r73033 | benjamin.peterson | 2009-05-29 16:58:32 -0500 (Fri, 29 May 2009) | 1 line
update grammar for multi with statement
........
r73036 | benjamin.peterson | 2009-05-29 17:33:20 -0500 (Fri, 29 May 2009) | 1 line
simplify fix_unicode
........
r73037 | benjamin.peterson | 2009-05-29 17:53:03 -0500 (Fri, 29 May 2009) | 1 line
add custom error for pattern syntax errors
........
r73038 | benjamin.peterson | 2009-05-29 17:55:00 -0500 (Fri, 29 May 2009) | 1 line
complain if details are attached to a token
........
r73039 | benjamin.peterson | 2009-05-29 18:00:28 -0500 (Fri, 29 May 2009) | 1 line
add a test for whitespace
........
r73040 | benjamin.peterson | 2009-05-29 18:01:17 -0500 (Fri, 29 May 2009) | 1 line
a fix for emacs highlighting
........
r73091 | benjamin.peterson | 2009-05-31 20:55:25 -0500 (Sun, 31 May 2009) | 1 line
deprecate set_prefix() and get_prefix() in favor of a prefix property
........
r73092 | benjamin.peterson | 2009-05-31 21:00:51 -0500 (Sun, 31 May 2009) | 1 line
change hideous java naming scheme
........
r73093 | benjamin.peterson | 2009-05-31 21:01:39 -0500 (Sun, 31 May 2009) | 1 line
remove dated comment
........
r73096 | benjamin.peterson | 2009-05-31 21:40:53 -0500 (Sun, 31 May 2009) | 1 line
group tests
........
r73179 | benjamin.peterson | 2009-06-03 13:09:53 -0500 (Wed, 03 Jun 2009) | 1 line
handle the case where there's multiple trailers #6185
........
r73180 | benjamin.peterson | 2009-06-03 13:18:05 -0500 (Wed, 03 Jun 2009) | 1 line
scrap __main__ section
........
r73181 | benjamin.peterson | 2009-06-03 13:24:48 -0500 (Wed, 03 Jun 2009) | 1 line
remove shebang lines and __main__ sections
........
r73192 | benjamin.peterson | 2009-06-03 19:16:30 -0500 (Wed, 03 Jun 2009) | 4 lines
actually test something here
Thanks to Joe Amenta for noticing.y
........
r73231 | benjamin.peterson | 2009-06-04 13:38:50 -0500 (Thu, 04 Jun 2009) | 1 line
remove unused variable
........
r73244 | benjamin.peterson | 2009-06-05 08:39:25 -0500 (Fri, 05 Jun 2009) | 1 line
allow fixers to give different options in setUp
........
r73255 | benjamin.peterson | 2009-06-06 11:23:46 -0500 (Sat, 06 Jun 2009) | 1 line
fix the except fixer on one line suites #6222
........
r73256 | benjamin.peterson | 2009-06-06 11:27:40 -0500 (Sat, 06 Jun 2009) | 1 line
test one-line else and finally clauses
........
r73365 | benjamin.peterson | 2009-06-11 17:01:32 -0500 (Thu, 11 Jun 2009) | 1 line
normalize whitespace
........
2009-06-11 19:06:46 -03:00
|
|
|
prefix=module_dot.prefix))
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
else:
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
self.cannot_convert(node, "This is an invalid module element")
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
|
|
|
|
def transform(self, node, results):
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
if results.get("module"):
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
self.transform_import(node, results)
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
elif results.get("mod_member"):
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
self.transform_member(node, results)
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
elif results.get("bare_with_attr"):
|
Merged revisions 64863,64868,64870,64942,65001-65002,65017-65018 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r64863 | brett.cannon | 2008-07-10 19:42:32 -0500 (Thu, 10 Jul 2008) | 1 line
Add urlparse -> urllib.parse to fix_imports.
........
r64868 | brett.cannon | 2008-07-10 20:00:10 -0500 (Thu, 10 Jul 2008) | 1 line
Add robotparser -> urllib.robotparser to fix_imports.
........
r64870 | brett.cannon | 2008-07-11 00:56:27 -0500 (Fri, 11 Jul 2008) | 6 lines
Fix the fixers for the new dbm package.
Had to create a new fixer (fix_imports2) which did fixes in post-order. This
because ``import anydbm`` was being translated into ``import dbm`` which was
then subsequently changed into ``import dbm.ndbm``; one transform too many.
........
r64942 | collin.winter | 2008-07-13 20:19:05 -0500 (Sun, 13 Jul 2008) | 1 line
Add a comment explaining part of fix_imports.py
........
r65001 | brett.cannon | 2008-07-16 00:11:12 -0500 (Wed, 16 Jul 2008) | 2 lines
Remove some extraneous whitespace.
........
r65002 | brett.cannon | 2008-07-16 00:12:04 -0500 (Wed, 16 Jul 2008) | 4 lines
Implement a fixer for urllib(2).
Thanks Nick Edds for the patch.
........
r65017 | benjamin.peterson | 2008-07-16 11:04:19 -0500 (Wed, 16 Jul 2008) | 1 line
fix 2to3 in Python 2.6
........
r65018 | benjamin.peterson | 2008-07-16 11:55:21 -0500 (Wed, 16 Jul 2008) | 1 line
normalize whitespace
........
2008-07-16 14:01:46 -03:00
|
|
|
self.transform_dot(node, results)
|
|
|
|
# Renaming and star imports are not supported for these modules.
|
Merged revisions 82530-82531,82779,82855,83740,83789-83791,83797-83801,83803,83811,83827,83844 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r82530 | benjamin.peterson | 2010-07-04 11:11:41 -0500 (Sun, 04 Jul 2010) | 1 line
simplify ignore star imports from itertools #8892
........
r82531 | benjamin.peterson | 2010-07-04 11:13:20 -0500 (Sun, 04 Jul 2010) | 1 line
wrap with parenthesis not \
........
r82779 | benjamin.peterson | 2010-07-10 14:45:08 -0500 (Sat, 10 Jul 2010) | 1 line
typo in attribute name #9217
........
r82855 | benjamin.peterson | 2010-07-13 16:27:38 -0500 (Tue, 13 Jul 2010) | 1 line
remove more extraneous commas #9245
........
r83740 | alexandre.vassalotti | 2010-08-05 01:58:36 -0500 (Thu, 05 Aug 2010) | 4 lines
Issue 5077: Update fixer for the other functions gone from the operator module.
Patch by Meador Inge.
........
r83789 | benjamin.peterson | 2010-08-07 17:45:14 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup and use unicode consistently
........
r83790 | benjamin.peterson | 2010-08-07 17:52:06 -0500 (Sat, 07 Aug 2010) | 1 line
unicode literal
........
r83791 | benjamin.peterson | 2010-08-07 17:52:55 -0500 (Sat, 07 Aug 2010) | 1 line
.get() is pointless here
........
r83797 | benjamin.peterson | 2010-08-07 18:54:51 -0500 (Sat, 07 Aug 2010) | 1 line
add a function to find how a node is indented
........
r83798 | benjamin.peterson | 2010-08-07 18:55:28 -0500 (Sat, 07 Aug 2010) | 1 line
when splitting import statements, use correct indentation #9386
........
r83799 | benjamin.peterson | 2010-08-07 18:57:43 -0500 (Sat, 07 Aug 2010) | 1 line
double quotes
........
r83800 | benjamin.peterson | 2010-08-07 18:58:52 -0500 (Sat, 07 Aug 2010) | 1 line
add another test
........
r83801 | benjamin.peterson | 2010-08-07 19:02:10 -0500 (Sat, 07 Aug 2010) | 1 line
cleanup; style-nits
........
r83803 | benjamin.peterson | 2010-08-07 19:05:08 -0500 (Sat, 07 Aug 2010) | 1 line
slightly more explicit
........
r83811 | benjamin.peterson | 2010-08-07 22:56:44 -0500 (Sat, 07 Aug 2010) | 4 lines
Fix node.pre_order() to call the right method on its children.
This was a rather tragic copy-paste error.
........
r83827 | benjamin.peterson | 2010-08-08 08:12:48 -0500 (Sun, 08 Aug 2010) | 1 line
cause test to actually run and fix it
........
r83844 | benjamin.peterson | 2010-08-08 13:46:37 -0500 (Sun, 08 Aug 2010) | 1 line
fix whitespace
........
2010-08-08 16:13:06 -03:00
|
|
|
elif results.get("module_star"):
|
|
|
|
self.cannot_convert(node, "Cannot handle star imports.")
|
|
|
|
elif results.get("module_as"):
|
|
|
|
self.cannot_convert(node, "This module is now multiple modules")
|