summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/fixes
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-11-25 18:37:12 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-11-25 18:37:12 (GMT)
commit39778f6b6f5ce0f162ed7feaebdf370b6ea4daf8 (patch)
tree7d1ee409ea3d46856bada483506b6535ef920fc1 /Lib/lib2to3/fixes
parent2d201f3954e3758c522b7843583cc97aded6fdfc (diff)
downloadcpython-39778f6b6f5ce0f162ed7feaebdf370b6ea4daf8.zip
cpython-39778f6b6f5ce0f162ed7feaebdf370b6ea4daf8.tar.gz
cpython-39778f6b6f5ce0f162ed7feaebdf370b6ea4daf8.tar.bz2
Merged revisions 76518 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r76518 | benjamin.peterson | 2009-11-25 12:34:42 -0600 (Wed, 25 Nov 2009) | 60 lines Merged revisions 76259,76326,76376-76377,76430,76471,76517 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ................ r76259 | georg.brandl | 2009-11-14 05:50:51 -0600 (Sat, 14 Nov 2009) | 1 line Fix terminology. ................ r76326 | georg.brandl | 2009-11-16 10:44:05 -0600 (Mon, 16 Nov 2009) | 1 line #7302: fix link. ................ r76376 | georg.brandl | 2009-11-18 13:39:14 -0600 (Wed, 18 Nov 2009) | 1 line upcase Python ................ r76377 | georg.brandl | 2009-11-18 14:05:15 -0600 (Wed, 18 Nov 2009) | 1 line Fix markup. ................ r76430 | r.david.murray | 2009-11-20 07:29:43 -0600 (Fri, 20 Nov 2009) | 2 lines Issue 7363: fix indentation in socketserver udpserver example. ................ r76471 | georg.brandl | 2009-11-23 13:53:19 -0600 (Mon, 23 Nov 2009) | 1 line #7345: fix arguments of formatyear(). ................ r76517 | benjamin.peterson | 2009-11-25 12:16:46 -0600 (Wed, 25 Nov 2009) | 29 lines Merged revisions 76160-76161,76250,76252,76447,76506 via svnmerge from svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r76160 | benjamin.peterson | 2009-11-08 18:53:48 -0600 (Sun, 08 Nov 2009) | 1 line undeprecate the -p option; it's useful for converting python3 sources ........ r76161 | benjamin.peterson | 2009-11-08 19:05:37 -0600 (Sun, 08 Nov 2009) | 1 line simplify condition ........ r76250 | benjamin.peterson | 2009-11-13 16:56:48 -0600 (Fri, 13 Nov 2009) | 1 line fix handling of a utf-8 bom #7313 ........ r76252 | benjamin.peterson | 2009-11-13 16:58:36 -0600 (Fri, 13 Nov 2009) | 1 line remove pdb turd ........ r76447 | benjamin.peterson | 2009-11-22 18:17:40 -0600 (Sun, 22 Nov 2009) | 1 line #7375 fix nested transformations in fix_urllib ........ r76506 | benjamin.peterson | 2009-11-24 18:34:31 -0600 (Tue, 24 Nov 2009) | 1 line use generator expressions in any() ........ ................ ................
Diffstat (limited to 'Lib/lib2to3/fixes')
-rw-r--r--Lib/lib2to3/fixes/fix_imports.py2
-rw-r--r--Lib/lib2to3/fixes/fix_next.py2
-rw-r--r--Lib/lib2to3/fixes/fix_renames.py2
-rw-r--r--Lib/lib2to3/fixes/fix_urllib.py10
4 files changed, 8 insertions, 8 deletions
diff --git a/Lib/lib2to3/fixes/fix_imports.py b/Lib/lib2to3/fixes/fix_imports.py
index 6c41c71..5c053c0 100644
--- a/Lib/lib2to3/fixes/fix_imports.py
+++ b/Lib/lib2to3/fixes/fix_imports.py
@@ -108,7 +108,7 @@ class FixImports(fixer_base.BaseFix):
# Module usage could be in the trailer of an attribute lookup, so we
# might have nested matches when "bare_with_attr" is present.
if "bare_with_attr" not in results and \
- any([match(obj) for obj in attr_chain(node, "parent")]):
+ any(match(obj) for obj in attr_chain(node, "parent")):
return False
return results
return False
diff --git a/Lib/lib2to3/fixes/fix_next.py b/Lib/lib2to3/fixes/fix_next.py
index c999d6f..66a00c2 100644
--- a/Lib/lib2to3/fixes/fix_next.py
+++ b/Lib/lib2to3/fixes/fix_next.py
@@ -99,4 +99,4 @@ def find_assign(node):
def is_subtree(root, node):
if root == node:
return True
- return any([is_subtree(c, node) for c in root.children])
+ return any(is_subtree(c, node) for c in root.children)
diff --git a/Lib/lib2to3/fixes/fix_renames.py b/Lib/lib2to3/fixes/fix_renames.py
index 275e23f..c9f68d5 100644
--- a/Lib/lib2to3/fixes/fix_renames.py
+++ b/Lib/lib2to3/fixes/fix_renames.py
@@ -49,7 +49,7 @@ class FixRenames(fixer_base.BaseFix):
match = super(FixRenames, self).match
results = match(node)
if results:
- if any([match(obj) for obj in attr_chain(node, "parent")]):
+ if any(match(obj) for obj in attr_chain(node, "parent")):
return False
return results
return False
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'):