fix(lint): suppress PLR0915 in complex transform methods#22328
fix(lint): suppress PLR0915 in complex transform methods#22328
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummarySuppresses Ruff PLR0915 (too-many-statements) lint warnings on three complex event/message transformation methods by adding inline
This follows the well-established codebase pattern — there are 100+ existing Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py | Adds # noqa: PLR0915 to _process_event method (84 statements) — a complex event-type dispatcher where splitting would reduce readability. No functional changes. |
| litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py | Adds # noqa: PLR0915 to translate_messages_to_responses_input method (51 statements) — a message format translator with many branches. No functional changes. |
| litellm/llms/gemini/realtime/transformation.py | Adds # noqa: PLR0915 to transform_realtime_response method (54 statements) — a realtime event transformer with many event type branches. No functional changes. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Ruff Lint Check] --> B{PLR0915 too-many-statements}
B -->|streaming_iterator.py| C["_process_event\n84 statements\n# noqa: PLR0915"]
B -->|transformation.py\nAnthropic| D["translate_messages_to_responses_input\n51 statements\n# noqa: PLR0915"]
B -->|transformation.py\nGemini| E["transform_realtime_response\n54 statements\n# noqa: PLR0915"]
C --> F[Lint passes ✓]
D --> F
E --> F
Last reviewed commit: 21b21d7
|
@shin-bot-litellm evaluate this PR |
…methods These three methods legitimately need many statements for their event/message transformation logic. Suppress the lint warning rather than artificially splitting the methods. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21b21d7 to
e3779a8
Compare
CI Failure: MCP test failuresThese 3 MCP test failures are pre-existing on main and unrelated to this PR's lint suppression changes. Root cause: Tests mock Fix PR: #22327 |
CI Failure: MyPy type errors (21 errors in 9 files)These MyPy errors are pre-existing on main and unrelated to this PR. This PR only adds The 21 errors span 9 files across the codebase:
All verified to exist on |
Summary
streaming_iterator.py::_process_event(84 statements)transformation.py::translate_messages_to_responses_input(51 statements)transformation.py::transform_realtime_response(54 statements)These are complex transformation methods where splitting would reduce readability. Suppressing the lint warning is the appropriate fix.
Test plan
ruff checkpasses with no PLR0915 errors🤖 Generated with Claude Code