Skip to content

refactor: simplify handling of imports deferred to a continuation line - #365

Merged
fsouza merged 1 commit into
mainfrom
simplify-no-import-first-line
Aug 22, 2026
Merged

refactor: simplify handling of imports deferred to a continuation line#365
fsouza merged 1 commit into
mainfrom
simplify-no-import-first-line

Conversation

@fsouza

@fsouza fsouza commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #354.

Instead of threading a give-up flag through FilterMultilineImport.__init__ and __call__, skip constructing the filter entirely when the first line has no import keyword: the statement can never be filtered, and the class never accumulated any continuation lines in that case anyway — with empty imports the pending fix was immediately over, so the extra __call__ branch always returned the first line verbatim.

This restores FilterMultilineImport to its pre-#354 shape and moves the guard to filter_unused_import (+5/−19).

Testing

🤖 Generated with Claude Code

Follow-up to #354. Instead of threading a give-up flag through
FilterMultilineImport.__init__ and __call__, skip constructing the
filter entirely when the first line has no `import` keyword: the
statement can never be filtered, and the class never accumulated any
continuation lines in that case anyway (with empty `imports` the
pending fix was immediately over). Behavior is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@fsouza
fsouza merged commit 46890e1 into main Aug 22, 2026
17 checks passed
@fsouza
fsouza deleted the simplify-no-import-first-line branch August 22, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant