Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b9b197 commit e2bb4ebCopy full SHA for e2bb4eb
5 files changed
Lib/lib2to3/fixes/fix_urllib.py
@@ -12,7 +12,7 @@
12
13
MAPPING = {"urllib": [
14
("urllib.request",
15
- ["URLOpener", "FancyURLOpener", "urlretrieve",
+ ["URLopener", "FancyURLopener", "urlretrieve",
16
"_urlopener", "urlopen", "urlcleanup",
17
"pathname2url", "url2pathname"]),
18
("urllib.parse",
Lib/lib2to3/main.py
@@ -100,7 +100,7 @@ def main(fixer_pkg, args=None):
100
parser.add_option("-j", "--processes", action="store", default=1,
101
type="int", help="Run 2to3 concurrently")
102
parser.add_option("-x", "--nofix", action="append", default=[],
103
- help="Prevent a fixer from being run.")
+ help="Prevent a transformation from being run")
104
parser.add_option("-l", "--list-fixes", action="store_true",
105
help="List available transformations")
106
parser.add_option("-p", "--print-function", action="store_true",
@@ -112,7 +112,7 @@ def main(fixer_pkg, args=None):
112
parser.add_option("-w", "--write", action="store_true",
113
help="Write back modified files")
114
parser.add_option("-n", "--nobackups", action="store_true", default=False,
115
- help="Don't write backups for modified files.")
+ help="Don't write backups for modified files")
116
117
# Parse command line arguments
118
refactor_stdin = False
Lib/lib2to3/refactor.py
@@ -302,13 +302,14 @@ def refactor_dir(self, dir_name, write=False, doctests_only=False):
302
303
Files and subdirectories starting with '.' are skipped.
304
"""
305
+ py_ext = os.extsep + "py"
306
for dirpath, dirnames, filenames in os.walk(dir_name):
307
self.log_debug("Descending into %s", dirpath)
308
dirnames.sort()
309
filenames.sort()
310
for name in filenames:
- if not name.startswith(".") and \
311
- os.path.splitext(name)[1].endswith("py"):
+ if (not name.startswith(".") and
312
+ os.path.splitext(name)[1] == py_ext):
313
fullname = os.path.join(dirpath, name)
314
self.refactor_file(fullname, write, doctests_only)
315
# Modify dirnames in-place to remove subdirs with leading dots
Lib/lib2to3/tests/test_refactor.py
@@ -223,6 +223,7 @@ def mock_refactor_file(self, f, *args):
223
"hi.py",
224
".dumb",
225
".after.py",
226
+ "notpy.npy",
227
"sappy"]
228
expected = ["hi.py"]
229
check(tree, expected)
Lib/lib2to3/tests/test_util.py
@@ -568,8 +568,8 @@ def test_beginning(self):
568
569
def test_from_import(self):
570
node = parse('bar()')
571
- fixer_util.touch_import("cgi", "escape", node)
572
- 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')
573
574
def test_name_import(self):
575
0 commit comments