Skip to content

Commit 104a5ac

Browse files
committed
handle __future__ import error
1 parent a6e4dc8 commit 104a5ac

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

codeflash/code_utils/code_extractor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,10 @@ def add_needed_imports_from_module(
528528

529529
try:
530530
for mod in gatherer.module_imports:
531+
# Skip __future__ imports as they cannot be imported directly
532+
# __future__ imports should only be imported with specific objects
533+
if mod == "__future__":
534+
continue
531535
if mod not in dotted_import_collector.imports:
532536
AddImportsVisitor.add_needed_import(dst_context, mod)
533537
RemoveImportsVisitor.remove_unused_import(dst_context, mod)

0 commit comments

Comments
 (0)