Skip to content

[test_fix]: fix lint problem#24932

Merged
ishaan-berri merged 1 commit intomainfrom
litellm_fix_test_mypy
Apr 1, 2026
Merged

[test_fix]: fix lint problem#24932
ishaan-berri merged 1 commit intomainfrom
litellm_fix_test_mypy

Conversation

@clfhhc
Copy link
Copy Markdown
Contributor

@clfhhc clfhhc commented Apr 1, 2026

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Apr 1, 2026 5:23pm

Request Review

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Copy Markdown
Contributor

@ishaan-berri ishaan-berri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ishaan-berri ishaan-berri merged commit c987bdb into main Apr 1, 2026
64 of 98 checks passed
@ishaan-berri ishaan-berri deleted the litellm_fix_test_mypy branch April 1, 2026 17:24
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 1, 2026

Greptile Summary

This PR adds a defensive or [] guard to prevent iterating over a potentially-None access_group_ids attribute in _add_access_group_models_to_team_models, fixing a linter warning.

Key observations:

  • The guard is technically redundant at runtime — the first-pass loop at line 9286 (if not team_object.access_group_ids: continue) already ensures only teams with a truthy access_group_ids reach the second-pass loop. However, type checkers typically cannot narrow mutable object attributes, so the or [] correctly satisfies static analysis tools.
  • A trailing space was accidentally introduced before the colon (or [] :), which is itself a PEP 8 E203 violation and could be flagged by the same linter this PR aims to fix.

Confidence Score: 5/5

Safe to merge; the only finding is a trivial style issue (trailing space before colon).

The change is a one-line defensive null-guard with no behavioral impact at runtime. The sole issue identified is a P2 whitespace style nit that does not affect correctness.

No files require special attention.

Important Files Changed

Filename Overview
litellm/proxy/proxy_server.py One-line defensive guard added to handle a potentially-None access_group_ids when iterating; introduces a minor PEP 8 whitespace issue (trailing space before :)

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[_add_access_group_models_to_team_models] --> B[First pass over team_db_objects_typed]
    B --> C{team_object.access_group_ids truthy?}
    C -- No --> D[skip team]
    C -- Yes --> E{team has restricted models?}
    E -- No --> D
    E -- Yes --> F[Add to eligible_teams\nCollect access_group_ids]
    F --> G[Batch DB fetch for all access groups]
    G --> H[Build ag_model_map]
    H --> I[Second pass over eligible_teams]
    I --> J["for ag_id in access_group_ids or []: ← CHANGED"]
    J --> K[Lookup models in ag_model_map]
    K --> L[Resolve deployments via llm_router]
    L --> M[Merge into team_models]
    M --> N[Return team_models]
Loading

Reviews (1): Last reviewed commit: "fix lint problem" | Re-trigger Greptile

for team_object in eligible_teams:
model_names: Set[str] = set()
for ag_id in team_object.access_group_ids:
for ag_id in team_object.access_group_ids or [] :
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Trailing whitespace before colon

The or [] : introduces a trailing space before the colon, which is itself a PEP 8 violation (E203) and may be flagged by the same linter this PR is trying to fix.

Suggested change
for ag_id in team_object.access_group_ids or [] :
for ag_id in team_object.access_group_ids or []:

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq bot commented Apr 1, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing litellm_fix_test_mypy (4641280) with main (0f88968)

Open in CodSpeed

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.

3 participants