chore: sort __slots__ tuples alphabetically (ruff RUF023)#152
Open
alexzhu0 wants to merge 1 commit intoFlowElement-ai:mainfrom
Open
chore: sort __slots__ tuples alphabetically (ruff RUF023)#152alexzhu0 wants to merge 1 commit intoFlowElement-ai:mainfrom
__slots__ tuples alphabetically (ruff RUF023)#152alexzhu0 wants to merge 1 commit intoFlowElement-ai:mainfrom
Conversation
Ruff's RUF023 flags `__slots__` tuples that aren't in natural-sort order. Python itself doesn't care about slot order — slots are addressed by name, not position — but keeping them sorted makes diffs trivially reviewable and removes a class of copy-paste-then-miss-one-field bugs. Scope: 9 files, 10 classes touched. Each change reorders only the literal slot strings; no slot is added, removed, renamed, or rewired. No `__init__`, `__reduce__`, pickling logic, or inheritance contract is affected. Verification: - `ruff check . --exclude 'm_flow/baml_client' --select RUF023` is now clean - import check via project `uv run python` on all touched modules: clean No behavior change.
Contributor
Author
|
I've opened #167 with a two-line fix (drop (The other failing checks are already green after the latest push.) |
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 RUF023 flags
__slots__tuples that are not in natural-sort order. Python itself doesn't care about slot order — slots are addressed by name, not position — but keeping them sorted makes diffs trivially reviewable and removes a class of copy-paste-then-miss-one-field bugs.10 occurrences across 9 files, all auto-fixable.
What changed
Pure reordering. No slot is added, removed, renamed, or rewired. No
__init__, descriptor lookup,__reduce__/pickle protocol, or inheritance contract changes.class CacheDBInterface(ABC): ... - __slots__ = ("_host", "_port", "_key", "_lock") + __slots__ = ("_host", "_key", "_lock", "_port")class FastembedEmbeddingEngine(EmbeddingEngine): ... __slots__ = ( - "model", - "dimensions", - "max_completion_tokens", "batch_size", + "dimensions", "embedding_model", - "tokenizer", + "max_completion_tokens", "mock", + "model", + "tokenizer", )Files
CacheDBInterfaceFastembedEmbeddingEngine,OllamaEmbeddingEngineMemoryGraph,MemoryGraphNode,MemoryGraphEdge(2 classes inMemoryGraphElements.py)GeminiTokenizer,MistralTokenizerStage(pipeline/tasks/task.py),FileBufferedReader9 files, +16 / −16.
Verification
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