Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions litellm/proxy/auth/auth_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import asyncio
import re
import time
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union, cast
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union

from fastapi import Request, status
from pydantic import BaseModel
Expand Down Expand Up @@ -45,7 +45,6 @@
NewTeamRequest,
ProxyErrorTypes,
ProxyException,
RoleBasedPermissions,
SpecialModelNames,
UserAPIKeyAuth,
)
Expand Down Expand Up @@ -737,11 +736,9 @@ def _get_role_based_permissions(
"""
Get the role based permissions from the general settings.
"""
role_based_permissions = cast(
Optional[List[RoleBasedPermissions]],
general_settings.get("role_permissions", []),
)
if role_based_permissions is None:
# Faster to use .get() without casting first, avoid unnecessary cast before None check
role_based_permissions = general_settings.get("role_permissions") # type: ignore
if not role_based_permissions:
return None

for role_based_permission in role_based_permissions:
Expand Down