diff --git a/litellm/llms/openai/common_utils.py b/litellm/llms/openai/common_utils.py index 868d02ee1e..5f9559df77 100644 --- a/litellm/llms/openai/common_utils.py +++ b/litellm/llms/openai/common_utils.py @@ -5,7 +5,7 @@ Common helpers / utils across al OpenAI endpoints import hashlib import json import ssl -from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union +from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union import httpx import openai @@ -24,9 +24,10 @@ from litellm.llms.custom_httpx.http_handler import ( get_ssl_configuration, ) + def _get_client_init_params(cls: type) -> List[str]: """Extract __init__ parameter names (excluding 'self') from a class.""" - return [p for p in inspect.signature(cls.__init__).parameters if p != "self"] + return [p for p in inspect.signature(cls.__init__).parameters if p != "self"] # type: ignore[misc] _OPENAI_INIT_PARAMS: List[str] = _get_client_init_params(OpenAI) diff --git a/litellm/llms/vertex_ai/vertex_ai_non_gemini.py b/litellm/llms/vertex_ai/vertex_ai_non_gemini.py index 8933729233..54cb83bb0b 100644 --- a/litellm/llms/vertex_ai/vertex_ai_non_gemini.py +++ b/litellm/llms/vertex_ai/vertex_ai_non_gemini.py @@ -247,7 +247,7 @@ def completion( # noqa: PLR0915 instances = [optional_params.copy()] instances[0]["prompt"] = prompt instances = [ - json_format.ParseDict(instance_dict, Value()) + json_format.ParseDict(instance_dict, Value()) # type: ignore[misc] for instance_dict in instances ] # Will determine the API used based on async parameter @@ -375,7 +375,7 @@ def completion( # noqa: PLR0915 ) llm_model = aiplatform.gapic.PredictionServiceClient( client_options=client_options, - credentials=creds, + credentials=creds, # type: ignore[arg-type] ) request_str += f"llm_model = aiplatform.gapic.PredictionServiceClient(client_options={client_options}, credentials=...)\n" endpoint_path = llm_model.endpoint_path( @@ -441,7 +441,7 @@ def completion( # noqa: PLR0915 model_response.model = model ## CALCULATING USAGE if model in litellm.vertex_language_models and response_obj is not None: - model_response.choices[0].finish_reason = map_finish_reason( + model_response.choices[0].finish_reason = map_finish_reason( # type: ignore[assignment] response_obj.candidates[0].finish_reason.name ) usage = Usage( @@ -614,7 +614,7 @@ async def async_completion( # noqa: PLR0915 model_response.model = model ## CALCULATING USAGE if model in litellm.vertex_language_models and response_obj is not None: - model_response.choices[0].finish_reason = map_finish_reason( + model_response.choices[0].finish_reason = map_finish_reason( # type: ignore[assignment] response_obj.candidates[0].finish_reason.name ) usage = Usage( diff --git a/litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/guardrail_benchmarks/test_eval.py b/litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/guardrail_benchmarks/test_eval.py index 5fbdd1456e..afb391a38a 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/guardrail_benchmarks/test_eval.py +++ b/litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/guardrail_benchmarks/test_eval.py @@ -228,8 +228,8 @@ def _content_filter(category: str): guardrail = ContentFilterGuardrail( guardrail_name=f"{category}_eval", - categories=[ # type: ignore[arg-type,list-item] - { + categories=[ + { # type: ignore[list-item] "category": category, "enabled": True, "action": "BLOCK", diff --git a/tests/code_coverage_tests/check_licenses.py b/tests/code_coverage_tests/check_licenses.py index f49f6807a0..7aa01ef12b 100644 --- a/tests/code_coverage_tests/check_licenses.py +++ b/tests/code_coverage_tests/check_licenses.py @@ -214,9 +214,9 @@ class LicenseChecker: try: with open(requirements_file) as f: requirements = [ - Requirement(line.strip()) + Requirement(line.split("#")[0].strip()) for line in f - if line.strip() and not line.startswith("#") + if line.split("#")[0].strip() and not line.startswith("#") ] except Exception as e: print(f"Error parsing {requirements_file}: {str(e)}") diff --git a/tests/code_coverage_tests/router_code_coverage.py b/tests/code_coverage_tests/router_code_coverage.py index 98c944e4e1..014f3a16b5 100644 --- a/tests/code_coverage_tests/router_code_coverage.py +++ b/tests/code_coverage_tests/router_code_coverage.py @@ -78,6 +78,8 @@ ignored_function_names = [ "__init__", "avector_store_create", # Tested via proxy vector_store_endpoints (files lack "router" in name) "_override_vector_store_methods_for_router", # No-op placeholder, called during Router init + "_merge_tools_from_deployment", # Tested indirectly via _update_kwargs_with_deployment (test files lack "router" in name) + "_invalidate_access_groups_cache", # Tested indirectly via set_model_list, upsert_model etc. (test files lack "router" in name) ]