There was an error while loading. Please reload this page.
1 parent ca94677 commit 1088b0fCopy full SHA for 1088b0f
2 files changed
Lib/lib2to3/fixes/fix_import.py
@@ -27,9 +27,9 @@ def traverse_imports(names):
27
yield node.value
28
elif node.type == syms.dotted_name:
29
yield "".join([ch.value for ch in node.children])
30
- elif node.type == syms.dotted_as_name:
+ elif node.type in {syms.dotted_as_name, syms.import_as_name}:
31
pending.append(node.children[0])
32
- elif node.type == syms.dotted_as_names:
+ elif node.type in {syms.dotted_as_names, syms.import_as_names}:
33
pending.extend(node.children[::-2])
34
else:
35
raise AssertionError("unknown node type")
Misc/NEWS.d/next/Library/2020-01-10-20-22-04.bpo-39290.RsTxpx.rst
@@ -0,0 +1,2 @@
1
+Add imports_as_name support to ``traverse_imports`` in
2
+``lib2to3.fixes.fix_import``.
0 commit comments