mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Run 2to3 on this library.
This commit is contained in:
parent
f733c60d9a
commit
8a5f8ca33b
22 changed files with 196 additions and 194 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue