Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion codeflash/code_utils/code_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,10 @@ def add_needed_imports_from_module(
RemoveImportsVisitor.remove_unused_import(dst_context, mod)
for mod, obj_seq in gatherer.object_mapping.items():
for obj in obj_seq:
if f"{mod}.{obj}" in helper_functions_fqn:
if (
f"{mod}.{obj}" in helper_functions_fqn
or dst_context.full_module_name is mod # avoid circular imports
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer == over is

):
continue # Skip adding imports for helper functions already in the context
AddImportsVisitor.add_needed_import(dst_context, mod, obj)
RemoveImportsVisitor.remove_unused_import(dst_context, mod, obj)
Expand Down
Loading