litellm_fix: Fix CI issues - mypy, ruff, and ESLint errors

Fixes:
- proxy_server.py: Add missing 'timezone' import from datetime
- cache_coordinator.py: Fix Protocol method signatures
- files/main.py: Add type ignore for wildcard import shadowing
- opentelemetry.py: Fix callback_name type (Optional[str] -> str)
- common_request_processing.py: Add noqa for PLR0915 (too many statements)
- key_management_endpoints.py: Add prisma_client None check
- mcp_management_endpoints.py: Add return type annotation to fallback
- mcp_server_manager.py: Add return type annotation to fallback
- search_endpoints.py: Fix TypedDict access with type ignore
- ToolCallCard.tsx: Remove unused ToolOutlined import
This commit is contained in:
shin-bot-litellm 2026-01-31 07:38:52 +00:00
parent 3f1bda57e2
commit cefe7ccd69
11 changed files with 23 additions and 11 deletions

2
.gitignore vendored
View file

@ -98,4 +98,4 @@ LAZY_LOADING_IMPROVEMENTS.md
**/test-results
**/playwright-report
**/*.storageState.json
**/coverage
**/coveragelitellm/.mypy_cache/

View file

@ -34,7 +34,7 @@ from litellm.types.llms.openai import (
HttpxBinaryResponseContent,
OpenAIFileObject,
)
from litellm.types.router import *
from litellm.types.router import * # type: ignore[no-redef]
from litellm.types.utils import (
OPENAI_COMPATIBLE_BATCH_AND_FILES_PROVIDERS,
LlmProviders,

View file

@ -1631,7 +1631,7 @@ class OpenTelemetry(CustomLogger):
)
except Exception as e:
self.handle_callback_failure(callback_name= self.callback_name)
self.handle_callback_failure(callback_name=self.callback_name or "opentelemetry")
verbose_logger.exception(
"OpenTelemetry logging error in set_attributes %s", str(e)
)

View file

@ -67,9 +67,11 @@ from litellm.types.mcp_server.mcp_server_manager import (
try:
from mcp.shared.tool_name_validation import SEP_986_URL, validate_tool_name # type: ignore
except ImportError:
from typing import Any
SEP_986_URL = "https://github.com/modelcontextprotocol/protocol/blob/main/proposals/0001-tool-name-validation.md"
def validate_tool_name(name: str):
def validate_tool_name(name: str) -> Any:
from pydantic import BaseModel
class MockResult(BaseModel):

View file

@ -623,7 +623,7 @@ class ProxyBaseLLMRequestProcessing:
return self.data, logging_obj
async def base_process_llm_request(
async def base_process_llm_request( # noqa: PLR0915
self,
request: Request,
fastapi_response: Response,

View file

@ -23,9 +23,11 @@ class AsyncCacheProtocol(Protocol):
"""Protocol for cache backends used by EventDrivenCacheCoordinator."""
async def async_get_cache(self, key: str, **kwargs: Any) -> Any:
"""Get value from cache."""
...
async def async_set_cache(self, key: str, value: Any, **kwargs: Any) -> Any:
async def async_set_cache(self, key: str, value: Any, **kwargs: Any) -> None:
"""Set value in cache."""
...

View file

@ -1531,6 +1531,12 @@ async def _process_single_key_update(
Raises:
HTTPException: For various validation and permission errors
"""
if prisma_client is None:
raise HTTPException(
status_code=500,
detail="Database not connected",
)
# Validate max_budget
_validate_max_budget(key_update_item.max_budget)

View file

@ -59,8 +59,9 @@ if MCP_AVAILABLE:
try:
from mcp.shared.tool_name_validation import validate_tool_name # type: ignore
except ImportError:
from typing import Any
def validate_tool_name(name: str):
def validate_tool_name(name: str) -> Any:
from pydantic import BaseModel
class MockResult(BaseModel):

View file

@ -11,7 +11,7 @@ import sys
import time
import traceback
import warnings
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
import enum
from typing import (
TYPE_CHECKING,

View file

@ -245,8 +245,9 @@ async def list_search_tools(
}
# Add description if available
if "search_tool_info" in tool and tool["search_tool_info"]:
description = tool["search_tool_info"].get("description")
search_tool_info = tool.get("search_tool_info") # type: ignore[typeddict-item]
if search_tool_info:
description = search_tool_info.get("description")
if description:
tool_info["description"] = description

View file

@ -4,7 +4,7 @@
import { useState } from 'react';
import { Button, Typography, message } from 'antd';
import { CopyOutlined, ToolOutlined } from '@ant-design/icons';
import { CopyOutlined } from '@ant-design/icons';
import { ToolCall } from './prettyMessagesTypes';
const { Text } = Typography;