Skip to content

chore: drop unnecessary pass statements (ruff PIE790)#150

Open
alexzhu0 wants to merge 1 commit intoFlowElement-ai:mainfrom
alexzhu0:chore/ruff-pie790-drop-unnecessary-pass
Open

chore: drop unnecessary pass statements (ruff PIE790)#150
alexzhu0 wants to merge 1 commit intoFlowElement-ai:mainfrom
alexzhu0:chore/ruff-pie790-drop-unnecessary-pass

Conversation

@alexzhu0
Copy link
Copy Markdown
Contributor

@alexzhu0 alexzhu0 commented May 2, 2026

Summary

Ruff rule PIE790 flags pass statements that are semantically redundant — the enclosing class / function / except block already has a docstring, a comment, or another statement, so pass adds nothing. 24 occurrences total, all auto-fixable.

What changed

Three shapes, all semantics-preserving:

  1. Class body with only a docstring + pass (11×) — the docstring alone is a valid class body.

    class UserUpdate(schemas.BaseUserUpdate):
        """Inbound payload for partial user profile updates."""
    -   pass
  2. Async placeholder method with docstring + pass (8×) — a docstring is a statement, so the method stays a complete no-op.

    async def drop_graph(self, graph_name: str = "myGraph") -> None:
        """Placeholder - GDS projection not supported in Neptune Analytics."""
    -   pass
  3. except block with a logger.error(...) + dangling pass (2×) — the logger call is a statement, so the block stays valid.

    except Exception as e:
        logger.error(f"Error during memory fragment creation: {str(e)}")
    -   pass

One additional site (graph_db_interface.py) keeps the inline comment as the sole body — the original pass # Default: no-op for databases that auto-checkpoint is replaced by # Default: no-op for databases that auto-checkpoint, which is still a valid block inside a docstring-bearing method.

Files

Area Files
Graph / vector adapters adapters/graph/graph_db_interface.py, adapters/graph/neo4j_driver/Neo4jAuraDevDatasetDatabaseHandler.py, adapters/graph/neptune_driver/adapter.py, adapters/hybrid/neptune_analytics/NeptuneAnalyticsAdapter.py, adapters/vector/vector_db_interface.py
Auth / users auth/authentication/default/default_jwt_strategy.py, auth/models/User.py
Data / core models core/models/ExtendableMemoryNode.py, data/models/{answers,metrics,questions}_base.py
Eval / LLM eval/config.py, llm/exceptions.py, llm/extraction/knowledge_graph/extract_content_graph.py
Retrieval / storage retrieval/utils/fine_grained_triplet_search.py, retrieval/utils/procedural_memory_fragment.py, shared/files/storage/S3FileStorage.py
Tests tests/unit/auth/test_permission_concurrency.py

18 files, +2 / −24.

Verification

$ ruff check . --exclude 'm_flow/baml_client' --exclude 'm_flow-frontend' --select PIE790
All checks passed!

$ for f in <every modified file>; do python -m py_compile "$f"; done
# clean across all 18 files

$ PYTHONPATH=. uv run pytest m_flow/tests/unit/auth/test_permission_concurrency.py -q
8 passed

No behavior change. Nothing user-visible. 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

Ruff's PIE790 flags `pass` statements that are semantically redundant:
- class bodies that already contain a docstring
- function bodies that already contain a docstring, comment, or other statement
- `except` blocks that already contain a logger call

Python considers a docstring a statement, so these classes/functions stay
syntactically valid (a module-level or method-level docstring alone is a
complete suite). All 24 occurrences flagged by ruff are semantics-preserving
deletions; no behavior change.

Verification:
- `ruff check . --exclude 'm_flow/baml_client' --select PIE790` is now clean
- `py_compile` on every touched file: clean
- `pytest m_flow/tests/unit/auth/test_permission_concurrency.py`: 8 passed
@alexzhu0
Copy link
Copy Markdown
Contributor Author

alexzhu0 commented May 5, 2026

Static analysis — weighted-edge sources failing here (and on every fork PR) is not from this change — it's a workflow config bug. The job's ruff-action args pass m_flow/knowledge/graph_ops/** as a string; ruff-action doesn't shell-expand it, so ruff hits E902 No such file or directory on the literal ** path before it lints anything.

I've opened #167 with a two-line fix (drop /**, ruff recurses into directories). Once that merges this check should go green on this PR without any rebase here.

(The other failing checks are already green after the latest push.)

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