chore: drop empty if TYPE_CHECKING: blocks and orphaned imports (ruff TC005)#153
Open
alexzhu0 wants to merge 1 commit intoFlowElement-ai:mainfrom
Open
Conversation
…ff TC005) Ruff rule TC005 flags `if TYPE_CHECKING: pass` / empty `if TYPE_CHECKING` blocks — dead code left behind by previous refactors when every forward- reference import under the block was eventually removed. Scope: 28 files, all hits of TC005 outside generated code. After deleting each empty block, the `TYPE_CHECKING` symbol becomes an unused import (F401) in those same 28 files — this PR cleans that up in the same commit so the files are self-consistent. F401 is invoked only on files already touched by TC005; nothing else is rewritten. Verification: - `ruff check . --exclude 'm_flow/baml_client' --select TC005` is now clean - `ast.parse` on every touched file: clean - Import check via project `uv run python` on sample modules: clean No behavior change.
b3c7c76 to
6267bdc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ruff rule TC005 flags empty
if TYPE_CHECKING:blocks — dead code left behind by previous refactors when every forward-reference import under the block was eventually removed. 28 occurrences outside generated code.After deleting the empty block, the
TYPE_CHECKINGimport becomes unused (F401) in the same file. This PR cleans both in one commit so each file is self-consistent; F401 is invoked only on files already touched by TC005, nothing else is rewritten.Some files still have other unused imports the broader F401 sweep would clean up — those are deliberately out of scope here (I tried the global
ruff --select F401 --fixand it cascaded into 90 files touching unrelated code). This PR is strictly the TC005 blast radius.Scope
28 files, +19 / −84. Touched areas:
episode_quality.pyacreate_structured_output, litellm_instructor openai adapterVerification
No behavior change. Generated code under
m_flow/baml_client/is untouched.I affirm that all code in every commit of this pull request conforms to the terms of the M-flow Developer Certificate of Origin