summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/fixes/fix_urllib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/lib2to3/fixes/fix_urllib.py')
-rw-r--r--Lib/lib2to3/fixes/fix_urllib.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/lib2to3/fixes/fix_urllib.py b/Lib/lib2to3/fixes/fix_urllib.py
index d11220c..db18ca8 100644
--- a/Lib/lib2to3/fixes/fix_urllib.py
+++ b/Lib/lib2to3/fixes/fix_urllib.py
@@ -63,7 +63,8 @@ def build_pattern():
yield """import_name< 'import'
dotted_as_name< module_as=%r 'as' any > >
""" % old_module
- yield """power< module_dot=%r trailer< '.' member=%s > any* >
+ # bare_with_attr has a special significance for FixImports.match().
+ yield """power< bare_with_attr=%r trailer< '.' member=%s > any* >
""" % (old_module, members)
@@ -150,12 +151,11 @@ class FixUrllib(FixImports):
def transform_dot(self, node, results):
"""Transform for calls to module members in code."""
- module_dot = results.get('module_dot')
+ module_dot = results.get('bare_with_attr')
member = results.get('member')
- # this may be a list of length one, or just a node
+ new_name = None
if isinstance(member, list):
member = member[0]
- new_name = None
for change in MAPPING[module_dot.value]:
if member.value in change[1]:
new_name = change[0]
@@ -171,7 +171,7 @@ class FixUrllib(FixImports):
self.transform_import(node, results)
elif results.get('mod_member'):
self.transform_member(node, results)
- elif results.get('module_dot'):
+ elif results.get('bare_with_attr'):
self.transform_dot(node, results)
# Renaming and star imports are not supported for these modules.
elif results.get('module_star'):