summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-12-04 02:18:58 +0000
committerBenjamin Peterson <benjamin@python.org>2010-12-04 02:18:58 +0000
commit848cfa23e149e4bbc85d42fa2ef2979dc9fe9c4c (patch)
tree8ff54699b8ca226339393ce892f295f232977cfc
parent4cb64ad8bbeb3c4015d3ed1b55431dc3432f4f18 (diff)
downloadcpython-git-848cfa23e149e4bbc85d42fa2ef2979dc9fe9c4c.tar.gz
Merged revisions 85551,86156-86157,86464 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r85551 | benjamin.peterson | 2010-10-15 16:57:29 -0500 (Fri, 15 Oct 2010) | 1 line escape() is now in the html module ........ r86156 | georg.brandl | 2010-11-04 03:34:57 -0500 (Thu, 04 Nov 2010) | 1 line Consistency fixes in option parser help texts. ........ r86157 | georg.brandl | 2010-11-04 03:35:30 -0500 (Thu, 04 Nov 2010) | 1 line #10286: fix urllib class names. ........ r86464 | benjamin.peterson | 2010-11-14 09:28:52 -0600 (Sun, 14 Nov 2010) | 1 line match only .py files #10416 ........
-rw-r--r--Lib/lib2to3/fixes/fix_urllib.py2
-rw-r--r--Lib/lib2to3/main.py4
-rw-r--r--Lib/lib2to3/refactor.py5
-rw-r--r--Lib/lib2to3/tests/test_refactor.py1
-rw-r--r--Lib/lib2to3/tests/test_util.py4
5 files changed, 9 insertions, 7 deletions
diff --git a/Lib/lib2to3/fixes/fix_urllib.py b/Lib/lib2to3/fixes/fix_urllib.py
index f91fe2a035..34e1b2702b 100644
--- a/Lib/lib2to3/fixes/fix_urllib.py
+++ b/Lib/lib2to3/fixes/fix_urllib.py
@@ -12,7 +12,7 @@ from lib2to3.fixer_util import (Name, Comma, FromImport, Newline,
MAPPING = {"urllib": [
("urllib.request",
- ["URLOpener", "FancyURLOpener", "urlretrieve",
+ ["URLopener", "FancyURLopener", "urlretrieve",
"_urlopener", "urlopen", "urlcleanup",
"pathname2url", "url2pathname"]),
("urllib.parse",
diff --git a/Lib/lib2to3/main.py b/Lib/lib2to3/main.py
index ffa42ab76c..3929db70d3 100644
--- a/Lib/lib2to3/main.py
+++ b/Lib/lib2to3/main.py
@@ -101,7 +101,7 @@ def main(fixer_pkg, args=None):
parser.add_option("-j", "--processes", action="store", default=1,
type="int", help="Run 2to3 concurrently")
parser.add_option("-x", "--nofix", action="append", default=[],
- help="Prevent a fixer from being run.")
+ help="Prevent a transformation from being run")
parser.add_option("-l", "--list-fixes", action="store_true",
help="List available transformations")
parser.add_option("-p", "--print-function", action="store_true",
@@ -113,7 +113,7 @@ def main(fixer_pkg, args=None):
parser.add_option("-w", "--write", action="store_true",
help="Write back modified files")
parser.add_option("-n", "--nobackups", action="store_true", default=False,
- help="Don't write backups for modified files.")
+ help="Don't write backups for modified files")
# Parse command line arguments
refactor_stdin = False
diff --git a/Lib/lib2to3/refactor.py b/Lib/lib2to3/refactor.py
index a51eb716b4..7d00d12f9d 100644
--- a/Lib/lib2to3/refactor.py
+++ b/Lib/lib2to3/refactor.py
@@ -302,13 +302,14 @@ class RefactoringTool(object):
Files and subdirectories starting with '.' are skipped.
"""
+ py_ext = os.extsep + "py"
for dirpath, dirnames, filenames in os.walk(dir_name):
self.log_debug("Descending into %s", dirpath)
dirnames.sort()
filenames.sort()
for name in filenames:
- if not name.startswith(".") and \
- os.path.splitext(name)[1].endswith("py"):
+ if (not name.startswith(".") and
+ os.path.splitext(name)[1] == py_ext):
fullname = os.path.join(dirpath, name)
self.refactor_file(fullname, write, doctests_only)
# Modify dirnames in-place to remove subdirs with leading dots
diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py
index 59e5a74438..3eecde8cfb 100644
--- a/Lib/lib2to3/tests/test_refactor.py
+++ b/Lib/lib2to3/tests/test_refactor.py
@@ -223,6 +223,7 @@ from __future__ import print_function"""
"hi.py",
".dumb",
".after.py",
+ "notpy.npy",
"sappy"]
expected = ["hi.py"]
check(tree, expected)
diff --git a/Lib/lib2to3/tests/test_util.py b/Lib/lib2to3/tests/test_util.py
index 9365edc1c5..2fab8b9ad5 100644
--- a/Lib/lib2to3/tests/test_util.py
+++ b/Lib/lib2to3/tests/test_util.py
@@ -568,8 +568,8 @@ class Test_touch_import(support.TestCase):
def test_from_import(self):
node = parse('bar()')
- fixer_util.touch_import("cgi", "escape", node)
- self.assertEqual(str(node), 'from cgi import escape\nbar()\n\n')
+ fixer_util.touch_import("html", "escape", node)
+ self.assertEqual(str(node), 'from html import escape\nbar()\n\n')
def test_name_import(self):
node = parse('bar()')