Skip to content

Commit 03e2fff

Browse files
committed
refactor: simplify _has_aliased_future_imports check
cst.Attribute branch was dead code since __future__ imports always use a plain Name node.
1 parent f180c3f commit 03e2fff

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

codeflash/languages/python/static_analysis/code_extractor.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,7 @@ def _has_aliased_future_imports(module: cst.Module) -> bool:
432432
for s in stmt.body:
433433
if (
434434
isinstance(s, cst.ImportFrom)
435-
and s.module is not None
436-
and isinstance(s.module, (cst.Attribute, cst.Name))
437-
and hasattr(s.module, "value")
435+
and isinstance(s.module, cst.Name)
438436
and s.module.value == "__future__"
439437
and isinstance(s.names, (list, tuple))
440438
and any(name.asname is not None for name in s.names)

0 commit comments

Comments
 (0)