From 276a84a0a6c694ce227bf36ec2e2e6ec6686170f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20Meza=20Cabrera?= Date: Wed, 11 Mar 2020 18:51:20 -0500 Subject: [PATCH] bpo-38080: Added "getproxies" to urllib fixes in the 2to3 tool (GH-16167) --- Lib/lib2to3/fixes/fix_urllib.py | 2 +- Lib/lib2to3/tests/test_fixers.py | 4 ++++ .../next/Tools-Demos/2019-09-18-13-49-56.bpo-38080.Nbl7lF.rst | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Tools-Demos/2019-09-18-13-49-56.bpo-38080.Nbl7lF.rst diff --git a/Lib/lib2to3/fixes/fix_urllib.py b/Lib/lib2to3/fixes/fix_urllib.py index 5a36049df5c..ab892bc5249 100644 --- a/Lib/lib2to3/fixes/fix_urllib.py +++ b/Lib/lib2to3/fixes/fix_urllib.py @@ -13,7 +13,7 @@ MAPPING = {"urllib": [ ("urllib.request", ["URLopener", "FancyURLopener", "urlretrieve", "_urlopener", "urlopen", "urlcleanup", - "pathname2url", "url2pathname"]), + "pathname2url", "url2pathname", "getproxies"]), ("urllib.parse", ["quote", "quote_plus", "unquote", "unquote_plus", "urlencode", "splitattr", "splithost", "splitnport", diff --git a/Lib/lib2to3/tests/test_fixers.py b/Lib/lib2to3/tests/test_fixers.py index a2852419818..121ebe68e54 100644 --- a/Lib/lib2to3/tests/test_fixers.py +++ b/Lib/lib2to3/tests/test_fixers.py @@ -1913,7 +1913,11 @@ def foo(): """ self.check(b, a) + def test_single_import(self): + b = "from urllib import getproxies" + a = "from urllib.request import getproxies" + self.check(b, a) def test_import_module_usage(self): for old, changes in self.modules.items(): diff --git a/Misc/NEWS.d/next/Tools-Demos/2019-09-18-13-49-56.bpo-38080.Nbl7lF.rst b/Misc/NEWS.d/next/Tools-Demos/2019-09-18-13-49-56.bpo-38080.Nbl7lF.rst new file mode 100644 index 00000000000..1b6def15e72 --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/2019-09-18-13-49-56.bpo-38080.Nbl7lF.rst @@ -0,0 +1,2 @@ +Added support to fix ``getproxies`` in the :mod:`lib2to3.fixes.fix_urllib` +module. Patch by José Roberto Meza Cabrera.