diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-03-19 05:33:36 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-03-19 05:33:36 (GMT) |
commit | 8a5f8ca33b56db9af973d1f34a9b3df5271b56c0 (patch) | |
tree | 55b17647085ff8b679f2bea803545884148c66e4 /Lib/lib2to3/fixes | |
parent | f733c60d9aea123a46cd41dbe4dedee7aa2f20f3 (diff) | |
download | cpython-8a5f8ca33b56db9af973d1f34a9b3df5271b56c0.zip cpython-8a5f8ca33b56db9af973d1f34a9b3df5271b56c0.tar.gz cpython-8a5f8ca33b56db9af973d1f34a9b3df5271b56c0.tar.bz2 |
Run 2to3 on this library.
Diffstat (limited to 'Lib/lib2to3/fixes')
-rw-r--r-- | Lib/lib2to3/fixes/basefix.py | 2 | ||||
-rw-r--r-- | Lib/lib2to3/fixes/fix_imports.py | 6 | ||||
-rw-r--r-- | Lib/lib2to3/fixes/fix_renames.py | 4 | ||||
-rw-r--r-- | Lib/lib2to3/fixes/util.py | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/Lib/lib2to3/fixes/basefix.py b/Lib/lib2to3/fixes/basefix.py index 66c448e..38666c1 100644 --- a/Lib/lib2to3/fixes/basefix.py +++ b/Lib/lib2to3/fixes/basefix.py @@ -108,7 +108,7 @@ class BaseFix(object): """ name = template while name in self.used_names: - name = template + str(self.numbers.next()) + name = template + str(next(self.numbers)) self.used_names.add(name) return name diff --git a/Lib/lib2to3/fixes/fix_imports.py b/Lib/lib2to3/fixes/fix_imports.py index fbdf7e4..9aba984 100644 --- a/Lib/lib2to3/fixes/fix_imports.py +++ b/Lib/lib2to3/fixes/fix_imports.py @@ -10,8 +10,8 @@ Fixes: # Local imports from . import basefix from .util import Name, attr_chain, any, set -import __builtin__ -builtin_names = [name for name in dir(__builtin__) +import builtins +builtin_names = [name for name in dir(builtins) if name not in ("__name__", "__doc__")] MAPPING = {"StringIO": ("io", ["StringIO"]), @@ -26,7 +26,7 @@ def alternates(members): def build_pattern(): bare = set() - for old_module, (new_module, members) in MAPPING.items(): + for old_module, (new_module, members) in list(MAPPING.items()): bare.add(old_module) bare.update(members) members = alternates(members) diff --git a/Lib/lib2to3/fixes/fix_renames.py b/Lib/lib2to3/fixes/fix_renames.py index 58ad6ce..0b2bbf5 100644 --- a/Lib/lib2to3/fixes/fix_renames.py +++ b/Lib/lib2to3/fixes/fix_renames.py @@ -20,8 +20,8 @@ def alternates(members): def build_pattern(): #bare = set() - for module, replace in MAPPING.items(): - for old_attr, new_attr in replace.items(): + for module, replace in list(MAPPING.items()): + for old_attr, new_attr in list(replace.items()): LOOKUP[(module, old_attr)] = new_attr #bare.add(module) #bare.add(old_attr) diff --git a/Lib/lib2to3/fixes/util.py b/Lib/lib2to3/fixes/util.py index ef809af..806bf28 100644 --- a/Lib/lib2to3/fixes/util.py +++ b/Lib/lib2to3/fixes/util.py @@ -323,7 +323,7 @@ def _is_import_binding(node, name, package=None): elif node.type == syms.import_from: # unicode(...) is used to make life easier here, because # from a.b import parses to ['import', ['a', '.', 'b'], ...] - if package and unicode(node.children[1]).strip() != package: + if package and str(node.children[1]).strip() != package: return None n = node.children[3] if package and _find('as', n): |