Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e2bb4eb

Browse files
committed
Merged revisions 85551,86156-86157,86464 via svnmerge from
svn+ssh://[email protected]/sandbox/trunk/2to3/lib2to3 ........ r85551 | benjamin.peterson | 2010-10-15 23:57:29 +0200 (Fr, 15 Okt 2010) | 1 line escape() is now in the html module ........ r86156 | georg.brandl | 2010-11-04 09:34:57 +0100 (Do, 04 Nov 2010) | 1 line Consistency fixes in option parser help texts. ........ r86157 | georg.brandl | 2010-11-04 09:35:30 +0100 (Do, 04 Nov 2010) | 1 line #10286: fix urllib class names. ........ r86464 | benjamin.peterson | 2010-11-14 16:28:52 +0100 (So, 14 Nov 2010) | 1 line match only .py files #10416 ........
1 parent 4b9b197 commit e2bb4eb

5 files changed

Lines changed: 9 additions & 7 deletions

File tree

Lib/lib2to3/fixes/fix_urllib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
MAPPING = {"urllib": [
1414
("urllib.request",
15-
["URLOpener", "FancyURLOpener", "urlretrieve",
15+
["URLopener", "FancyURLopener", "urlretrieve",
1616
"_urlopener", "urlopen", "urlcleanup",
1717
"pathname2url", "url2pathname"]),
1818
("urllib.parse",

Lib/lib2to3/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def main(fixer_pkg, args=None):
100100
parser.add_option("-j", "--processes", action="store", default=1,
101101
type="int", help="Run 2to3 concurrently")
102102
parser.add_option("-x", "--nofix", action="append", default=[],
103-
help="Prevent a fixer from being run.")
103+
help="Prevent a transformation from being run")
104104
parser.add_option("-l", "--list-fixes", action="store_true",
105105
help="List available transformations")
106106
parser.add_option("-p", "--print-function", action="store_true",
@@ -112,7 +112,7 @@ def main(fixer_pkg, args=None):
112112
parser.add_option("-w", "--write", action="store_true",
113113
help="Write back modified files")
114114
parser.add_option("-n", "--nobackups", action="store_true", default=False,
115-
help="Don't write backups for modified files.")
115+
help="Don't write backups for modified files")
116116

117117
# Parse command line arguments
118118
refactor_stdin = False

Lib/lib2to3/refactor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,14 @@ def refactor_dir(self, dir_name, write=False, doctests_only=False):
302302
303303
Files and subdirectories starting with '.' are skipped.
304304
"""
305+
py_ext = os.extsep + "py"
305306
for dirpath, dirnames, filenames in os.walk(dir_name):
306307
self.log_debug("Descending into %s", dirpath)
307308
dirnames.sort()
308309
filenames.sort()
309310
for name in filenames:
310-
if not name.startswith(".") and \
311-
os.path.splitext(name)[1].endswith("py"):
311+
if (not name.startswith(".") and
312+
os.path.splitext(name)[1] == py_ext):
312313
fullname = os.path.join(dirpath, name)
313314
self.refactor_file(fullname, write, doctests_only)
314315
# Modify dirnames in-place to remove subdirs with leading dots

Lib/lib2to3/tests/test_refactor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ def mock_refactor_file(self, f, *args):
223223
"hi.py",
224224
".dumb",
225225
".after.py",
226+
"notpy.npy",
226227
"sappy"]
227228
expected = ["hi.py"]
228229
check(tree, expected)

Lib/lib2to3/tests/test_util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,8 @@ def test_beginning(self):
568568

569569
def test_from_import(self):
570570
node = parse('bar()')
571-
fixer_util.touch_import("cgi", "escape", node)
572-
self.assertEqual(str(node), 'from cgi import escape\nbar()\n\n')
571+
fixer_util.touch_import("html", "escape", node)
572+
self.assertEqual(str(node), 'from html import escape\nbar()\n\n')
573573

574574
def test_name_import(self):
575575
node = parse('bar()')

0 commit comments

Comments
 (0)