From 939d3f7735111473ec05289b94890d1daf963017 Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Fri, 12 Jun 2026 11:08:01 -0700 Subject: [PATCH 01/10] feat: add ruff strict-rule suppressions baseline gate Introduce a stricter ruff rule set (typed params, no Any, complexity and arg-count caps, mutable-default and global-rebinding checks) grandfathered against the current tree and enforced as a budget rather than zero-tolerance ruff-strict.toml defines the 9 rules separately from ruff.toml so the existing ruff check stays green. scripts/ruff_suppressions.py builds the per-file, per-rule baseline in ruff-suppressions.json and gates CI by failing when the total grows past the baseline plus a 0.5% slack margin. The baseline ratchets down via `make lint-suppressions-update` after fixes --- .github/workflows/test-linting.yml | 4 + Makefile | 11 +- ruff-strict.toml | 11 + ruff-suppressions.json | 4094 ++++++++++++++++++ scripts/ruff_suppressions.py | 128 + tests/test_litellm/test_ruff_suppressions.py | 76 + 6 files changed, 4323 insertions(+), 1 deletion(-) create mode 100644 ruff-strict.toml create mode 100644 ruff-suppressions.json create mode 100644 scripts/ruff_suppressions.py create mode 100644 tests/test_litellm/test_ruff_suppressions.py diff --git a/.github/workflows/test-linting.yml b/.github/workflows/test-linting.yml index b5e45a38cf9a..64371c320aa1 100644 --- a/.github/workflows/test-linting.yml +++ b/.github/workflows/test-linting.yml @@ -67,6 +67,10 @@ jobs: uv run --no-sync ruff check . cd .. + - name: Check strict-rule suppressions budget + run: | + uv run --no-sync python scripts/ruff_suppressions.py check + - name: Print OpenAI version run: | uv run --no-sync python -c "import openai; print(f'OpenAI version: {openai.__version__}')" diff --git a/Makefile b/Makefile index 3d7b51bc7452..0a409a77de79 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ test-unit-integrations test-unit-core-utils test-unit-other test-unit-root \ test-proxy-unit-a test-proxy-unit-b test-integration test-unit-helm \ info lint lint-dev format \ + lint-suppressions lint-suppressions-update \ install-dev install-proxy-dev install-test-deps install-hooks \ install-helm-unittest check-circular-imports check-import-safety @@ -24,6 +25,8 @@ help: @echo " make lint-ruff - Run Ruff linting only" @echo " make lint-mypy - Run MyPy type checking only" @echo " make lint-black - Check Black formatting (matches CI)" + @echo " make lint-suppressions - Check strict ruff rules against the grandfathered baseline" + @echo " make lint-suppressions-update - Regenerate ruff-suppressions.json (ratchet the baseline)" @echo " make check-circular-imports - Check for circular imports" @echo " make check-import-safety - Check import safety" @echo " make test - Run all tests" @@ -122,6 +125,12 @@ lint-mypy: install-dev lint-black: format-check +lint-suppressions: install-dev + $(UV_RUN) python scripts/ruff_suppressions.py check + +lint-suppressions-update: install-dev + $(UV_RUN) python scripts/ruff_suppressions.py update + check-circular-imports: install-dev cd litellm && $(UV_RUN) python ../tests/documentation_tests/test_circular_imports.py && cd .. @@ -129,7 +138,7 @@ check-import-safety: install-dev @$(UV_RUN) python -c "from litellm import *; print('[from litellm import *] OK! no issues!');" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1) # Combined linting (matches test-linting.yml workflow) -lint: format-check lint-ruff lint-mypy check-circular-imports check-import-safety +lint: format-check lint-ruff lint-mypy check-circular-imports check-import-safety lint-suppressions # Faster linting for local development (only checks changed code) lint-dev: lint-format-changed lint-mypy check-circular-imports check-import-safety diff --git a/ruff-strict.toml b/ruff-strict.toml new file mode 100644 index 000000000000..73e510b82a18 --- /dev/null +++ b/ruff-strict.toml @@ -0,0 +1,11 @@ +extend = "ruff.toml" + +[lint] +select = ["ANN001", "ANN002", "ANN003", "ANN401", "B006", "C901", "PLR0913", "PLW0603", "RUF012"] +extend-select = [] + +[lint.mccabe] +max-complexity = 15 + +[lint.pylint] +max-args = 5 diff --git a/ruff-suppressions.json b/ruff-suppressions.json new file mode 100644 index 000000000000..2ca34cdf2e39 --- /dev/null +++ b/ruff-suppressions.json @@ -0,0 +1,4094 @@ +{ + "litellm/_lazy_imports.py": { + "ANN401": 18, + "C901": 1, + "PLW0603": 4 + }, + "litellm/_logging.py": { + "ANN001": 10 + }, + "litellm/_redis.py": { + "ANN001": 7, + "ANN003": 4, + "C901": 1 + }, + "litellm/_redis_credential_provider.py": { + "ANN401": 1 + }, + "litellm/_service_logger.py": { + "ANN001": 4, + "ANN401": 3, + "PLR0913": 3 + }, + "litellm/a2a_protocol/exception_mapping_utils.py": { + "ANN401": 1 + }, + "litellm/a2a_protocol/exceptions.py": { + "PLR0913": 2 + }, + "litellm/a2a_protocol/litellm_completion_bridge/transformation.py": { + "ANN401": 1 + }, + "litellm/a2a_protocol/main.py": { + "ANN401": 7, + "C901": 1, + "PLR0913": 4 + }, + "litellm/a2a_protocol/providers/base.py": { + "ANN003": 2 + }, + "litellm/a2a_protocol/providers/bedrock_agentcore/config.py": { + "ANN003": 2 + }, + "litellm/a2a_protocol/providers/bedrock_agentcore/transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/a2a_protocol/providers/langflow/config.py": { + "ANN003": 2 + }, + "litellm/a2a_protocol/providers/pydantic_ai_agents/config.py": { + "ANN003": 1, + "ANN401": 1 + }, + "litellm/a2a_protocol/providers/pydantic_ai_agents/handler.py": { + "PLR0913": 1 + }, + "litellm/a2a_protocol/providers/pydantic_ai_agents/transformation.py": { + "ANN401": 6, + "PLR0913": 1 + }, + "litellm/a2a_protocol/providers/watsonx_orchestrate/config.py": { + "ANN401": 2 + }, + "litellm/a2a_protocol/providers/watsonx_orchestrate/handler.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/a2a_protocol/providers/watsonx_orchestrate/transformation.py": { + "ANN401": 1 + }, + "litellm/a2a_protocol/streaming_iterator.py": { + "ANN401": 2 + }, + "litellm/a2a_protocol/utils.py": { + "ANN401": 3 + }, + "litellm/anthropic_beta_headers_manager.py": { + "PLW0603": 2 + }, + "litellm/anthropic_interface/messages/__init__.py": { + "ANN003": 2, + "PLR0913": 2 + }, + "litellm/assistants/main.py": { + "ANN001": 3, + "ANN003": 18, + "ANN401": 6, + "PLR0913": 6 + }, + "litellm/assistants/utils.py": { + "ANN001": 2, + "ANN003": 2, + "PLR0913": 1 + }, + "litellm/batch_completion/main.py": { + "ANN001": 4, + "ANN002": 2, + "ANN003": 3, + "B006": 1, + "PLR0913": 1 + }, + "litellm/batches/batch_utils.py": { + "ANN401": 2 + }, + "litellm/batches/main.py": { + "ANN001": 1, + "ANN003": 9, + "ANN401": 1, + "PLR0913": 6 + }, + "litellm/budget_manager.py": { + "ANN001": 4 + }, + "litellm/caching/_internal_lru_cache.py": { + "ANN002": 2, + "ANN003": 2 + }, + "litellm/caching/azure_blob_cache.py": { + "ANN001": 9, + "ANN003": 5 + }, + "litellm/caching/base_cache.py": { + "ANN001": 9, + "ANN003": 7 + }, + "litellm/caching/caching.py": { + "ANN001": 8, + "ANN003": 15, + "ANN401": 3, + "B006": 3, + "C901": 1, + "PLR0913": 1 + }, + "litellm/caching/caching_handler.py": { + "ANN401": 7, + "C901": 1, + "PLR0913": 5 + }, + "litellm/caching/disk_cache.py": { + "ANN001": 10, + "ANN003": 9 + }, + "litellm/caching/dual_cache.py": { + "ANN001": 13, + "ANN002": 1, + "ANN003": 12, + "PLR0913": 1 + }, + "litellm/caching/gcs_cache.py": { + "ANN001": 7, + "ANN003": 5 + }, + "litellm/caching/in_memory_cache.py": { + "ANN001": 12, + "ANN003": 10, + "ANN401": 1 + }, + "litellm/caching/llm_caching_handler.py": { + "ANN001": 7, + "ANN003": 4 + }, + "litellm/caching/qdrant_semantic_cache.py": { + "ANN001": 15, + "ANN003": 6, + "ANN401": 2, + "C901": 1, + "PLR0913": 1 + }, + "litellm/caching/redis_cache.py": { + "ANN001": 18, + "ANN002": 1, + "ANN003": 13, + "ANN401": 4, + "PLR0913": 1 + }, + "litellm/caching/redis_cluster_cache.py": { + "ANN002": 1, + "ANN003": 1 + }, + "litellm/caching/redis_semantic_cache.py": { + "ANN003": 9, + "ANN401": 13, + "PLR0913": 1 + }, + "litellm/caching/s3_cache.py": { + "ANN001": 17, + "ANN003": 6, + "PLR0913": 1 + }, + "litellm/completion_extras/litellm_responses_transformation/handler.py": { + "ANN002": 2, + "ANN003": 2, + "ANN401": 5 + }, + "litellm/completion_extras/litellm_responses_transformation/transformation.py": { + "ANN001": 1, + "ANN401": 7, + "C901": 2, + "PLR0913": 2 + }, + "litellm/compression/compress.py": { + "ANN401": 3, + "PLR0913": 2 + }, + "litellm/containers/endpoint_factory.py": { + "ANN003": 2 + }, + "litellm/containers/main.py": { + "ANN001": 18, + "ANN003": 18, + "PLR0913": 12 + }, + "litellm/cost_calculator.py": { + "ANN001": 8, + "ANN401": 7, + "B006": 1, + "C901": 2, + "PLR0913": 7 + }, + "litellm/endpoints/speech/speech_to_completion_bridge/handler.py": { + "PLR0913": 1 + }, + "litellm/endpoints/speech/speech_to_completion_bridge/transformation.py": { + "PLR0913": 1 + }, + "litellm/evals/main.py": { + "ANN003": 22, + "PLR0913": 16 + }, + "litellm/exceptions.py": { + "ANN001": 59, + "ANN401": 3, + "PLR0913": 19, + "PLW0603": 1 + }, + "litellm/experimental_mcp_client/client.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/files/main.py": { + "ANN003": 10, + "ANN401": 1, + "PLR0913": 5 + }, + "litellm/fine_tuning/main.py": { + "ANN001": 7, + "ANN003": 8, + "ANN401": 1, + "B006": 2, + "PLR0913": 3 + }, + "litellm/google_genai/adapters/handler.py": { + "ANN003": 2, + "PLR0913": 1 + }, + "litellm/google_genai/adapters/transformation.py": { + "ANN003": 1, + "ANN401": 5, + "C901": 1 + }, + "litellm/google_genai/main.py": { + "ANN003": 5, + "ANN401": 3, + "PLR0913": 4 + }, + "litellm/google_genai/streaming_iterator.py": { + "ANN001": 2, + "PLR0913": 2 + }, + "litellm/images/main.py": { + "ANN001": 4, + "ANN002": 2, + "ANN003": 7, + "ANN401": 1, + "C901": 2, + "PLR0913": 4, + "PLW0603": 1 + }, + "litellm/images/utils.py": { + "ANN401": 1 + }, + "litellm/integrations/SlackAlerting/batching_handler.py": { + "ANN001": 3 + }, + "litellm/integrations/SlackAlerting/slack_alerting.py": { + "ANN001": 19, + "ANN003": 2, + "ANN401": 2, + "B006": 2, + "C901": 1, + "PLR0913": 4 + }, + "litellm/integrations/anthropic_cache_control_hook.py": { + "PLR0913": 4 + }, + "litellm/integrations/argilla.py": { + "ANN001": 17, + "ANN003": 1 + }, + "litellm/integrations/arize/_utils.py": { + "ANN001": 45, + "ANN002": 1, + "ANN003": 1, + "ANN401": 2, + "C901": 1, + "PLR0913": 1 + }, + "litellm/integrations/arize/arize.py": { + "ANN001": 4, + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/integrations/arize/arize_phoenix.py": { + "ANN001": 17, + "ANN401": 1 + }, + "litellm/integrations/arize/arize_phoenix_prompt_manager.py": { + "ANN003": 2, + "PLR0913": 4 + }, + "litellm/integrations/athina.py": { + "ANN001": 5 + }, + "litellm/integrations/azure_sentinel/azure_sentinel.py": { + "ANN001": 8, + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/integrations/azure_storage/azure_storage.py": { + "ANN001": 8, + "ANN003": 1 + }, + "litellm/integrations/bitbucket/bitbucket_prompt_manager.py": { + "ANN003": 2, + "ANN401": 2, + "PLR0913": 6 + }, + "litellm/integrations/braintrust_logging.py": { + "ANN001": 12, + "C901": 2 + }, + "litellm/integrations/braintrust_mock_client.py": { + "ANN001": 11, + "PLR0913": 1, + "PLW0603": 2 + }, + "litellm/integrations/cloudzero/cloudzero.py": { + "ANN001": 1, + "ANN003": 1 + }, + "litellm/integrations/cloudzero/cz_resource_names.py": { + "PLR0913": 1 + }, + "litellm/integrations/cloudzero/transform.py": { + "ANN001": 1 + }, + "litellm/integrations/compression_interception/handler.py": { + "ANN401": 7, + "PLR0913": 2 + }, + "litellm/integrations/custom_batch_logger.py": { + "ANN002": 1, + "ANN003": 2 + }, + "litellm/integrations/custom_guardrail.py": { + "ANN001": 2, + "ANN002": 3, + "ANN003": 4, + "ANN401": 1, + "C901": 1, + "PLR0913": 4 + }, + "litellm/integrations/custom_logger.py": { + "ANN001": 60, + "ANN003": 1, + "ANN401": 25, + "C901": 1, + "PLR0913": 10 + }, + "litellm/integrations/custom_prompt_management.py": { + "ANN003": 1, + "PLR0913": 3 + }, + "litellm/integrations/custom_secret_manager.py": { + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/integrations/datadog/datadog.py": { + "ANN001": 16, + "ANN003": 1, + "ANN401": 8, + "PLR0913": 2 + }, + "litellm/integrations/datadog/datadog_cost_management.py": { + "ANN001": 4, + "ANN003": 1, + "ANN401": 1 + }, + "litellm/integrations/datadog/datadog_llm_obs.py": { + "ANN001": 8, + "ANN003": 1 + }, + "litellm/integrations/datadog/datadog_metrics.py": { + "ANN001": 8, + "ANN003": 1 + }, + "litellm/integrations/deepeval/api.py": { + "ANN001": 9 + }, + "litellm/integrations/deepeval/deepeval.py": { + "ANN001": 41, + "ANN002": 1, + "ANN003": 1 + }, + "litellm/integrations/dotprompt/dotprompt_manager.py": { + "PLR0913": 4 + }, + "litellm/integrations/dynamodb.py": { + "ANN001": 10 + }, + "litellm/integrations/focus/focus_logger.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/integrations/focus/transformer.py": { + "ANN001": 2 + }, + "litellm/integrations/galileo.py": { + "ANN001": 4, + "ANN401": 18 + }, + "litellm/integrations/gcs_bucket/gcs_bucket.py": { + "ANN001": 8, + "ANN401": 1 + }, + "litellm/integrations/gcs_bucket/gcs_bucket_base.py": { + "ANN003": 3, + "B006": 1 + }, + "litellm/integrations/gcs_bucket/gcs_bucket_mock_client.py": { + "ANN001": 32, + "PLR0913": 2, + "PLW0603": 3 + }, + "litellm/integrations/gcs_pubsub/pub_sub.py": { + "ANN001": 4, + "ANN003": 1 + }, + "litellm/integrations/generic_api/generic_api_callback.py": { + "ANN001": 13, + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/integrations/generic_prompt_management/generic_prompt_manager.py": { + "ANN003": 1, + "PLR0913": 4 + }, + "litellm/integrations/gitlab/gitlab_prompt_manager.py": { + "ANN003": 2, + "ANN401": 2, + "PLR0913": 6 + }, + "litellm/integrations/greenscale.py": { + "ANN001": 5 + }, + "litellm/integrations/helicone.py": { + "ANN001": 10, + "PLR0913": 1, + "RUF012": 1 + }, + "litellm/integrations/humanloop.py": { + "PLR0913": 1 + }, + "litellm/integrations/lago.py": { + "ANN001": 9 + }, + "litellm/integrations/langfuse/langfuse.py": { + "ANN001": 29, + "ANN401": 3, + "C901": 1, + "PLR0913": 3 + }, + "litellm/integrations/langfuse/langfuse_otel.py": { + "ANN001": 6, + "ANN002": 3, + "ANN003": 3, + "C901": 1 + }, + "litellm/integrations/langfuse/langfuse_otel_attributes.py": { + "ANN001": 1 + }, + "litellm/integrations/langfuse/langfuse_prompt_management.py": { + "ANN001": 25, + "PLR0913": 4 + }, + "litellm/integrations/langsmith.py": { + "ANN001": 18, + "ANN003": 1 + }, + "litellm/integrations/langtrace.py": { + "ANN001": 7 + }, + "litellm/integrations/litellm_agent/litellm_agent_model_resolver.py": { + "PLR0913": 2 + }, + "litellm/integrations/literal_ai.py": { + "ANN001": 29, + "ANN003": 1 + }, + "litellm/integrations/logfire_logger.py": { + "ANN001": 11, + "PLR0913": 2 + }, + "litellm/integrations/lunary.py": { + "ANN001": 18, + "B006": 1, + "PLR0913": 1 + }, + "litellm/integrations/mlflow.py": { + "ANN001": 41 + }, + "litellm/integrations/mock_client_factory.py": { + "ANN001": 26, + "ANN003": 1, + "C901": 1, + "PLR0913": 2 + }, + "litellm/integrations/openmeter.py": { + "ANN001": 9 + }, + "litellm/integrations/opentelemetry.py": { + "ANN001": 62, + "ANN003": 1, + "ANN401": 14, + "C901": 1, + "PLR0913": 2 + }, + "litellm/integrations/opentelemetry_utils/base_otel_llm_obs_attributes.py": { + "ANN001": 2, + "ANN401": 1 + }, + "litellm/integrations/opentelemetry_utils/gen_ai_semconv.py": { + "ANN001": 3, + "ANN401": 1 + }, + "litellm/integrations/opik/opik.py": { + "ANN401": 3 + }, + "litellm/integrations/opik/opik_payload_builder/extractors.py": { + "ANN401": 1 + }, + "litellm/integrations/opik/opik_payload_builder/payload_builders.py": { + "ANN401": 4, + "PLR0913": 2 + }, + "litellm/integrations/opik/utils.py": { + "ANN001": 1 + }, + "litellm/integrations/otel/emitter.py": { + "PLR0913": 1 + }, + "litellm/integrations/otel/logger.py": { + "ANN001": 11, + "ANN401": 13, + "PLR0913": 2 + }, + "litellm/integrations/otel/mappers/genai.py": { + "RUF012": 5 + }, + "litellm/integrations/otel/mappers/langfuse.py": { + "RUF012": 4 + }, + "litellm/integrations/otel/mappers/langtrace.py": { + "RUF012": 2 + }, + "litellm/integrations/otel/mappers/legacy.py": { + "RUF012": 3 + }, + "litellm/integrations/otel/mappers/openinference.py": { + "RUF012": 4 + }, + "litellm/integrations/otel/mappers/weave.py": { + "RUF012": 2 + }, + "litellm/integrations/otel/model/config.py": { + "ANN401": 2 + }, + "litellm/integrations/otel/mount.py": { + "ANN401": 2 + }, + "litellm/integrations/otel/plumbing/routing.py": { + "ANN401": 1 + }, + "litellm/integrations/otel/presets/agentops.py": { + "ANN401": 3 + }, + "litellm/integrations/otel/presets/arize.py": { + "ANN001": 1 + }, + "litellm/integrations/otel/runtime.py": { + "ANN401": 2 + }, + "litellm/integrations/posthog.py": { + "ANN001": 16, + "ANN003": 1, + "ANN401": 3 + }, + "litellm/integrations/prometheus.py": { + "ANN001": 12, + "ANN002": 1, + "ANN003": 2, + "ANN401": 10, + "C901": 1, + "PLR0913": 7 + }, + "litellm/integrations/prometheus_helpers/__init__.py": { + "PLW0603": 1 + }, + "litellm/integrations/prometheus_helpers/bounded_prometheus_series_tracker.py": { + "ANN401": 3, + "PLR0913": 1 + }, + "litellm/integrations/prometheus_services.py": { + "ANN001": 5, + "ANN003": 1, + "B006": 1 + }, + "litellm/integrations/prompt_layer.py": { + "ANN001": 5 + }, + "litellm/integrations/prompt_management_base.py": { + "PLR0913": 7 + }, + "litellm/integrations/rubrik.py": { + "ANN001": 9, + "ANN003": 1, + "ANN401": 4 + }, + "litellm/integrations/s3.py": { + "ANN001": 21, + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/integrations/s3_v2.py": { + "ANN001": 14, + "ANN003": 1, + "PLR0913": 2 + }, + "litellm/integrations/sqs.py": { + "ANN001": 10, + "ANN003": 1, + "PLR0913": 2 + }, + "litellm/integrations/supabase.py": { + "ANN001": 13, + "PLR0913": 1 + }, + "litellm/integrations/traceloop.py": { + "ANN001": 8, + "PLR0913": 1 + }, + "litellm/integrations/vantage/vantage_logger.py": { + "ANN401": 1 + }, + "litellm/integrations/vector_store_integrations/vector_store_pre_call_hook.py": { + "ANN401": 6, + "PLR0913": 1 + }, + "litellm/integrations/weave/weave_otel.py": { + "ANN001": 15, + "ANN003": 1, + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/integrations/websearch_interception/handler.py": { + "ANN401": 24, + "PLR0913": 10 + }, + "litellm/integrations/websearch_interception/transformation.py": { + "ANN401": 3 + }, + "litellm/integrations/weights_biases.py": { + "ANN001": 5 + }, + "litellm/interactions/agents/http_handler.py": { + "PLR0913": 10 + }, + "litellm/interactions/agents/main.py": { + "ANN003": 10, + "PLR0913": 2 + }, + "litellm/interactions/http_handler.py": { + "ANN401": 1, + "PLR0913": 8 + }, + "litellm/interactions/litellm_responses_transformation/handler.py": { + "ANN003": 2 + }, + "litellm/interactions/litellm_responses_transformation/streaming_iterator.py": { + "PLR0913": 1 + }, + "litellm/interactions/litellm_responses_transformation/transformation.py": { + "ANN003": 1 + }, + "litellm/interactions/main.py": { + "ANN003": 8, + "PLR0913": 2 + }, + "litellm/interactions/streaming_iterator.py": { + "PLR0913": 3 + }, + "litellm/litellm_core_utils/asyncify.py": { + "ANN001": 1, + "ANN002": 1, + "ANN003": 1 + }, + "litellm/litellm_core_utils/audio_utils/utils.py": { + "C901": 3 + }, + "litellm/litellm_core_utils/cached_imports.py": { + "PLW0603": 6 + }, + "litellm/litellm_core_utils/core_helpers.py": { + "ANN001": 1, + "ANN401": 2 + }, + "litellm/litellm_core_utils/coroutine_checker.py": { + "ANN401": 1 + }, + "litellm/litellm_core_utils/custom_logger_registry.py": { + "RUF012": 1 + }, + "litellm/litellm_core_utils/dd_tracing.py": { + "ANN001": 4, + "ANN002": 1, + "ANN003": 3, + "ANN401": 1 + }, + "litellm/litellm_core_utils/dot_notation_indexing.py": { + "C901": 1 + }, + "litellm/litellm_core_utils/duration_parser.py": { + "ANN001": 2 + }, + "litellm/litellm_core_utils/exception_mapping_utils.py": { + "ANN001": 9, + "ANN401": 1, + "B006": 3, + "C901": 1 + }, + "litellm/litellm_core_utils/fallback_utils.py": { + "ANN003": 2 + }, + "litellm/litellm_core_utils/get_litellm_params.py": { + "ANN001": 25, + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/litellm_core_utils/get_llm_provider_logic.py": { + "C901": 2 + }, + "litellm/litellm_core_utils/get_supported_openai_params.py": { + "C901": 1 + }, + "litellm/litellm_core_utils/json_validation_rule.py": { + "ANN401": 2 + }, + "litellm/litellm_core_utils/litellm_logging.py": { + "ANN001": 55, + "ANN003": 5, + "ANN401": 28, + "B006": 4, + "C901": 7, + "PLR0913": 7, + "PLW0603": 27 + }, + "litellm/litellm_core_utils/llm_cost_calc/tool_call_cost_tracking.py": { + "ANN401": 6 + }, + "litellm/litellm_core_utils/llm_cost_calc/usage_object_transformation.py": { + "ANN401": 1 + }, + "litellm/litellm_core_utils/llm_cost_calc/utils.py": { + "ANN401": 1, + "C901": 1, + "PLR0913": 3 + }, + "litellm/litellm_core_utils/llm_request_utils.py": { + "ANN001": 1 + }, + "litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py": { + "ANN001": 4, + "C901": 1, + "PLR0913": 1 + }, + "litellm/litellm_core_utils/llm_response_utils/get_formatted_prompt.py": { + "C901": 1 + }, + "litellm/litellm_core_utils/llm_response_utils/response_metadata.py": { + "ANN401": 3, + "PLR0913": 1 + }, + "litellm/litellm_core_utils/logging_callback_manager.py": { + "ANN001": 6 + }, + "litellm/litellm_core_utils/logging_utils.py": { + "ANN001": 1, + "ANN002": 2, + "ANN003": 2, + "ANN401": 4, + "PLR0913": 1, + "PLW0603": 1 + }, + "litellm/litellm_core_utils/model_response_utils.py": { + "ANN401": 2 + }, + "litellm/litellm_core_utils/prompt_templates/common_utils.py": { + "ANN401": 6, + "B006": 2 + }, + "litellm/litellm_core_utils/prompt_templates/factory.py": { + "ANN001": 30, + "ANN401": 5, + "C901": 9, + "PLR0913": 1 + }, + "litellm/litellm_core_utils/realtime_streaming.py": { + "ANN001": 1, + "ANN401": 5, + "C901": 2, + "PLR0913": 1, + "RUF012": 3 + }, + "litellm/litellm_core_utils/redact_messages.py": { + "ANN001": 7, + "ANN401": 2, + "C901": 1 + }, + "litellm/litellm_core_utils/safe_json_dumps.py": { + "ANN401": 3 + }, + "litellm/litellm_core_utils/safe_json_loads.py": { + "ANN401": 2 + }, + "litellm/litellm_core_utils/specialty_caches/dynamic_logging_cache.py": { + "ANN401": 2 + }, + "litellm/litellm_core_utils/streaming_chunk_builder_utils.py": { + "ANN401": 2, + "C901": 1 + }, + "litellm/litellm_core_utils/streaming_handler.py": { + "ANN001": 27, + "ANN401": 5, + "C901": 3, + "PLR0913": 1 + }, + "litellm/litellm_core_utils/token_counter.py": { + "ANN001": 11, + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/litellm_core_utils/url_utils.py": { + "ANN401": 10 + }, + "litellm/llms/__init__.py": { + "PLW0603": 2 + }, + "litellm/llms/a2a/chat/guardrail_translation/handler.py": { + "ANN401": 3, + "C901": 1 + }, + "litellm/llms/a2a/chat/streaming_iterator.py": { + "ANN001": 1 + }, + "litellm/llms/a2a/chat/transformation.py": { + "ANN401": 3, + "PLR0913": 3 + }, + "litellm/llms/a2a/common_utils.py": { + "B006": 1 + }, + "litellm/llms/ai21/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/aiml/image_generation/cost_calculator.py": { + "ANN401": 1 + }, + "litellm/llms/aiml/image_generation/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/aiohttp_openai/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/amazon_nova/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/anthropic/batches/handler.py": { + "PLR0913": 2 + }, + "litellm/llms/anthropic/batches/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/anthropic/chat/guardrail_translation/handler.py": { + "ANN401": 11, + "PLR0913": 2 + }, + "litellm/llms/anthropic/chat/handler.py": { + "ANN001": 26, + "B006": 3, + "C901": 1, + "PLR0913": 5 + }, + "litellm/llms/anthropic/chat/transformation.py": { + "ANN401": 3, + "C901": 5, + "PLR0913": 4 + }, + "litellm/llms/anthropic/common_utils.py": { + "ANN001": 1, + "ANN401": 2, + "C901": 1, + "PLR0913": 4 + }, + "litellm/llms/anthropic/completion/transformation.py": { + "ANN001": 2, + "PLR0913": 3 + }, + "litellm/llms/anthropic/count_tokens/handler.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/anthropic/count_tokens/token_counter.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/anthropic/count_tokens/transformation.py": { + "ANN401": 1 + }, + "litellm/llms/anthropic/experimental_pass_through/adapters/handler.py": { + "ANN003": 2, + "ANN401": 11, + "C901": 1, + "PLR0913": 5 + }, + "litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py": { + "ANN401": 7, + "C901": 2, + "PLR0913": 1 + }, + "litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py": { + "ANN001": 2, + "ANN401": 5, + "C901": 2 + }, + "litellm/llms/anthropic/experimental_pass_through/context_management/dispatcher.py": { + "ANN401": 5, + "PLR0913": 1 + }, + "litellm/llms/anthropic/experimental_pass_through/context_management/editors/clear_tool_uses.py": { + "ANN401": 1 + }, + "litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py": { + "ANN401": 13, + "C901": 1, + "PLR0913": 2 + }, + "litellm/llms/anthropic/experimental_pass_through/context_management/placeholders.py": { + "ANN401": 1 + }, + "litellm/llms/anthropic/experimental_pass_through/messages/agentic_streaming_iterator.py": { + "ANN401": 3, + "PLR0913": 1 + }, + "litellm/llms/anthropic/experimental_pass_through/messages/handler.py": { + "ANN003": 3, + "PLR0913": 2 + }, + "litellm/llms/anthropic/experimental_pass_through/messages/interceptors/advisor.py": { + "ANN003": 2, + "ANN401": 6, + "PLR0913": 2 + }, + "litellm/llms/anthropic/experimental_pass_through/messages/interceptors/base.py": { + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/llms/anthropic/experimental_pass_through/messages/streaming_iterator.py": { + "ANN001": 1, + "ANN401": 1 + }, + "litellm/llms/anthropic/experimental_pass_through/messages/transformation.py": { + "ANN001": 1, + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/anthropic/experimental_pass_through/messages/utils.py": { + "ANN003": 1 + }, + "litellm/llms/anthropic/experimental_pass_through/responses_adapters/handler.py": { + "ANN003": 2, + "C901": 1, + "PLR0913": 3 + }, + "litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py": { + "ANN401": 2, + "C901": 1 + }, + "litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py": { + "C901": 3 + }, + "litellm/llms/anthropic/files/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/apiserpent/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/aws_polly/text_to_speech/transformation.py": { + "ANN401": 2, + "B006": 1, + "PLR0913": 2, + "RUF012": 3 + }, + "litellm/llms/azure/assistants.py": { + "ANN001": 3, + "PLR0913": 20 + }, + "litellm/llms/azure/audio_transcription/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/azure/audio_transcriptions.py": { + "ANN001": 3, + "ANN401": 2, + "PLR0913": 2 + }, + "litellm/llms/azure/azure.py": { + "ANN001": 16, + "ANN401": 3, + "B006": 4, + "PLR0913": 13 + }, + "litellm/llms/azure/batches/handler.py": { + "PLR0913": 4 + }, + "litellm/llms/azure/chat/gpt_transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/azure/chat/o_series_handler.py": { + "ANN001": 2, + "ANN401": 1, + "B006": 1, + "PLR0913": 1 + }, + "litellm/llms/azure/common_utils.py": { + "ANN001": 2, + "PLR0913": 4 + }, + "litellm/llms/azure/completion/handler.py": { + "ANN001": 13, + "ANN401": 4, + "B006": 3, + "PLR0913": 4 + }, + "litellm/llms/azure/completion/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/azure/files/handler.py": { + "PLR0913": 5 + }, + "litellm/llms/azure/fine_tuning/handler.py": { + "PLR0913": 4 + }, + "litellm/llms/azure/passthrough/transformation.py": { + "PLR0913": 3 + }, + "litellm/llms/azure/realtime/handler.py": { + "ANN401": 5, + "PLR0913": 1 + }, + "litellm/llms/azure/realtime/http_transformation.py": { + "ANN003": 2 + }, + "litellm/llms/azure/responses/transformation.py": { + "PLR0913": 1, + "RUF012": 1 + }, + "litellm/llms/azure/text_to_speech/transformation.py": { + "ANN401": 2, + "B006": 1, + "PLR0913": 2, + "RUF012": 2 + }, + "litellm/llms/azure_ai/agents/handler.py": { + "C901": 1, + "PLR0913": 6 + }, + "litellm/llms/azure_ai/agents/transformation.py": { + "ANN003": 1, + "ANN401": 3, + "PLR0913": 4 + }, + "litellm/llms/azure_ai/anthropic/count_tokens/handler.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/azure_ai/anthropic/count_tokens/token_counter.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/azure_ai/anthropic/handler.py": { + "ANN001": 7, + "B006": 1, + "PLR0913": 1 + }, + "litellm/llms/azure_ai/anthropic/messages_transformation.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/azure_ai/anthropic/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/azure_ai/azure_model_router/transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/azure_ai/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/azure_ai/common_utils.py": { + "PLR0913": 1 + }, + "litellm/llms/azure_ai/embed/handler.py": { + "ANN001": 8, + "PLR0913": 4 + }, + "litellm/llms/azure_ai/image_edit/flux2_transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/azure_ai/image_edit/mai_transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/azure_ai/image_generation/cost_calculator.py": { + "ANN401": 1 + }, + "litellm/llms/azure_ai/image_generation/mai_transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/azure_ai/ocr/document_intelligence/transformation.py": { + "ANN003": 5, + "ANN401": 3 + }, + "litellm/llms/azure_ai/ocr/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/azure_ai/rerank/transformation.py": { + "B006": 3, + "PLR0913": 1 + }, + "litellm/llms/azure_ai/vector_stores/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/base.py": { + "ANN001": 7, + "ANN002": 3, + "ANN003": 3, + "ANN401": 5, + "PLR0913": 2 + }, + "litellm/llms/base_llm/anthropic_messages/transformation.py": { + "PLR0913": 3 + }, + "litellm/llms/base_llm/audio_transcription/transformation.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/base_llm/base_model_iterator.py": { + "ANN001": 2 + }, + "litellm/llms/base_llm/base_utils.py": { + "ANN001": 1, + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/base_llm/batches/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/base_llm/bridges/completion_transformation.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/base_llm/chat/transformation.py": { + "ANN401": 4, + "PLR0913": 7 + }, + "litellm/llms/base_llm/completion/transformation.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/base_llm/containers/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/base_llm/embedding/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/base_llm/files/azure_blob_storage_backend.py": { + "ANN001": 1, + "ANN002": 2, + "ANN003": 3 + }, + "litellm/llms/base_llm/files/transformation.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/base_llm/google_genai/transformation.py": { + "ANN401": 1 + }, + "litellm/llms/base_llm/guardrail_translation/base_translation.py": { + "ANN401": 5 + }, + "litellm/llms/base_llm/guardrail_translation/utils.py": { + "ANN401": 2 + }, + "litellm/llms/base_llm/image_edit/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/base_llm/image_generation/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/base_llm/image_variations/transformation.py": { + "ANN401": 3, + "PLR0913": 5 + }, + "litellm/llms/base_llm/interactions/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/base_llm/managed_resources/base_managed_resource.py": { + "PLR0913": 1 + }, + "litellm/llms/base_llm/managed_resources/utils.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/base_llm/ocr/transformation.py": { + "ANN003": 6, + "RUF012": 4 + }, + "litellm/llms/base_llm/passthrough/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/base_llm/realtime/http_transformation.py": { + "ANN003": 2 + }, + "litellm/llms/base_llm/rerank/transformation.py": { + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/base_llm/responses/transformation.py": { + "PLR0913": 3 + }, + "litellm/llms/base_llm/search/transformation.py": { + "ANN003": 4, + "RUF012": 2 + }, + "litellm/llms/base_llm/text_to_speech/transformation.py": { + "B006": 1, + "PLR0913": 1 + }, + "litellm/llms/base_llm/vector_store/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/base_llm/videos/transformation.py": { + "ANN401": 1, + "PLR0913": 5 + }, + "litellm/llms/baseten/chat.py": { + "PLR0913": 1 + }, + "litellm/llms/bedrock/base_aws_llm.py": { + "ANN001": 2, + "ANN401": 1, + "PLR0913": 6 + }, + "litellm/llms/bedrock/batches/handler.py": { + "ANN001": 2, + "ANN003": 2, + "ANN401": 1 + }, + "litellm/llms/bedrock/batches/transformation.py": { + "ANN001": 4, + "ANN401": 3, + "PLR0913": 2 + }, + "litellm/llms/bedrock/chat/agentcore/transformation.py": { + "ANN003": 1, + "ANN401": 1, + "PLR0913": 6 + }, + "litellm/llms/bedrock/chat/converse_handler.py": { + "ANN001": 10, + "B006": 2, + "C901": 1, + "PLR0913": 4 + }, + "litellm/llms/bedrock/chat/converse_transformation.py": { + "ANN001": 1, + "C901": 3, + "PLR0913": 4 + }, + "litellm/llms/bedrock/chat/invoke_agent/transformation.py": { + "ANN001": 3, + "ANN003": 1, + "ANN401": 1, + "PLR0913": 4 + }, + "litellm/llms/bedrock/chat/invoke_handler.py": { + "ANN001": 26, + "B006": 2, + "C901": 2, + "PLR0913": 8 + }, + "litellm/llms/bedrock/chat/invoke_transformations/amazon_ai21_transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/bedrock/chat/invoke_transformations/amazon_deepseek_transformation.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/llms/bedrock/chat/invoke_transformations/amazon_moonshot_transformation.py": { + "ANN003": 1, + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/bedrock/chat/invoke_transformations/amazon_nova_transformation.py": { + "ANN003": 1, + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/bedrock/chat/invoke_transformations/amazon_openai_transformation.py": { + "ANN003": 1, + "PLR0913": 3 + }, + "litellm/llms/bedrock/chat/invoke_transformations/amazon_qwen2_transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/bedrock/chat/invoke_transformations/amazon_qwen3_transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/bedrock/chat/invoke_transformations/amazon_twelvelabs_pegasus_transformation.py": { + "ANN401": 3, + "PLR0913": 1 + }, + "litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude2_transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude3_transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py": { + "ANN001": 4, + "ANN003": 1, + "ANN401": 1, + "PLR0913": 6 + }, + "litellm/llms/bedrock/chat/mantle/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/bedrock/claude_platform/common_utils.py": { + "PLR0913": 2 + }, + "litellm/llms/bedrock/claude_platform/messages_transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/bedrock/claude_platform/transformation.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/llms/bedrock/common_utils.py": { + "ANN001": 5, + "ANN003": 1, + "ANN401": 1, + "C901": 2, + "PLR0913": 2, + "PLW0603": 2 + }, + "litellm/llms/bedrock/count_tokens/bedrock_token_counter.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/bedrock/count_tokens/transformation.py": { + "ANN401": 1 + }, + "litellm/llms/bedrock/embed/embedding.py": { + "ANN001": 3, + "ANN003": 1, + "ANN401": 4, + "C901": 1, + "PLR0913": 3 + }, + "litellm/llms/bedrock/files/transformation.py": { + "ANN001": 1, + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/bedrock/image_edit/amazon_nova_canvas_image_edit_transformation.py": { + "C901": 1, + "PLR0913": 2 + }, + "litellm/llms/bedrock/image_edit/handler.py": { + "PLR0913": 4 + }, + "litellm/llms/bedrock/image_edit/stability_transformation.py": { + "C901": 1, + "PLR0913": 1 + }, + "litellm/llms/bedrock/image_generation/image_handler.py": { + "PLR0913": 4 + }, + "litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py": { + "ANN003": 1, + "C901": 2, + "PLR0913": 4 + }, + "litellm/llms/bedrock/messages/mantle_transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/bedrock/passthrough/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/bedrock/realtime/handler.py": { + "ANN003": 1, + "ANN401": 5, + "PLR0913": 2 + }, + "litellm/llms/bedrock/rerank/handler.py": { + "PLR0913": 1 + }, + "litellm/llms/bedrock/vector_stores/transformation.py": { + "ANN001": 1, + "PLR0913": 1 + }, + "litellm/llms/bedrock_mantle/chat/transformation.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/llms/bedrock_mantle/responses/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/black_forest_labs/image_edit/handler.py": { + "ANN401": 1, + "PLR0913": 4 + }, + "litellm/llms/black_forest_labs/image_edit/transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/black_forest_labs/image_generation/handler.py": { + "ANN401": 1, + "PLR0913": 4 + }, + "litellm/llms/black_forest_labs/image_generation/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/brave/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/bytez/chat/transformation.py": { + "ANN401": 2, + "PLR0913": 5 + }, + "litellm/llms/cerebras/chat.py": { + "PLR0913": 1 + }, + "litellm/llms/chatgpt/chat/streaming_utils.py": { + "ANN401": 4 + }, + "litellm/llms/chatgpt/chat/transformation.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/llms/chatgpt/common_utils.py": { + "ANN001": 2, + "ANN401": 3, + "PLR0913": 1 + }, + "litellm/llms/chatgpt/responses/transformation.py": { + "ANN401": 5 + }, + "litellm/llms/clarifai/chat/transformation.py": { + "ANN001": 5, + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/cloudflare/chat/transformation.py": { + "ANN001": 2, + "PLR0913": 3 + }, + "litellm/llms/codestral/completion/handler.py": { + "ANN001": 24, + "ANN002": 1, + "ANN003": 1, + "B006": 3, + "PLR0913": 5 + }, + "litellm/llms/codestral/completion/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/cohere/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/cohere/chat/v2_transformation.py": { + "ANN401": 1, + "PLR0913": 4 + }, + "litellm/llms/cohere/common_utils.py": { + "ANN001": 4, + "PLR0913": 1 + }, + "litellm/llms/cohere/embed/handler.py": { + "ANN001": 3, + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/cohere/embed/transformation.py": { + "ANN401": 2, + "PLR0913": 4 + }, + "litellm/llms/cohere/embed/v1_transformation.py": { + "ANN401": 3, + "PLR0913": 1 + }, + "litellm/llms/cohere/rerank/guardrail_translation/handler.py": { + "ANN401": 5 + }, + "litellm/llms/cohere/rerank/transformation.py": { + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/cohere/rerank_v2/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/cometapi/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/cometapi/embed/transformation.py": { + "PLR0913": 3 + }, + "litellm/llms/cometapi/image_generation/cost_calculator.py": { + "ANN401": 1 + }, + "litellm/llms/cometapi/image_generation/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/compactifai/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/custom_httpx/aiohttp_handler.py": { + "ANN001": 4, + "ANN401": 2, + "B006": 1, + "PLR0913": 7 + }, + "litellm/llms/custom_httpx/aiohttp_transport.py": { + "PLR0913": 1 + }, + "litellm/llms/custom_httpx/container_handler.py": { + "ANN003": 3, + "ANN401": 4, + "PLR0913": 3 + }, + "litellm/llms/custom_httpx/http_handler.py": { + "ANN001": 4, + "ANN401": 10, + "PLR0913": 10, + "PLW0603": 1 + }, + "litellm/llms/custom_httpx/httpx_handler.py": { + "ANN001": 1 + }, + "litellm/llms/custom_httpx/llm_http_handler.py": { + "ANN001": 48, + "ANN401": 29, + "PLR0913": 151 + }, + "litellm/llms/custom_llm.py": { + "ANN001": 32, + "ANN401": 8, + "B006": 4, + "PLR0913": 10 + }, + "litellm/llms/dashscope/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/dashscope/embed/transformation.py": { + "PLR0913": 3 + }, + "litellm/llms/dashscope/image_generation/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/dashscope/rerank/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/databricks/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 4 + }, + "litellm/llms/databricks/common_utils.py": { + "ANN401": 2, + "PLR0913": 1, + "RUF012": 1 + }, + "litellm/llms/databricks/embed/handler.py": { + "ANN001": 3, + "PLR0913": 1 + }, + "litellm/llms/databricks/streaming_utils.py": { + "ANN001": 1 + }, + "litellm/llms/dataforseo/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/datarobot/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/deepgram/audio_transcription/transformation.py": { + "ANN001": 1, + "PLR0913": 2 + }, + "litellm/llms/deepinfra/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/deepinfra/rerank/transformation.py": { + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/deepseek/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/deepseek/messages/transformation.py": { + "ANN401": 2, + "PLR0913": 2 + }, + "litellm/llms/deprecated_providers/aleph_alpha.py": { + "ANN001": 9, + "PLR0913": 2 + }, + "litellm/llms/deprecated_providers/palm.py": { + "ANN001": 7, + "PLR0913": 2 + }, + "litellm/llms/docker_model_runner/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/duckduckgo/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/elevenlabs/audio_transcription/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/elevenlabs/text_to_speech/transformation.py": { + "PLR0913": 1, + "RUF012": 2 + }, + "litellm/llms/exa_ai/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/fal_ai/cost_calculator.py": { + "ANN401": 1 + }, + "litellm/llms/fal_ai/image_generation/bria_transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/fal_ai/image_generation/bytedance_transformation.py": { + "ANN401": 2, + "RUF012": 1 + }, + "litellm/llms/fal_ai/image_generation/flux_pro_v11_transformation.py": { + "ANN401": 2, + "RUF012": 1 + }, + "litellm/llms/fal_ai/image_generation/flux_pro_v11_ultra_transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/fal_ai/image_generation/flux_schnell_transformation.py": { + "ANN401": 2, + "RUF012": 1 + }, + "litellm/llms/fal_ai/image_generation/ideogram_v3_transformation.py": { + "ANN401": 3, + "PLR0913": 1, + "RUF012": 1 + }, + "litellm/llms/fal_ai/image_generation/imagen4_transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/fal_ai/image_generation/nano_banana_transformation.py": { + "PLR0913": 1, + "RUF012": 1 + }, + "litellm/llms/fal_ai/image_generation/recraft_v3_transformation.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/llms/fal_ai/image_generation/stable_diffusion_transformation.py": { + "ANN401": 2, + "PLR0913": 2 + }, + "litellm/llms/fal_ai/image_generation/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/featherless_ai/chat/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/firecrawl/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/fireworks_ai/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/fireworks_ai/common_utils.py": { + "PLR0913": 1 + }, + "litellm/llms/fireworks_ai/rerank/transformation.py": { + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/gemini/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/gemini/common_utils.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/gemini/count_tokens/handler.py": { + "ANN003": 1, + "ANN401": 3 + }, + "litellm/llms/gemini/files/transformation.py": { + "ANN001": 1, + "PLR0913": 2 + }, + "litellm/llms/gemini/google_genai/transformation.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/llms/gemini/image_edit/cost_calculator.py": { + "ANN401": 1 + }, + "litellm/llms/gemini/image_edit/transformation.py": { + "ANN401": 1, + "PLR0913": 1, + "RUF012": 1 + }, + "litellm/llms/gemini/image_generation/cost_calculator.py": { + "ANN401": 1 + }, + "litellm/llms/gemini/image_generation/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/gemini/interactions/transformation.py": { + "C901": 1, + "PLR0913": 1 + }, + "litellm/llms/gemini/realtime/transformation.py": { + "ANN401": 3, + "C901": 1 + }, + "litellm/llms/gemini/vector_stores/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/gemini/videos/transformation.py": { + "ANN001": 35, + "PLR0913": 5, + "RUF012": 1 + }, + "litellm/llms/gigachat/chat/streaming.py": { + "ANN401": 1 + }, + "litellm/llms/gigachat/chat/transformation.py": { + "ANN401": 1, + "C901": 2, + "PLR0913": 3 + }, + "litellm/llms/gigachat/embedding/transformation.py": { + "PLR0913": 3 + }, + "litellm/llms/github_copilot/chat/transformation.py": { + "ANN001": 1, + "ANN401": 2, + "PLR0913": 2 + }, + "litellm/llms/github_copilot/common_utils.py": { + "ANN001": 2, + "PLR0913": 1 + }, + "litellm/llms/github_copilot/embedding/transformation.py": { + "ANN401": 2, + "PLR0913": 3 + }, + "litellm/llms/github_copilot/responses/transformation.py": { + "ANN401": 1 + }, + "litellm/llms/google_pse/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/gradient_ai/chat/transformation.py": { + "PLR0913": 3 + }, + "litellm/llms/groq/chat/handler.py": { + "ANN001": 5, + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/llms/groq/chat/transformation.py": { + "ANN401": 2, + "PLR0913": 2 + }, + "litellm/llms/groq/stt/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/heroku/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/hosted_vllm/embedding/transformation.py": { + "PLR0913": 3 + }, + "litellm/llms/hosted_vllm/rerank/transformation.py": { + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/hosted_vllm/transcriptions/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/huggingface/chat/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/huggingface/common_utils.py": { + "ANN001": 2 + }, + "litellm/llms/huggingface/embedding/handler.py": { + "ANN001": 1, + "ANN401": 1, + "B006": 1, + "PLR0913": 2 + }, + "litellm/llms/huggingface/embedding/transformation.py": { + "ANN401": 2, + "C901": 2, + "PLR0913": 4, + "PLW0603": 2 + }, + "litellm/llms/huggingface/rerank/transformation.py": { + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/infinity/common_utils.py": { + "B006": 1 + }, + "litellm/llms/infinity/embedding/transformation.py": { + "B006": 3, + "PLR0913": 3 + }, + "litellm/llms/infinity/rerank/transformation.py": { + "B006": 3, + "PLR0913": 1 + }, + "litellm/llms/jina_ai/common_utils.py": { + "ANN001": 2 + }, + "litellm/llms/jina_ai/embedding/transformation.py": { + "PLR0913": 3 + }, + "litellm/llms/jina_ai/rerank/transformation.py": { + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/langflow/chat/transformation.py": { + "ANN003": 1, + "ANN401": 1, + "PLR0913": 4 + }, + "litellm/llms/langgraph/chat/sse_iterator.py": { + "ANN001": 3 + }, + "litellm/llms/langgraph/chat/transformation.py": { + "ANN003": 1, + "ANN401": 1, + "PLR0913": 5 + }, + "litellm/llms/lemonade/chat/transformation.py": { + "ANN401": 3, + "PLR0913": 2 + }, + "litellm/llms/linkup/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/litellm_proxy/image_generation/transformation.py": { + "ANN001": 1, + "PLR0913": 2 + }, + "litellm/llms/litellm_proxy/skills/code_execution.py": { + "ANN003": 1 + }, + "litellm/llms/litellm_proxy/skills/handler.py": { + "ANN001": 1, + "ANN401": 1 + }, + "litellm/llms/litellm_proxy/skills/sandbox_executor.py": { + "ANN401": 1 + }, + "litellm/llms/litellm_proxy/skills/transformation.py": { + "ANN003": 4, + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/manus/files/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/maritalk.py": { + "PLR0913": 1 + }, + "litellm/llms/milvus/vector_stores/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/minimax/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/minimax/messages/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/minimax/text_to_speech/transformation.py": { + "PLR0913": 1, + "RUF012": 2 + }, + "litellm/llms/mistral/audio_transcription/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/mistral/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/mistral/ocr/guardrail_translation/handler.py": { + "ANN401": 5 + }, + "litellm/llms/mistral/ocr/transformation.py": { + "ANN003": 4, + "ANN401": 1 + }, + "litellm/llms/moonshot/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/nlp_cloud/chat/handler.py": { + "ANN001": 7, + "B006": 1, + "PLR0913": 1 + }, + "litellm/llms/nlp_cloud/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/novita/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/nvidia_nim/rerank/transformation.py": { + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/nvidia_riva/audio_transcription/handler.py": { + "ANN001": 1, + "ANN401": 4, + "PLR0913": 3 + }, + "litellm/llms/nvidia_riva/audio_transcription/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/nvidia_riva/common_utils.py": { + "ANN401": 2 + }, + "litellm/llms/oci/chat/cohere.py": { + "ANN401": 1 + }, + "litellm/llms/oci/chat/transformation.py": { + "ANN401": 3, + "PLR0913": 6 + }, + "litellm/llms/oci/common_utils.py": { + "ANN401": 9, + "PLR0913": 1 + }, + "litellm/llms/oci/embed/transformation.py": { + "PLR0913": 4 + }, + "litellm/llms/ollama/chat/transformation.py": { + "C901": 2, + "PLR0913": 4 + }, + "litellm/llms/ollama/common_utils.py": { + "ANN001": 5, + "PLR0913": 1 + }, + "litellm/llms/ollama/completion/handler.py": { + "ANN401": 6, + "PLR0913": 3 + }, + "litellm/llms/ollama/completion/transformation.py": { + "ANN001": 1, + "ANN401": 1, + "PLR0913": 4 + }, + "litellm/llms/oobabooga/chat/oobabooga.py": { + "ANN001": 7, + "ANN401": 1, + "B006": 1, + "PLR0913": 2 + }, + "litellm/llms/oobabooga/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/openai/chat/gpt_5_transformation.py": { + "C901": 1 + }, + "litellm/llms/openai/chat/gpt_transformation.py": { + "ANN401": 2, + "PLR0913": 4 + }, + "litellm/llms/openai/chat/guardrail_translation/handler.py": { + "ANN401": 8, + "C901": 1, + "PLR0913": 2 + }, + "litellm/llms/openai/common_utils.py": { + "PLR0913": 1 + }, + "litellm/llms/openai/completion/guardrail_translation/handler.py": { + "ANN401": 5 + }, + "litellm/llms/openai/completion/handler.py": { + "ANN001": 13, + "PLR0913": 4 + }, + "litellm/llms/openai/completion/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/openai/containers/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/openai/embeddings/guardrail_translation/handler.py": { + "ANN401": 7 + }, + "litellm/llms/openai/fine_tuning/handler.py": { + "ANN401": 1, + "PLR0913": 5 + }, + "litellm/llms/openai/image_edit/dalle2_transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/openai/image_edit/transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/openai/image_generation/dall_e_2_transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/openai/image_generation/dall_e_3_transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/openai/image_generation/gpt_transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/openai/image_generation/guardrail_translation/handler.py": { + "ANN401": 5 + }, + "litellm/llms/openai/image_variations/handler.py": { + "ANN001": 2, + "PLR0913": 2 + }, + "litellm/llms/openai/image_variations/transformation.py": { + "ANN401": 2, + "PLR0913": 2 + }, + "litellm/llms/openai/openai.py": { + "ANN001": 28, + "ANN401": 7, + "B006": 1, + "C901": 1, + "PLR0913": 47 + }, + "litellm/llms/openai/realtime/handler.py": { + "ANN401": 5, + "PLR0913": 1 + }, + "litellm/llms/openai/realtime/http_transformation.py": { + "ANN003": 2 + }, + "litellm/llms/openai/responses/count_tokens/handler.py": { + "PLR0913": 1 + }, + "litellm/llms/openai/responses/count_tokens/token_counter.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/openai/responses/count_tokens/transformation.py": { + "C901": 1 + }, + "litellm/llms/openai/responses/guardrail_translation/handler.py": { + "ANN401": 10, + "C901": 2, + "PLR0913": 1 + }, + "litellm/llms/openai/responses/transformation.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/openai/speech/guardrail_translation/handler.py": { + "ANN401": 5 + }, + "litellm/llms/openai/transcriptions/guardrail_translation/handler.py": { + "ANN401": 5 + }, + "litellm/llms/openai/transcriptions/handler.py": { + "ANN001": 3, + "PLR0913": 2 + }, + "litellm/llms/openai/transcriptions/whisper_transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/openai/vector_stores/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/openai/videos/transformation.py": { + "ANN401": 8, + "PLR0913": 5 + }, + "litellm/llms/openai_like/chat/handler.py": { + "ANN001": 21, + "ANN003": 1, + "B006": 3, + "PLR0913": 5 + }, + "litellm/llms/openai_like/chat/transformation.py": { + "ANN001": 2, + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/openai_like/common_utils.py": { + "ANN001": 2, + "ANN003": 1 + }, + "litellm/llms/openai_like/dynamic_config.py": { + "C901": 1, + "PLR0913": 1 + }, + "litellm/llms/openai_like/embedding/handler.py": { + "ANN001": 5, + "ANN003": 1, + "PLR0913": 2 + }, + "litellm/llms/openai_like/json_loader.py": { + "RUF012": 1 + }, + "litellm/llms/openrouter/chat/transformation.py": { + "ANN401": 3, + "PLR0913": 1 + }, + "litellm/llms/openrouter/embedding/transformation.py": { + "ANN401": 2, + "PLR0913": 3 + }, + "litellm/llms/openrouter/image_edit/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/openrouter/image_generation/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/ovhcloud/audio_transcription/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/ovhcloud/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/ovhcloud/embedding/transformation.py": { + "PLR0913": 3 + }, + "litellm/llms/parallel_ai/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/pass_through/guardrail_translation/handler.py": { + "ANN401": 4 + }, + "litellm/llms/perplexity/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/perplexity/embedding/transformation.py": { + "ANN401": 1, + "B006": 4, + "PLR0913": 3 + }, + "litellm/llms/perplexity/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/petals/completion/handler.py": { + "ANN001": 5, + "PLR0913": 1 + }, + "litellm/llms/petals/completion/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/pg_vector/vector_stores/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/predibase/chat/handler.py": { + "ANN001": 20, + "ANN002": 1, + "ANN003": 1, + "B006": 3, + "PLR0913": 4 + }, + "litellm/llms/predibase/chat/transformation.py": { + "ANN401": 1, + "C901": 1, + "PLR0913": 4 + }, + "litellm/llms/ragflow/chat/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/ragflow/vector_stores/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/recraft/cost_calculator.py": { + "ANN401": 1 + }, + "litellm/llms/recraft/image_edit/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/recraft/image_generation/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/reducto/common.py": { + "ANN401": 1 + }, + "litellm/llms/reducto/ocr/transformation.py": { + "ANN003": 7, + "ANN401": 1 + }, + "litellm/llms/replicate/chat/handler.py": { + "ANN001": 20, + "B006": 2, + "PLR0913": 2 + }, + "litellm/llms/replicate/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 4 + }, + "litellm/llms/runwayml/cost_calculator.py": { + "ANN401": 1 + }, + "litellm/llms/runwayml/image_generation/transformation.py": { + "ANN401": 2, + "PLR0913": 4 + }, + "litellm/llms/runwayml/text_to_speech/transformation.py": { + "ANN401": 2, + "B006": 1, + "PLR0913": 2, + "RUF012": 1 + }, + "litellm/llms/runwayml/videos/transformation.py": { + "ANN001": 34, + "PLR0913": 5 + }, + "litellm/llms/s3_vectors/vector_stores/transformation.py": { + "ANN001": 1, + "PLR0913": 2 + }, + "litellm/llms/sagemaker/chat/handler.py": { + "ANN001": 5, + "B006": 2, + "PLR0913": 2 + }, + "litellm/llms/sagemaker/chat/transformation.py": { + "ANN003": 1, + "PLR0913": 5 + }, + "litellm/llms/sagemaker/common_utils.py": { + "ANN001": 1 + }, + "litellm/llms/sagemaker/completion/handler.py": { + "ANN001": 18, + "ANN401": 2, + "B006": 3, + "PLR0913": 5 + }, + "litellm/llms/sagemaker/completion/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/sagemaker/embedding/cohere_transformation.py": { + "ANN401": 1, + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/sagemaker/embedding/transformation.py": { + "ANN401": 1, + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/sambanova/chat.py": { + "PLR0913": 1 + }, + "litellm/llms/sambanova/common_utils.py": { + "ANN001": 3 + }, + "litellm/llms/sambanova/embedding/transformation.py": { + "PLR0913": 3 + }, + "litellm/llms/sap/chat/models.py": { + "ANN003": 2 + }, + "litellm/llms/sap/chat/transformation.py": { + "ANN001": 2, + "ANN401": 1, + "PLR0913": 4 + }, + "litellm/llms/sap/credentials.py": { + "ANN001": 3, + "ANN003": 2, + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/sap/embed/transformation.py": { + "ANN001": 4, + "ANN002": 1, + "ANN003": 1, + "PLR0913": 2 + }, + "litellm/llms/scaleway/audio_transcription/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/searchapi/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/searxng/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/serper/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/snowflake/chat/transformation.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/snowflake/embedding/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/snowflake/utils.py": { + "ANN001": 2, + "PLR0913": 1 + }, + "litellm/llms/soniox/audio_transcription/handler.py": { + "ANN401": 1, + "PLR0913": 10 + }, + "litellm/llms/soniox/audio_transcription/transformation.py": { + "C901": 1, + "PLR0913": 2 + }, + "litellm/llms/stability/image_edit/transformations.py": { + "PLR0913": 1 + }, + "litellm/llms/stability/image_generation/transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/tavily/search/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/together_ai/cost_calculator.py": { + "ANN001": 2 + }, + "litellm/llms/together_ai/rerank/handler.py": { + "PLR0913": 1 + }, + "litellm/llms/topaz/common_utils.py": { + "PLR0913": 1 + }, + "litellm/llms/topaz/image_variations/transformation.py": { + "ANN401": 2, + "PLR0913": 3 + }, + "litellm/llms/triton/completion/transformation.py": { + "ANN401": 4, + "PLR0913": 5 + }, + "litellm/llms/triton/embedding/transformation.py": { + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/vercel_ai_gateway/embedding/transformation.py": { + "ANN401": 2, + "PLR0913": 3 + }, + "litellm/llms/vertex_ai/agent_engine/sse_iterator.py": { + "ANN401": 1 + }, + "litellm/llms/vertex_ai/agent_engine/transformation.py": { + "ANN003": 1, + "ANN401": 1, + "PLR0913": 5 + }, + "litellm/llms/vertex_ai/aws_credentials_supplier.py": { + "ANN001": 4 + }, + "litellm/llms/vertex_ai/batches/handler.py": { + "ANN002": 1, + "ANN003": 1, + "ANN401": 2, + "PLR0913": 4 + }, + "litellm/llms/vertex_ai/common_utils.py": { + "ANN001": 13, + "ANN401": 2, + "C901": 2, + "PLR0913": 3 + }, + "litellm/llms/vertex_ai/context_caching/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py": { + "PLR0913": 5 + }, + "litellm/llms/vertex_ai/files/handler.py": { + "PLR0913": 4 + }, + "litellm/llms/vertex_ai/files/transformation.py": { + "ANN001": 1, + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/llms/vertex_ai/fine_tuning/handler.py": { + "B006": 3, + "PLR0913": 1 + }, + "litellm/llms/vertex_ai/gemini/transformation.py": { + "ANN401": 5, + "B006": 1, + "C901": 3, + "PLR0913": 4, + "PLW0603": 2 + }, + "litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py": { + "ANN001": 14, + "ANN401": 7, + "C901": 4, + "PLR0913": 10 + }, + "litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_handler.py": { + "ANN001": 8, + "ANN401": 2, + "B006": 1, + "PLR0913": 2 + }, + "litellm/llms/vertex_ai/google_genai/transformation.py": { + "ANN001": 1, + "ANN401": 3 + }, + "litellm/llms/vertex_ai/image_edit/cost_calculator.py": { + "ANN401": 1 + }, + "litellm/llms/vertex_ai/image_edit/vertex_gemini_transformation.py": { + "ANN401": 1, + "PLR0913": 1, + "RUF012": 1 + }, + "litellm/llms/vertex_ai/image_edit/vertex_imagen_transformation.py": { + "ANN401": 2, + "C901": 1, + "PLR0913": 1, + "RUF012": 1 + }, + "litellm/llms/vertex_ai/image_generation/image_generation_handler.py": { + "ANN001": 1, + "ANN401": 3, + "PLR0913": 2 + }, + "litellm/llms/vertex_ai/image_generation/vertex_gemini_transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/vertex_ai/image_generation/vertex_imagen_transformation.py": { + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/vertex_ai/multimodal_embeddings/embedding_handler.py": { + "ANN001": 8, + "B006": 2, + "PLR0913": 2 + }, + "litellm/llms/vertex_ai/multimodal_embeddings/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/vertex_ai/ocr/deepseek_transformation.py": { + "ANN003": 6 + }, + "litellm/llms/vertex_ai/ocr/transformation.py": { + "ANN003": 4 + }, + "litellm/llms/vertex_ai/rag_engine/ingestion.py": { + "ANN401": 3 + }, + "litellm/llms/vertex_ai/rerank/transformation.py": { + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py": { + "ANN001": 2, + "PLR0913": 1 + }, + "litellm/llms/vertex_ai/text_to_speech/transformation.py": { + "ANN401": 2, + "B006": 1, + "PLR0913": 2, + "RUF012": 2 + }, + "litellm/llms/vertex_ai/vector_stores/rag_api/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/vertex_ai/vector_stores/search_api/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/vertex_ai/vertex_ai_aws_wif.py": { + "ANN001": 3 + }, + "litellm/llms/vertex_ai/vertex_ai_non_gemini.py": { + "ANN001": 28, + "ANN003": 2, + "ANN401": 1, + "C901": 1, + "PLR0913": 3 + }, + "litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/transformation.py": { + "ANN001": 2, + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/llms/vertex_ai/vertex_ai_partner_models/llama3/transformation.py": { + "ANN003": 1, + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/llms/vertex_ai/vertex_ai_partner_models/main.py": { + "ANN001": 12, + "PLR0913": 2 + }, + "litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.py": { + "ANN001": 3, + "PLR0913": 2 + }, + "litellm/llms/vertex_ai/vertex_gemma_models/main.py": { + "ANN001": 7, + "PLR0913": 1 + }, + "litellm/llms/vertex_ai/vertex_gemma_models/transformation.py": { + "ANN001": 1, + "ANN401": 6, + "PLR0913": 3 + }, + "litellm/llms/vertex_ai/vertex_llm_base.py": { + "ANN001": 11, + "ANN401": 4, + "C901": 1, + "PLR0913": 4 + }, + "litellm/llms/vertex_ai/vertex_model_garden/main.py": { + "ANN001": 7, + "PLR0913": 1 + }, + "litellm/llms/vertex_ai/videos/transformation.py": { + "ANN001": 24, + "PLR0913": 5 + }, + "litellm/llms/vllm/common_utils.py": { + "PLR0913": 1 + }, + "litellm/llms/vllm/completion/handler.py": { + "ANN001": 9, + "B006": 2, + "PLR0913": 1, + "PLW0603": 1 + }, + "litellm/llms/vllm/passthrough/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/volcengine/chat/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/volcengine/embedding/transformation.py": { + "PLR0913": 3 + }, + "litellm/llms/volcengine/responses/transformation.py": { + "ANN401": 10, + "PLR0913": 1, + "RUF012": 1 + }, + "litellm/llms/voyage/embedding/transformation.py": { + "B006": 4, + "PLR0913": 3 + }, + "litellm/llms/voyage/embedding/transformation_contextual.py": { + "B006": 4, + "PLR0913": 3 + }, + "litellm/llms/voyage/rerank/transformation.py": { + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/watsonx/audio_transcription/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/watsonx/chat/handler.py": { + "ANN001": 4, + "ANN003": 1, + "B006": 1, + "PLR0913": 1 + }, + "litellm/llms/watsonx/chat/transformation.py": { + "ANN001": 1, + "PLR0913": 1 + }, + "litellm/llms/watsonx/common_utils.py": { + "ANN001": 3, + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/llms/watsonx/completion/transformation.py": { + "ANN003": 1, + "C901": 1, + "PLR0913": 3 + }, + "litellm/llms/watsonx/embed/transformation.py": { + "PLR0913": 2 + }, + "litellm/llms/watsonx/passthrough/transformation.py": { + "PLR0913": 1 + }, + "litellm/llms/watsonx/rerank/transformation.py": { + "B006": 3, + "PLR0913": 2 + }, + "litellm/llms/xai/chat/transformation.py": { + "ANN001": 2, + "ANN401": 1, + "PLR0913": 3 + }, + "litellm/llms/xai/common_utils.py": { + "PLR0913": 1 + }, + "litellm/llms/xai/oauth.py": { + "ANN401": 1 + }, + "litellm/llms/you_com/search/transformation.py": { + "ANN003": 4 + }, + "litellm/main.py": { + "ANN001": 38, + "ANN002": 9, + "ANN003": 24, + "ANN401": 6, + "B006": 5, + "C901": 6, + "PLR0913": 10, + "PLW0603": 2 + }, + "litellm/models/access_group.py": { + "RUF012": 5 + }, + "litellm/models/base.py": { + "ANN401": 1 + }, + "litellm/models/credentials.py": { + "ANN001": 1 + }, + "litellm/models/end_user.py": { + "ANN001": 1 + }, + "litellm/models/model.py": { + "ANN001": 1 + }, + "litellm/models/object_permission.py": { + "RUF012": 8 + }, + "litellm/models/organization.py": { + "RUF012": 2 + }, + "litellm/models/project.py": { + "RUF012": 1 + }, + "litellm/models/spend_logs.py": { + "RUF012": 2 + }, + "litellm/models/tag.py": { + "ANN001": 1, + "RUF012": 1 + }, + "litellm/models/team.py": { + "ANN001": 2, + "RUF012": 6 + }, + "litellm/models/user.py": { + "ANN001": 1, + "RUF012": 6 + }, + "litellm/models/verification_token.py": { + "RUF012": 9 + }, + "litellm/ocr/main.py": { + "ANN003": 2, + "PLR0913": 2 + }, + "litellm/passthrough/main.py": { + "ANN003": 2, + "ANN401": 4, + "PLR0913": 2 + }, + "litellm/proxy/_experimental/mcp_server/auth/litellm_auth_handler.py": { + "PLR0913": 1 + }, + "litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py": { + "ANN001": 4 + }, + "litellm/proxy/_experimental/mcp_server/byok_oauth_endpoints.py": { + "PLR0913": 4 + }, + "litellm/proxy/_experimental/mcp_server/db.py": { + "ANN401": 4, + "C901": 1, + "PLR0913": 1 + }, + "litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py": { + "ANN401": 1, + "C901": 1, + "PLR0913": 6 + }, + "litellm/proxy/_experimental/mcp_server/elicitation_handler.py": { + "ANN401": 5 + }, + "litellm/proxy/_experimental/mcp_server/guardrail_translation/handler.py": { + "ANN401": 4 + }, + "litellm/proxy/_experimental/mcp_server/mcp_debug.py": { + "PLR0913": 2 + }, + "litellm/proxy/_experimental/mcp_server/mcp_server_manager.py": { + "ANN001": 8, + "ANN401": 8, + "C901": 1, + "PLR0913": 8 + }, + "litellm/proxy/_experimental/mcp_server/oauth_utils.py": { + "ANN001": 2, + "ANN401": 1, + "PLW0603": 1 + }, + "litellm/proxy/_experimental/mcp_server/openapi_to_mcp_generator.py": { + "ANN401": 2, + "C901": 2 + }, + "litellm/proxy/_experimental/mcp_server/rest_endpoints.py": { + "ANN001": 11, + "PLR0913": 2 + }, + "litellm/proxy/_experimental/mcp_server/sampling_handler.py": { + "ANN401": 16, + "C901": 3, + "PLR0913": 1 + }, + "litellm/proxy/_experimental/mcp_server/semantic_tool_filter.py": { + "ANN001": 2 + }, + "litellm/proxy/_experimental/mcp_server/server.py": { + "ANN001": 4, + "ANN401": 5, + "C901": 3, + "PLR0913": 18, + "PLW0603": 10 + }, + "litellm/proxy/_experimental/mcp_server/toolset_db.py": { + "ANN001": 1 + }, + "litellm/proxy/_experimental/mcp_server/utils.py": { + "ANN401": 6 + }, + "litellm/proxy/_experimental/post_call_rules.py": { + "ANN001": 1 + }, + "litellm/proxy/_lazy_features.py": { + "ANN001": 1 + }, + "litellm/proxy/_lazy_openapi_snapshot.py": { + "ANN001": 1 + }, + "litellm/proxy/_logging.py": { + "ANN001": 1 + }, + "litellm/proxy/_types.py": { + "ANN001": 19, + "ANN003": 3, + "ANN401": 1, + "PLR0913": 1, + "RUF012": 46 + }, + "litellm/proxy/a2a/agent_card.py": { + "ANN401": 1 + }, + "litellm/proxy/agent_endpoints/a2a_endpoints.py": { + "ANN401": 12, + "C901": 1, + "PLR0913": 2 + }, + "litellm/proxy/agent_endpoints/a2a_routing.py": { + "ANN401": 1 + }, + "litellm/proxy/agent_endpoints/auth/agent_permission_handler.py": { + "ANN001": 1 + }, + "litellm/proxy/agent_endpoints/databricks_oauth.py": { + "ANN401": 1 + }, + "litellm/proxy/agent_endpoints/endpoints.py": { + "PLR0913": 1 + }, + "litellm/proxy/anthropic_endpoints/skills_endpoints.py": { + "PLR0913": 1 + }, + "litellm/proxy/auth/auth_checks.py": { + "ANN401": 4, + "C901": 2, + "PLR0913": 13 + }, + "litellm/proxy/auth/auth_exception_handler.py": { + "PLR0913": 1 + }, + "litellm/proxy/auth/auth_utils.py": { + "ANN001": 1, + "ANN401": 10, + "C901": 1 + }, + "litellm/proxy/auth/handle_jwt.py": { + "ANN401": 1, + "C901": 1, + "PLR0913": 9, + "RUF012": 1 + }, + "litellm/proxy/auth/ip_address_utils.py": { + "PLW0603": 1, + "RUF012": 1 + }, + "litellm/proxy/auth/litellm_license.py": { + "ANN001": 2 + }, + "litellm/proxy/auth/model_checks.py": { + "ANN001": 1, + "B006": 1, + "PLR0913": 1 + }, + "litellm/proxy/auth/rds_iam_token.py": { + "ANN001": 3, + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/proxy/auth/route_checks.py": { + "C901": 4 + }, + "litellm/proxy/auth/trusted_proxy_utils.py": { + "ANN401": 2 + }, + "litellm/proxy/auth/user_api_key_auth.py": { + "ANN001": 4, + "ANN401": 7, + "C901": 2, + "PLR0913": 9 + }, + "litellm/proxy/batches_endpoints/endpoints.py": { + "C901": 1, + "PLR0913": 1 + }, + "litellm/proxy/caching_routes.py": { + "ANN001": 1 + }, + "litellm/proxy/client/chat.py": { + "PLR0913": 2 + }, + "litellm/proxy/client/cli/commands/agents.py": { + "PLR0913": 1 + }, + "litellm/proxy/client/cli/commands/auth.py": { + "ANN001": 2, + "PLR0913": 1 + }, + "litellm/proxy/client/cli/commands/chat.py": { + "PLR0913": 1 + }, + "litellm/proxy/client/cli/commands/http.py": { + "PLR0913": 1 + }, + "litellm/proxy/client/cli/commands/keys.py": { + "PLR0913": 2 + }, + "litellm/proxy/client/cli/commands/models.py": { + "ANN001": 7 + }, + "litellm/proxy/client/cli/commands/users.py": { + "ANN001": 6, + "PLR0913": 1 + }, + "litellm/proxy/client/http_client.py": { + "ANN401": 2 + }, + "litellm/proxy/client/keys.py": { + "PLR0913": 3 + }, + "litellm/proxy/client/teams.py": { + "PLR0913": 1 + }, + "litellm/proxy/common_request_processing.py": { + "ANN001": 2, + "ANN003": 1, + "ANN401": 19, + "B006": 1, + "C901": 3, + "PLR0913": 6 + }, + "litellm/proxy/common_utils/cache_coordinator.py": { + "ANN401": 7 + }, + "litellm/proxy/common_utils/cache_pydantic_utils.py": { + "ANN401": 3 + }, + "litellm/proxy/common_utils/callback_utils.py": { + "ANN401": 11, + "C901": 1 + }, + "litellm/proxy/common_utils/custom_openapi_spec.py": { + "ANN001": 1, + "ANN401": 2, + "RUF012": 3 + }, + "litellm/proxy/common_utils/debug_utils.py": { + "ANN001": 5 + }, + "litellm/proxy/common_utils/expired_ui_session_key_cleanup_manager.py": { + "ANN001": 1 + }, + "litellm/proxy/common_utils/get_routes.py": { + "ANN401": 2 + }, + "litellm/proxy/common_utils/key_rotation_manager.py": { + "ANN001": 1 + }, + "litellm/proxy/common_utils/load_config_utils.py": { + "ANN001": 4 + }, + "litellm/proxy/common_utils/openapi_schema_compat.py": { + "ANN001": 3 + }, + "litellm/proxy/common_utils/performance_utils.py": { + "ANN001": 1, + "ANN002": 2, + "ANN003": 2, + "ANN401": 1, + "PLW0603": 4 + }, + "litellm/proxy/common_utils/proxy_rate_limit_error.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/proxy/common_utils/proxy_state.py": { + "ANN401": 2 + }, + "litellm/proxy/common_utils/reset_budget_job.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/proxy/common_utils/swagger_utils.py": { + "ANN001": 1 + }, + "litellm/proxy/common_utils/user_api_key_cache.py": { + "ANN001": 4, + "ANN003": 3, + "ANN401": 14 + }, + "litellm/proxy/container_endpoints/ownership.py": { + "ANN401": 11 + }, + "litellm/proxy/custom_prompt_management.py": { + "PLR0913": 1 + }, + "litellm/proxy/db/base_client.py": { + "ANN401": 2 + }, + "litellm/proxy/db/create_views.py": { + "C901": 1 + }, + "litellm/proxy/db/db_spend_update_writer.py": { + "ANN401": 4, + "C901": 3, + "PLR0913": 5 + }, + "litellm/proxy/db/db_transaction_queue/base_update_queue.py": { + "ANN001": 1 + }, + "litellm/proxy/db/db_transaction_queue/redis_update_buffer.py": { + "ANN401": 2, + "PLR0913": 2 + }, + "litellm/proxy/db/db_transaction_queue/spend_log_cleanup.py": { + "ANN001": 1 + }, + "litellm/proxy/db/db_transaction_queue/spend_logs_partition_manager.py": { + "ANN001": 4 + }, + "litellm/proxy/db/db_url_settings.py": { + "PLR0913": 1 + }, + "litellm/proxy/db/exception_handler.py": { + "ANN401": 3 + }, + "litellm/proxy/db/log_db_metrics.py": { + "ANN001": 1, + "ANN002": 1, + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/proxy/db/prisma_client.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/proxy/db/routing_prisma_wrapper.py": { + "ANN401": 10 + }, + "litellm/proxy/db/spend_counter_reseed.py": { + "PLR0913": 1 + }, + "litellm/proxy/db/spend_log_tool_index.py": { + "ANN401": 1 + }, + "litellm/proxy/db/tool_registry_writer.py": { + "ANN401": 1, + "PLW0603": 1 + }, + "litellm/proxy/fine_tuning_endpoints/endpoints.py": { + "ANN001": 1, + "PLR0913": 1, + "PLW0603": 1 + }, + "litellm/proxy/guardrails/_content_utils.py": { + "ANN401": 4, + "C901": 1 + }, + "litellm/proxy/guardrails/guardrail_endpoints.py": { + "ANN401": 15, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/aim/aim.py": { + "ANN001": 2, + "ANN003": 1, + "ANN401": 7 + }, + "litellm/proxy/guardrails/guardrail_hooks/akto/akto.py": { + "ANN001": 1, + "ANN401": 1, + "PLR0913": 1, + "RUF012": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/aporia_ai/aporia_ai.py": { + "ANN001": 1, + "ANN003": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/azure/base.py": { + "ANN401": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/azure/prompt_shield.py": { + "ANN003": 1, + "ANN401": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/azure/text_moderation.py": { + "ANN003": 1, + "ANN401": 5 + }, + "litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py": { + "ANN001": 3, + "ANN003": 1, + "ANN401": 5, + "C901": 2, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/block_code_execution/__init__.py": { + "ANN401": 2 + }, + "litellm/proxy/guardrails/guardrail_hooks/block_code_execution/block_code_execution.py": { + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/cato_networks/cato_networks.py": { + "ANN001": 1, + "ANN003": 1, + "ANN401": 14 + }, + "litellm/proxy/guardrails/guardrail_hooks/crowdstrike_aidr/crowdstrike_aidr.py": { + "ANN003": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/custom_code/custom_code_guardrail.py": { + "ANN401": 2 + }, + "litellm/proxy/guardrails/guardrail_hooks/custom_code/primitives.py": { + "ANN401": 9, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/custom_code/sandbox.py": { + "ANN401": 12 + }, + "litellm/proxy/guardrails/guardrail_hooks/custom_guardrail.py": { + "ANN001": 1, + "ANN003": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/dynamoai/dynamoai.py": { + "ANN001": 1, + "ANN003": 1, + "ANN401": 1, + "B006": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/enkryptai/enkryptai.py": { + "ANN001": 1, + "ANN003": 1, + "ANN401": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py": { + "ANN003": 1, + "ANN401": 3, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/grayswan/__init__.py": { + "ANN001": 3 + }, + "litellm/proxy/guardrails/guardrail_hooks/grayswan/grayswan.py": { + "ANN001": 2, + "ANN401": 2, + "PLR0913": 1, + "RUF012": 2 + }, + "litellm/proxy/guardrails/guardrail_hooks/guardrails_ai/guardrails_ai.py": { + "ANN001": 1, + "ANN003": 1, + "ANN401": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/hiddenlayer/hiddenlayer.py": { + "ANN001": 3, + "ANN401": 3, + "C901": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/ibm_guardrails/ibm_detector.py": { + "ANN001": 1, + "ANN003": 1, + "ANN401": 1, + "C901": 1, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/javelin/javelin.py": { + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py": { + "ANN003": 1, + "C901": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/lakera_ai_v2.py": { + "ANN001": 1, + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py": { + "ANN001": 1, + "ANN003": 1, + "ANN401": 4, + "C901": 1, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/competitor_intent/base.py": { + "C901": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py": { + "ANN003": 1, + "ANN401": 1, + "C901": 3, + "PLR0913": 4 + }, + "litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/guardrail_benchmarks/test_eval.py": { + "ANN001": 31 + }, + "litellm/proxy/guardrails/guardrail_hooks/llm_as_a_judge/__init__.py": { + "ANN401": 4, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/mcp_end_user_permission/mcp_end_user_permission.py": { + "ANN003": 1, + "ANN401": 2 + }, + "litellm/proxy/guardrails/guardrail_hooks/mcp_jwt_signer/__init__.py": { + "ANN001": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/mcp_jwt_signer/mcp_jwt_signer.py": { + "ANN401": 2, + "PLR0913": 1, + "PLW0603": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/mcp_security/mcp_security_guardrail.py": { + "ANN003": 1, + "ANN401": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/microsoft_purview/base.py": { + "ANN401": 6 + }, + "litellm/proxy/guardrails/guardrail_hooks/microsoft_purview/purview_dlp.py": { + "ANN401": 10, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/model_armor/model_armor.py": { + "ANN001": 1, + "ANN003": 1, + "ANN401": 3, + "C901": 1, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/noma/noma.py": { + "ANN001": 1, + "ANN003": 1, + "ANN401": 2, + "PLR0913": 1, + "PLW0603": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/noma/noma_v2.py": { + "ANN401": 5 + }, + "litellm/proxy/guardrails/guardrail_hooks/onyx/onyx.py": { + "ANN003": 1, + "ANN401": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/openai/__init__.py": { + "ANN001": 3 + }, + "litellm/proxy/guardrails/guardrail_hooks/openai/moderations.py": { + "ANN003": 1, + "PLR0913": 3 + }, + "litellm/proxy/guardrails/guardrail_hooks/pangea/pangea.py": { + "ANN001": 1, + "ANN003": 1, + "ANN401": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/panw_prisma_airs/panw_prisma_airs.py": { + "ANN001": 3, + "ANN003": 1, + "ANN401": 5, + "C901": 3, + "PLR0913": 2, + "RUF012": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/pillar/__init__.py": { + "ANN001": 3 + }, + "litellm/proxy/guardrails/guardrail_hooks/pillar/pillar.py": { + "ANN003": 1, + "ANN401": 2, + "PLR0913": 1, + "RUF012": 2 + }, + "litellm/proxy/guardrails/guardrail_hooks/presidio.py": { + "ANN001": 1, + "ANN003": 1, + "ANN401": 11, + "C901": 2, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/prompt_security/prompt_security.py": { + "ANN003": 1, + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/promptguard/promptguard.py": { + "ANN401": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/qohash/qohash.py": { + "ANN003": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/qualifire/qualifire.py": { + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/semantic_guard/semantic_guard.py": { + "ANN001": 1, + "ANN003": 1, + "ANN401": 4, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/tool_permission.py": { + "ANN003": 1, + "ANN401": 7 + }, + "litellm/proxy/guardrails/guardrail_hooks/tool_policy/tool_policy_guardrail.py": { + "ANN401": 1, + "C901": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py": { + "ANN001": 1, + "ANN003": 1, + "ANN401": 3, + "C901": 1, + "PLW0603": 4 + }, + "litellm/proxy/guardrails/guardrail_hooks/vigil_guard/vigil_guard.py": { + "ANN401": 7 + }, + "litellm/proxy/guardrails/guardrail_hooks/xecguard/xecguard.py": { + "ANN401": 9, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_hooks/zscaler_ai_guard/zscaler_ai_guard.py": { + "ANN001": 12, + "ANN003": 3, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/guardrail_initializers.py": { + "ANN001": 2, + "ANN003": 1 + }, + "litellm/proxy/guardrails/usage_endpoints.py": { + "ANN401": 10, + "PLR0913": 1 + }, + "litellm/proxy/guardrails/usage_tracking.py": { + "C901": 1 + }, + "litellm/proxy/health_check.py": { + "ANN001": 2, + "PLR0913": 1 + }, + "litellm/proxy/health_endpoints/_health_endpoints.py": { + "ANN001": 16, + "ANN003": 1, + "C901": 1, + "PLR0913": 3, + "PLW0603": 4 + }, + "litellm/proxy/hooks/azure_content_safety.py": { + "ANN001": 6 + }, + "litellm/proxy/hooks/batch_rate_limiter.py": { + "ANN401": 2 + }, + "litellm/proxy/hooks/batch_redis_get.py": { + "ANN001": 1, + "ANN002": 1, + "ANN003": 1 + }, + "litellm/proxy/hooks/dynamic_rate_limiter.py": { + "ANN001": 1, + "C901": 1 + }, + "litellm/proxy/hooks/dynamic_rate_limiter_v3.py": { + "ANN001": 5, + "PLR0913": 1 + }, + "litellm/proxy/hooks/key_management_event_hooks.py": { + "ANN401": 2 + }, + "litellm/proxy/hooks/litellm_skills/main.py": { + "ANN003": 1, + "ANN401": 13 + }, + "litellm/proxy/hooks/max_budget_per_session_limiter.py": { + "ANN001": 4 + }, + "litellm/proxy/hooks/mcp_semantic_filter/hook.py": { + "ANN401": 1 + }, + "litellm/proxy/hooks/model_max_budget_limiter.py": { + "ANN001": 4 + }, + "litellm/proxy/hooks/parallel_request_limiter.py": { + "ANN001": 10, + "C901": 1, + "PLR0913": 2 + }, + "litellm/proxy/hooks/parallel_request_limiter_v3.py": { + "ANN001": 9, + "ANN401": 17, + "PLR0913": 1 + }, + "litellm/proxy/hooks/prompt_injection_detection.py": { + "ANN001": 1 + }, + "litellm/proxy/hooks/proxy_track_cost_callback.py": { + "ANN001": 7, + "ANN401": 6, + "C901": 1, + "PLR0913": 1 + }, + "litellm/proxy/hooks/responses_id_security.py": { + "ANN401": 2 + }, + "litellm/proxy/hooks/user_management_event_hooks.py": { + "PLR0913": 1 + }, + "litellm/proxy/image_endpoints/endpoints.py": { + "PLR0913": 1 + }, + "litellm/proxy/litellm_pre_call_utils.py": { + "ANN001": 2, + "ANN401": 4, + "C901": 2, + "PLR0913": 1, + "PLW0603": 1 + }, + "litellm/proxy/management_endpoints/access_group_endpoints.py": { + "ANN001": 15 + }, + "litellm/proxy/management_endpoints/cache_settings_endpoints.py": { + "ANN001": 2 + }, + "litellm/proxy/management_endpoints/common_daily_activity.py": { + "ANN401": 3, + "C901": 2, + "PLR0913": 5 + }, + "litellm/proxy/management_endpoints/common_utils.py": { + "ANN001": 1, + "ANN401": 3, + "PLR0913": 1 + }, + "litellm/proxy/management_endpoints/config_override_endpoints.py": { + "ANN401": 2 + }, + "litellm/proxy/management_endpoints/cost_tracking_settings.py": { + "ANN001": 5, + "C901": 1 + }, + "litellm/proxy/management_endpoints/customer_endpoints.py": { + "ANN001": 1, + "C901": 1, + "PLR0913": 1 + }, + "litellm/proxy/management_endpoints/internal_user_endpoints.py": { + "ANN001": 2, + "ANN401": 15, + "C901": 2, + "PLR0913": 5 + }, + "litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py": { + "ANN001": 1 + }, + "litellm/proxy/management_endpoints/key_management_endpoints.py": { + "ANN401": 13, + "B006": 7, + "C901": 6, + "PLR0913": 9 + }, + "litellm/proxy/management_endpoints/mcp_management_endpoints.py": { + "ANN001": 1, + "ANN401": 3, + "C901": 1, + "PLR0913": 2, + "PLW0603": 1 + }, + "litellm/proxy/management_endpoints/model_access_group_management_endpoints.py": { + "ANN001": 1 + }, + "litellm/proxy/management_endpoints/model_management_endpoints.py": { + "ANN002": 1, + "ANN003": 1, + "ANN401": 4, + "C901": 1, + "PLR0913": 1 + }, + "litellm/proxy/management_endpoints/organization_endpoints.py": { + "PLR0913": 1 + }, + "litellm/proxy/management_endpoints/policy_endpoints/endpoints.py": { + "ANN401": 3, + "PLR0913": 1 + }, + "litellm/proxy/management_endpoints/scim/scim_v2.py": { + "ANN001": 4, + "ANN401": 9, + "C901": 2 + }, + "litellm/proxy/management_endpoints/sso/custom_microsoft_sso.py": { + "PLR0913": 1 + }, + "litellm/proxy/management_endpoints/tag_management_endpoints.py": { + "ANN001": 4, + "PLR0913": 1 + }, + "litellm/proxy/management_endpoints/team_callback_endpoints.py": { + "ANN401": 4 + }, + "litellm/proxy/management_endpoints/team_endpoints.py": { + "ANN001": 5, + "ANN401": 23, + "C901": 7, + "PLR0913": 8 + }, + "litellm/proxy/management_endpoints/tool_management_endpoints.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/proxy/management_endpoints/types.py": { + "ANN001": 1 + }, + "litellm/proxy/management_endpoints/ui_sso.py": { + "ANN001": 5, + "ANN401": 22, + "C901": 2, + "PLR0913": 7 + }, + "litellm/proxy/management_endpoints/usage_endpoints/ai_usage_chat.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/proxy/management_endpoints/workflow_management_endpoints.py": { + "ANN401": 4 + }, + "litellm/proxy/management_helpers/audit_logs.py": { + "PLR0913": 1 + }, + "litellm/proxy/management_helpers/object_permission_utils.py": { + "ANN401": 1 + }, + "litellm/proxy/management_helpers/utils.py": { + "ANN001": 6, + "ANN002": 1, + "ANN003": 1, + "ANN401": 5, + "PLR0913": 2 + }, + "litellm/proxy/memory/memory_endpoints.py": { + "ANN401": 8 + }, + "litellm/proxy/middleware/in_flight_requests_middleware.py": { + "ANN401": 1 + }, + "litellm/proxy/openai_evals_endpoints/endpoints.py": { + "PLR0913": 5 + }, + "litellm/proxy/openai_files_endpoints/common_utils.py": { + "ANN001": 24, + "PLR0913": 2 + }, + "litellm/proxy/openai_files_endpoints/file_content_streaming_handler.py": { + "PLR0913": 2 + }, + "litellm/proxy/openai_files_endpoints/files_endpoints.py": { + "ANN001": 1, + "C901": 1, + "PLR0913": 3, + "PLW0603": 1 + }, + "litellm/proxy/openai_files_endpoints/storage_backend_service.py": { + "PLR0913": 2 + }, + "litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py": { + "ANN001": 3, + "ANN401": 4, + "PLR0913": 5 + }, + "litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py": { + "ANN003": 3, + "C901": 1, + "PLR0913": 4 + }, + "litellm/proxy/pass_through_endpoints/llm_provider_handlers/assembly_passthrough_logging_handler.py": { + "ANN003": 2, + "PLR0913": 2 + }, + "litellm/proxy/pass_through_endpoints/llm_provider_handlers/base_passthrough_logging_handler.py": { + "ANN003": 1, + "PLR0913": 3 + }, + "litellm/proxy/pass_through_endpoints/llm_provider_handlers/cohere_passthrough_logging_handler.py": { + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/proxy/pass_through_endpoints/llm_provider_handlers/cursor_passthrough_logging_handler.py": { + "ANN003": 1, + "PLR0913": 1 + }, + "litellm/proxy/pass_through_endpoints/llm_provider_handlers/gemini_passthrough_logging_handler.py": { + "ANN003": 1, + "PLR0913": 3 + }, + "litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.py": { + "ANN003": 1, + "PLR0913": 2 + }, + "litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_ai_live_passthrough_logging_handler.py": { + "ANN001": 1, + "ANN002": 1, + "ANN003": 2, + "C901": 1, + "PLR0913": 1 + }, + "litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py": { + "ANN003": 3, + "PLR0913": 4 + }, + "litellm/proxy/pass_through_endpoints/managed_id_rewriter.py": { + "ANN401": 25, + "PLR0913": 4 + }, + "litellm/proxy/pass_through_endpoints/pass_through_endpoints.py": { + "ANN001": 2, + "ANN003": 1, + "ANN401": 1, + "C901": 3, + "PLR0913": 8 + }, + "litellm/proxy/pass_through_endpoints/streaming_handler.py": { + "PLR0913": 3 + }, + "litellm/proxy/pass_through_endpoints/success_handler.py": { + "ANN003": 3, + "PLR0913": 3 + }, + "litellm/proxy/policy_engine/attachment_registry.py": { + "PLW0603": 1 + }, + "litellm/proxy/policy_engine/pipeline_executor.py": { + "ANN401": 2, + "PLR0913": 1 + }, + "litellm/proxy/policy_engine/policy_registry.py": { + "ANN401": 1, + "PLW0603": 1 + }, + "litellm/proxy/post_call_rules.py": { + "ANN001": 1 + }, + "litellm/proxy/prompts/prompt_endpoints.py": { + "ANN001": 2, + "ANN401": 1 + }, + "litellm/proxy/proxy_cli.py": { + "ANN001": 50, + "C901": 1, + "PLR0913": 5 + }, + "litellm/proxy/proxy_server.py": { + "ANN001": 46, + "ANN002": 1, + "ANN003": 2, + "ANN401": 16, + "B006": 1, + "C901": 15, + "PLR0913": 10, + "PLW0603": 70, + "RUF012": 1 + }, + "litellm/proxy/public_endpoints/public_endpoints.py": { + "PLW0603": 1 + }, + "litellm/proxy/rag_endpoints/endpoints.py": { + "ANN001": 1, + "ANN401": 5, + "PLR0913": 1 + }, + "litellm/proxy/response_api_endpoints/endpoints.py": { + "ANN001": 4, + "ANN401": 2 + }, + "litellm/proxy/response_polling/background_streaming.py": { + "ANN001": 10, + "C901": 1, + "PLR0913": 1 + }, + "litellm/proxy/response_polling/polling_handler.py": { + "ANN001": 3, + "ANN401": 1, + "C901": 1, + "PLR0913": 2 + }, + "litellm/proxy/route_llm_request.py": { + "ANN401": 1, + "C901": 1, + "PLW0603": 1 + }, + "litellm/proxy/search_endpoints/search_tool_registry.py": { + "ANN001": 1 + }, + "litellm/proxy/spend_tracking/budget_reservation.py": { + "ANN401": 11, + "PLR0913": 2 + }, + "litellm/proxy/spend_tracking/spend_log_error_logger.py": { + "ANN401": 1 + }, + "litellm/proxy/spend_tracking/spend_management_endpoints.py": { + "ANN001": 6, + "C901": 3, + "PLR0913": 4 + }, + "litellm/proxy/spend_tracking/spend_tracking_utils.py": { + "ANN001": 4, + "ANN401": 6, + "C901": 1, + "PLR0913": 1 + }, + "litellm/proxy/types_utils/utils.py": { + "ANN401": 2 + }, + "litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py": { + "ANN401": 2, + "PLW0603": 2 + }, + "litellm/proxy/utils.py": { + "ANN001": 27, + "ANN002": 1, + "ANN003": 6, + "ANN401": 29, + "B006": 1, + "C901": 3, + "PLR0913": 8, + "RUF012": 1 + }, + "litellm/proxy/vector_store_endpoints/endpoints.py": { + "PLR0913": 1 + }, + "litellm/proxy/vector_store_endpoints/management_endpoints.py": { + "ANN001": 5, + "ANN401": 3, + "C901": 1, + "PLR0913": 1, + "PLW0603": 1 + }, + "litellm/proxy/vector_store_files_endpoints/endpoints.py": { + "ANN001": 1, + "C901": 1 + }, + "litellm/proxy/video_endpoints/utils.py": { + "ANN401": 3 + }, + "litellm/proxy_auth/credentials.py": { + "ANN401": 1 + }, + "litellm/rag/__init__.py": { + "ANN002": 2, + "ANN003": 2 + }, + "litellm/rag/ingestion/bedrock_ingestion.py": { + "ANN401": 2 + }, + "litellm/rag/ingestion/gemini_ingestion.py": { + "PLR0913": 2 + }, + "litellm/rag/ingestion/s3_vectors_ingestion.py": { + "ANN401": 1 + }, + "litellm/rag/main.py": { + "ANN003": 5, + "PLR0913": 2 + }, + "litellm/rag/rag_query.py": { + "ANN401": 4 + }, + "litellm/realtime_api/main.py": { + "ANN003": 3, + "ANN401": 2, + "PLR0913": 2 + }, + "litellm/repositories/base_repository.py": { + "ANN401": 5 + }, + "litellm/repositories/budget_repository.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/repositories/config_repository.py": { + "ANN401": 6, + "RUF012": 1 + }, + "litellm/repositories/credentials_repository.py": { + "ANN401": 8 + }, + "litellm/repositories/model_repository.py": { + "ANN401": 3, + "PLR0913": 2 + }, + "litellm/repositories/object_permission_repository.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/repositories/organization_repository.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/repositories/project_repository.py": { + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/repositories/table_repositories.py": { + "ANN401": 3 + }, + "litellm/repositories/team_repository.py": { + "ANN401": 3, + "C901": 2, + "PLR0913": 2 + }, + "litellm/repositories/user_repository.py": { + "ANN401": 2, + "C901": 2, + "PLR0913": 2 + }, + "litellm/repositories/verification_token_repository.py": { + "ANN401": 3, + "C901": 1, + "PLR0913": 3 + }, + "litellm/rerank_api/main.py": { + "ANN003": 2, + "C901": 1, + "PLR0913": 2 + }, + "litellm/rerank_api/rerank_utils.py": { + "PLR0913": 1 + }, + "litellm/responses/file_search/emulated_handler.py": { + "ANN001": 3, + "ANN003": 1, + "ANN401": 10 + }, + "litellm/responses/litellm_completion_transformation/handler.py": { + "ANN003": 2, + "PLR0913": 1 + }, + "litellm/responses/litellm_completion_transformation/streaming_iterator.py": { + "ANN001": 1, + "C901": 1, + "PLR0913": 1 + }, + "litellm/responses/litellm_completion_transformation/transformation.py": { + "ANN003": 1, + "ANN401": 18, + "C901": 3, + "PLR0913": 1 + }, + "litellm/responses/main.py": { + "ANN003": 14, + "ANN401": 6, + "PLR0913": 16 + }, + "litellm/responses/mcp/chat_completions_handler.py": { + "ANN001": 17, + "ANN401": 1, + "C901": 1, + "PLR0913": 1 + }, + "litellm/responses/mcp/litellm_proxy_mcp_handler.py": { + "ANN001": 1, + "ANN003": 2, + "ANN401": 14, + "C901": 2, + "PLR0913": 2 + }, + "litellm/responses/mcp/mcp_streaming_iterator.py": { + "ANN401": 3, + "PLR0913": 2 + }, + "litellm/responses/streaming_iterator.py": { + "ANN001": 5, + "ANN401": 26, + "C901": 1, + "PLR0913": 7 + }, + "litellm/responses/utils.py": { + "ANN401": 9, + "C901": 1 + }, + "litellm/router.py": { + "ANN001": 20, + "ANN002": 4, + "ANN003": 69, + "ANN401": 17, + "B006": 7, + "C901": 14, + "PLR0913": 8, + "RUF012": 2 + }, + "litellm/router_strategy/adaptive_router/adaptive_router.py": { + "ANN401": 1 + }, + "litellm/router_strategy/adaptive_router/hooks.py": { + "ANN001": 8, + "ANN401": 4 + }, + "litellm/router_strategy/adaptive_router/update_queue.py": { + "ANN401": 2 + }, + "litellm/router_strategy/auto_router/auto_router.py": { + "PLR0913": 1 + }, + "litellm/router_strategy/auto_router/litellm_encoder.py": { + "ANN003": 7 + }, + "litellm/router_strategy/budget_limiter.py": { + "ANN001": 4, + "ANN401": 4, + "PLR0913": 1 + }, + "litellm/router_strategy/complexity_router/complexity_router.py": { + "PLR0913": 1 + }, + "litellm/router_strategy/least_busy.py": { + "ANN001": 19 + }, + "litellm/router_strategy/lowest_cost.py": { + "ANN001": 8, + "B006": 1, + "C901": 1 + }, + "litellm/router_strategy/lowest_latency.py": { + "ANN001": 12, + "B006": 1, + "C901": 3, + "PLR0913": 1 + }, + "litellm/router_strategy/lowest_tpm_rpm.py": { + "ANN001": 8, + "B006": 1, + "C901": 1 + }, + "litellm/router_strategy/lowest_tpm_rpm_v2.py": { + "ANN001": 8, + "B006": 1, + "C901": 1, + "PLR0913": 1 + }, + "litellm/router_strategy/quality_router/quality_router.py": { + "ANN401": 3 + }, + "litellm/router_strategy/tag_based_routing.py": { + "ANN401": 1 + }, + "litellm/router_utils/add_retry_fallback_headers.py": { + "ANN401": 6 + }, + "litellm/router_utils/cooldown_cache.py": { + "ANN001": 2 + }, + "litellm/router_utils/cooldown_handlers.py": { + "ANN401": 4 + }, + "litellm/router_utils/fallback_event_handlers.py": { + "ANN003": 1, + "ANN401": 1, + "PLR0913": 1 + }, + "litellm/router_utils/handle_error.py": { + "ANN001": 1 + }, + "litellm/router_utils/health_state_cache.py": { + "ANN401": 1 + }, + "litellm/router_utils/pre_call_checks/deployment_affinity_check.py": { + "C901": 2, + "PLR0913": 1 + }, + "litellm/router_utils/pre_call_checks/encrypted_content_affinity_check.py": { + "ANN401": 3 + }, + "litellm/router_utils/pre_call_checks/model_rate_limit_check.py": { + "ANN001": 8 + }, + "litellm/router_utils/pre_call_checks/prompt_caching_deployment_check.py": { + "ANN001": 4 + }, + "litellm/router_utils/prompt_caching_cache.py": { + "ANN401": 2 + }, + "litellm/router_utils/search_api_router.py": { + "ANN003": 2, + "ANN401": 4 + }, + "litellm/search/main.py": { + "ANN003": 2, + "PLR0913": 2 + }, + "litellm/secret_managers/aws_secret_manager.py": { + "ANN401": 1 + }, + "litellm/secret_managers/aws_secret_manager_v2.py": { + "ANN003": 1, + "ANN401": 1, + "PLR0913": 2 + }, + "litellm/secret_managers/base_secret_manager.py": { + "PLR0913": 1 + }, + "litellm/secret_managers/cyberark_secret_manager.py": { + "PLR0913": 1 + }, + "litellm/secret_managers/hashicorp_secret_manager.py": { + "PLR0913": 1 + }, + "litellm/secret_managers/main.py": { + "C901": 1 + }, + "litellm/secret_managers/secret_manager_handler.py": { + "ANN001": 1, + "ANN401": 2, + "C901": 1 + }, + "litellm/skills/main.py": { + "ANN003": 8, + "ANN401": 1, + "PLR0913": 4, + "PLW0603": 1 + }, + "litellm/timeout.py": { + "ANN001": 2, + "ANN002": 2, + "ANN003": 2 + }, + "litellm/utils.py": { + "ANN001": 104, + "ANN002": 4, + "ANN003": 9, + "ANN401": 8, + "B006": 3, + "C901": 13, + "PLR0913": 9, + "PLW0603": 13 + }, + "litellm/vector_store_files/main.py": { + "ANN003": 12, + "PLR0913": 6 + }, + "litellm/vector_store_files/utils.py": { + "ANN401": 1 + }, + "litellm/vector_stores/main.py": { + "ANN003": 12, + "PLR0913": 12 + }, + "litellm/vector_stores/vector_store_registry.py": { + "B006": 3 + }, + "litellm/videos/main.py": { + "ANN001": 24, + "ANN003": 14, + "ANN401": 10, + "PLR0913": 18 + } +} diff --git a/scripts/ruff_suppressions.py b/scripts/ruff_suppressions.py new file mode 100644 index 000000000000..96d211cdc622 --- /dev/null +++ b/scripts/ruff_suppressions.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python3 +"""Budget gate for the strict ruff rules defined in ruff-strict.toml. + +`update` regenerates ruff-suppressions.json from the current tree. +`check` fails when the total strict-rule violation count grows past the +grandfathered baseline plus a small slack margin. +""" + +import argparse +import json +import math +import subprocess +import sys +from collections import defaultdict +from pathlib import Path +from typing import NamedTuple + +REPO_ROOT = Path(__file__).resolve().parent.parent +STRICT_CONFIG = REPO_ROOT / "ruff-strict.toml" +BASELINE_PATH = REPO_ROOT / "ruff-suppressions.json" +TARGET = "litellm" +SLACK_RATIO = 0.005 + + +def current_counts() -> dict: + proc = subprocess.run( + [ + "ruff", + "check", + TARGET, + "--config", + str(STRICT_CONFIG), + "--output-format", + "json", + ], + cwd=REPO_ROOT, + capture_output=True, + text=True, + ) + if proc.returncode not in (0, 1): + sys.stderr.write(proc.stderr) + raise SystemExit(f"ruff exited {proc.returncode}") + counts: dict = defaultdict(lambda: defaultdict(int)) + for violation in json.loads(proc.stdout or "[]"): + raw = Path(violation["filename"]) + path = ( + (raw if raw.is_absolute() else REPO_ROOT / raw) + .resolve() + .relative_to(REPO_ROOT) + .as_posix() + ) + counts[path][violation["code"]] += 1 + return {path: dict(rules) for path, rules in counts.items()} + + +def total(counts: dict) -> int: + return sum(n for rules in counts.values() for n in rules.values()) + + +class BudgetResult(NamedTuple): + ok: bool + current: int + baseline: int + slack: int + ceiling: int + regressions: list + + +def evaluate_budget( + baseline: dict, counts: dict, slack_ratio: float = SLACK_RATIO +) -> BudgetResult: + base_total, cur_total = total(baseline), total(counts) + slack = math.ceil(base_total * slack_ratio) + ceiling = base_total + slack + regressions = [] + for path in sorted(set(counts) | set(baseline)): + cur, base = counts.get(path, {}), baseline.get(path, {}) + for code in sorted(set(cur) | set(base)): + grew = cur.get(code, 0) - base.get(code, 0) + if grew > 0: + regressions.append((path, code, base.get(code, 0), cur.get(code, 0))) + return BudgetResult( + cur_total <= ceiling, cur_total, base_total, slack, ceiling, regressions + ) + + +def write_baseline(counts: dict) -> None: + BASELINE_PATH.write_text(json.dumps(counts, indent=2, sort_keys=True) + "\n") + + +def cmd_update() -> None: + counts = current_counts() + write_baseline(counts) + print( + f"Wrote {BASELINE_PATH.name}: {total(counts)} violations across {len(counts)} files" + ) + + +def cmd_check() -> None: + if not BASELINE_PATH.exists(): + raise SystemExit( + f"{BASELINE_PATH.name} missing; run: python scripts/ruff_suppressions.py update" + ) + result = evaluate_budget(json.loads(BASELINE_PATH.read_text()), current_counts()) + if result.ok: + print( + f"OK: {result.current} strict-rule violations (baseline {result.baseline}, ceiling {result.ceiling}, headroom {result.ceiling - result.current})" + ) + return + print( + f"FAIL: {result.current} strict-rule violations exceeds ceiling {result.ceiling} (baseline {result.baseline} + {SLACK_RATIO:.1%} slack = {result.slack})" + ) + for path, code, before, after in result.regressions: + print(f" {path}: {code} {before} -> {after} (+{after - before})") + print( + "Fix the new violations, add `# noqa: ` on a justified line, or re-baseline with `make lint-suppressions-update`." + ) + raise SystemExit(1) + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("mode", choices=["check", "update"]) + {"check": cmd_check, "update": cmd_update}[parser.parse_args().mode]() + + +if __name__ == "__main__": + main() diff --git a/tests/test_litellm/test_ruff_suppressions.py b/tests/test_litellm/test_ruff_suppressions.py new file mode 100644 index 000000000000..c67798249084 --- /dev/null +++ b/tests/test_litellm/test_ruff_suppressions.py @@ -0,0 +1,76 @@ +import importlib.util +from pathlib import Path + +import pytest + +_MODULE_PATH = Path(__file__).resolve().parents[2] / "scripts" / "ruff_suppressions.py" +_spec = importlib.util.spec_from_file_location("ruff_suppressions", _MODULE_PATH) +ruff_suppressions = importlib.util.module_from_spec(_spec) +_spec.loader.exec_module(ruff_suppressions) + +evaluate_budget = ruff_suppressions.evaluate_budget + + +def test_clean_tree_passes_with_headroom_equal_to_slack(): + baseline = {"a.py": {"ANN001": 1000}} + result = evaluate_budget(baseline, baseline, slack_ratio=0.005) + assert result.ok + assert result.baseline == 1000 + assert result.current == 1000 + assert result.slack == 5 + assert result.ceiling == 1005 + assert result.regressions == [] + + +def test_growth_exactly_at_ceiling_passes_one_over_fails(): + baseline = {"a.py": {"ANN001": 1000}} + at_ceiling = evaluate_budget( + baseline, {"a.py": {"ANN001": 1005}}, slack_ratio=0.005 + ) + over_ceiling = evaluate_budget( + baseline, {"a.py": {"ANN001": 1006}}, slack_ratio=0.005 + ) + assert at_ceiling.ok is True + assert over_ceiling.ok is False + + +def test_slack_rounds_up(): + baseline = {"a.py": {"ANN001": 8129}} + result = evaluate_budget(baseline, baseline, slack_ratio=0.005) + assert result.slack == 41 + assert result.ceiling == 8170 + + +def test_only_grown_entries_are_reported_as_regressions(): + baseline = {"a.py": {"ANN001": 5}, "b.py": {"C901": 3}} + counts = {"a.py": {"ANN001": 2}, "b.py": {"C901": 7}} + result = evaluate_budget(baseline, counts, slack_ratio=0.005) + assert result.regressions == [("b.py", "C901", 3, 7)] + + +def test_fix_here_add_there_stays_under_budget_but_still_lists_the_growth(): + baseline = {"a.py": {"ANN001": 5}, "b.py": {"C901": 3}} + counts = {"a.py": {"ANN001": 2}, "b.py": {"C901": 6}} + result = evaluate_budget(baseline, counts, slack_ratio=0.005) + assert result.ok is True + assert ("b.py", "C901", 3, 6) in result.regressions + + +def test_brand_new_file_counts_and_is_reported(): + result = evaluate_budget({}, {"new.py": {"ANN001": 2}}, slack_ratio=0.005) + assert result.ok is False + assert result.baseline == 0 + assert result.ceiling == 0 + assert result.regressions == [("new.py", "ANN001", 0, 2)] + + +@pytest.mark.parametrize( + "counts, expected_total", + [ + ({}, 0), + ({"a.py": {"ANN001": 3, "C901": 2}}, 5), + ({"a.py": {"ANN001": 3}, "b.py": {"PLR0913": 4}}, 7), + ], +) +def test_total_sums_every_rule_in_every_file(counts, expected_total): + assert ruff_suppressions.total(counts) == expected_total From 43ebfcfcb70617ac9fd93449fef98fb89d4b9119 Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Fri, 12 Jun 2026 11:20:23 -0700 Subject: [PATCH 02/10] fix: surface per-file drift as a warning on a passing suppressions check Greptile flagged that cmd_check computed per-file regressions but only printed them on failure, so violations shifted between files (or a brand-new file under the slack) passed with a silent OK. Print them as a non-fatal warning on the pass path too; pass/fail behavior is unchanged --- scripts/ruff_suppressions.py | 13 +++++++++++-- tests/test_litellm/test_ruff_suppressions.py | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/scripts/ruff_suppressions.py b/scripts/ruff_suppressions.py index 96d211cdc622..593c55dcf9f9 100644 --- a/scripts/ruff_suppressions.py +++ b/scripts/ruff_suppressions.py @@ -96,6 +96,11 @@ def cmd_update() -> None: ) +def _print_regressions(regressions: list) -> None: + for path, code, before, after in regressions: + print(f" {path}: {code} {before} -> {after} (+{after - before})") + + def cmd_check() -> None: if not BASELINE_PATH.exists(): raise SystemExit( @@ -106,12 +111,16 @@ def cmd_check() -> None: print( f"OK: {result.current} strict-rule violations (baseline {result.baseline}, ceiling {result.ceiling}, headroom {result.ceiling - result.current})" ) + if result.regressions: + print( + f"warning: {len(result.regressions)} per-file regression(s) absorbed by slack (offset by fixes elsewhere):" + ) + _print_regressions(result.regressions) return print( f"FAIL: {result.current} strict-rule violations exceeds ceiling {result.ceiling} (baseline {result.baseline} + {SLACK_RATIO:.1%} slack = {result.slack})" ) - for path, code, before, after in result.regressions: - print(f" {path}: {code} {before} -> {after} (+{after - before})") + _print_regressions(result.regressions) print( "Fix the new violations, add `# noqa: ` on a justified line, or re-baseline with `make lint-suppressions-update`." ) diff --git a/tests/test_litellm/test_ruff_suppressions.py b/tests/test_litellm/test_ruff_suppressions.py index c67798249084..132468eb74b4 100644 --- a/tests/test_litellm/test_ruff_suppressions.py +++ b/tests/test_litellm/test_ruff_suppressions.py @@ -1,4 +1,5 @@ import importlib.util +import json from pathlib import Path import pytest @@ -64,6 +65,24 @@ def test_brand_new_file_counts_and_is_reported(): assert result.regressions == [("new.py", "ANN001", 0, 2)] +def test_passing_check_still_surfaces_per_file_drift(monkeypatch, tmp_path, capsys): + baseline_file = tmp_path / "baseline.json" + baseline_file.write_text(json.dumps({"a.py": {"ANN001": 5}, "b.py": {"C901": 3}})) + monkeypatch.setattr(ruff_suppressions, "BASELINE_PATH", baseline_file) + monkeypatch.setattr( + ruff_suppressions, + "current_counts", + lambda: {"a.py": {"ANN001": 2}, "b.py": {"C901": 6}}, + ) + + ruff_suppressions.cmd_check() + + out = capsys.readouterr().out + assert out.startswith("OK:") + assert "warning:" in out + assert "b.py: C901 3 -> 6" in out + + @pytest.mark.parametrize( "counts, expected_total", [ From a1264a74f9850155591d632f37bbf5b9e73f16b0 Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Fri, 12 Jun 2026 11:42:46 -0700 Subject: [PATCH 03/10] refactor: gate strict ruff rules on the delta vs base, not a frozen baseline The committed total-count baseline went stale against a moving base. CI lints the PR merged with the current staging tip, so violations merged by other PRs counted against this PR and tripped the budget even though nothing here touched them Replace it with a drift-proof gate. scripts/ruff_strict_gate.py runs ruff on the head, keeps only violations on lines this change adds relative to the merge-base, and fails when a rule exceeds its per-rule allowance in ruff-strict-budget.json (all 0 today). Because the base is measured live, base drift cancels out and only what the change introduces is gated. Drops ruff-suppressions.json and the old suppressions script --- .github/workflows/test-linting.yml | 6 +- Makefile | 14 +- ruff-strict-budget.json | 11 + ruff-suppressions.json | 4094 ------------------ scripts/ruff_strict_gate.py | 135 + scripts/ruff_suppressions.py | 137 - tests/test_litellm/test_ruff_strict_gate.py | 96 + tests/test_litellm/test_ruff_suppressions.py | 95 - 8 files changed, 251 insertions(+), 4337 deletions(-) create mode 100644 ruff-strict-budget.json delete mode 100644 ruff-suppressions.json create mode 100644 scripts/ruff_strict_gate.py delete mode 100644 scripts/ruff_suppressions.py create mode 100644 tests/test_litellm/test_ruff_strict_gate.py delete mode 100644 tests/test_litellm/test_ruff_suppressions.py diff --git a/.github/workflows/test-linting.yml b/.github/workflows/test-linting.yml index 64371c320aa1..f212dd9d15e1 100644 --- a/.github/workflows/test-linting.yml +++ b/.github/workflows/test-linting.yml @@ -67,9 +67,11 @@ jobs: uv run --no-sync ruff check . cd .. - - name: Check strict-rule suppressions budget + - name: Check strict-rule budget (delta vs base) + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} run: | - uv run --no-sync python scripts/ruff_suppressions.py check + uv run --no-sync python scripts/ruff_strict_gate.py --base "$BASE_SHA" - name: Print OpenAI version run: | diff --git a/Makefile b/Makefile index 0a409a77de79..2b1a6ec17505 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ test-unit-integrations test-unit-core-utils test-unit-other test-unit-root \ test-proxy-unit-a test-proxy-unit-b test-integration test-unit-helm \ info lint lint-dev format \ - lint-suppressions lint-suppressions-update \ + lint-strict-budget \ install-dev install-proxy-dev install-test-deps install-hooks \ install-helm-unittest check-circular-imports check-import-safety @@ -25,8 +25,7 @@ help: @echo " make lint-ruff - Run Ruff linting only" @echo " make lint-mypy - Run MyPy type checking only" @echo " make lint-black - Check Black formatting (matches CI)" - @echo " make lint-suppressions - Check strict ruff rules against the grandfathered baseline" - @echo " make lint-suppressions-update - Regenerate ruff-suppressions.json (ratchet the baseline)" + @echo " make lint-strict-budget - Gate strict ruff rules this change introduces vs the base branch" @echo " make check-circular-imports - Check for circular imports" @echo " make check-import-safety - Check import safety" @echo " make test - Run all tests" @@ -125,11 +124,8 @@ lint-mypy: install-dev lint-black: format-check -lint-suppressions: install-dev - $(UV_RUN) python scripts/ruff_suppressions.py check - -lint-suppressions-update: install-dev - $(UV_RUN) python scripts/ruff_suppressions.py update +lint-strict-budget: install-dev + $(UV_RUN) python scripts/ruff_strict_gate.py check-circular-imports: install-dev cd litellm && $(UV_RUN) python ../tests/documentation_tests/test_circular_imports.py && cd .. @@ -138,7 +134,7 @@ check-import-safety: install-dev @$(UV_RUN) python -c "from litellm import *; print('[from litellm import *] OK! no issues!');" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1) # Combined linting (matches test-linting.yml workflow) -lint: format-check lint-ruff lint-mypy check-circular-imports check-import-safety lint-suppressions +lint: format-check lint-ruff lint-mypy check-circular-imports check-import-safety lint-strict-budget # Faster linting for local development (only checks changed code) lint-dev: lint-format-changed lint-mypy check-circular-imports check-import-safety diff --git a/ruff-strict-budget.json b/ruff-strict-budget.json new file mode 100644 index 000000000000..a491868c514c --- /dev/null +++ b/ruff-strict-budget.json @@ -0,0 +1,11 @@ +{ + "ANN001": 0, + "ANN002": 0, + "ANN003": 0, + "ANN401": 0, + "B006": 0, + "C901": 0, + "PLR0913": 0, + "PLW0603": 0, + "RUF012": 0 +} diff --git a/ruff-suppressions.json b/ruff-suppressions.json deleted file mode 100644 index 2ca34cdf2e39..000000000000 --- a/ruff-suppressions.json +++ /dev/null @@ -1,4094 +0,0 @@ -{ - "litellm/_lazy_imports.py": { - "ANN401": 18, - "C901": 1, - "PLW0603": 4 - }, - "litellm/_logging.py": { - "ANN001": 10 - }, - "litellm/_redis.py": { - "ANN001": 7, - "ANN003": 4, - "C901": 1 - }, - "litellm/_redis_credential_provider.py": { - "ANN401": 1 - }, - "litellm/_service_logger.py": { - "ANN001": 4, - "ANN401": 3, - "PLR0913": 3 - }, - "litellm/a2a_protocol/exception_mapping_utils.py": { - "ANN401": 1 - }, - "litellm/a2a_protocol/exceptions.py": { - "PLR0913": 2 - }, - "litellm/a2a_protocol/litellm_completion_bridge/transformation.py": { - "ANN401": 1 - }, - "litellm/a2a_protocol/main.py": { - "ANN401": 7, - "C901": 1, - "PLR0913": 4 - }, - "litellm/a2a_protocol/providers/base.py": { - "ANN003": 2 - }, - "litellm/a2a_protocol/providers/bedrock_agentcore/config.py": { - "ANN003": 2 - }, - "litellm/a2a_protocol/providers/bedrock_agentcore/transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/a2a_protocol/providers/langflow/config.py": { - "ANN003": 2 - }, - "litellm/a2a_protocol/providers/pydantic_ai_agents/config.py": { - "ANN003": 1, - "ANN401": 1 - }, - "litellm/a2a_protocol/providers/pydantic_ai_agents/handler.py": { - "PLR0913": 1 - }, - "litellm/a2a_protocol/providers/pydantic_ai_agents/transformation.py": { - "ANN401": 6, - "PLR0913": 1 - }, - "litellm/a2a_protocol/providers/watsonx_orchestrate/config.py": { - "ANN401": 2 - }, - "litellm/a2a_protocol/providers/watsonx_orchestrate/handler.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/a2a_protocol/providers/watsonx_orchestrate/transformation.py": { - "ANN401": 1 - }, - "litellm/a2a_protocol/streaming_iterator.py": { - "ANN401": 2 - }, - "litellm/a2a_protocol/utils.py": { - "ANN401": 3 - }, - "litellm/anthropic_beta_headers_manager.py": { - "PLW0603": 2 - }, - "litellm/anthropic_interface/messages/__init__.py": { - "ANN003": 2, - "PLR0913": 2 - }, - "litellm/assistants/main.py": { - "ANN001": 3, - "ANN003": 18, - "ANN401": 6, - "PLR0913": 6 - }, - "litellm/assistants/utils.py": { - "ANN001": 2, - "ANN003": 2, - "PLR0913": 1 - }, - "litellm/batch_completion/main.py": { - "ANN001": 4, - "ANN002": 2, - "ANN003": 3, - "B006": 1, - "PLR0913": 1 - }, - "litellm/batches/batch_utils.py": { - "ANN401": 2 - }, - "litellm/batches/main.py": { - "ANN001": 1, - "ANN003": 9, - "ANN401": 1, - "PLR0913": 6 - }, - "litellm/budget_manager.py": { - "ANN001": 4 - }, - "litellm/caching/_internal_lru_cache.py": { - "ANN002": 2, - "ANN003": 2 - }, - "litellm/caching/azure_blob_cache.py": { - "ANN001": 9, - "ANN003": 5 - }, - "litellm/caching/base_cache.py": { - "ANN001": 9, - "ANN003": 7 - }, - "litellm/caching/caching.py": { - "ANN001": 8, - "ANN003": 15, - "ANN401": 3, - "B006": 3, - "C901": 1, - "PLR0913": 1 - }, - "litellm/caching/caching_handler.py": { - "ANN401": 7, - "C901": 1, - "PLR0913": 5 - }, - "litellm/caching/disk_cache.py": { - "ANN001": 10, - "ANN003": 9 - }, - "litellm/caching/dual_cache.py": { - "ANN001": 13, - "ANN002": 1, - "ANN003": 12, - "PLR0913": 1 - }, - "litellm/caching/gcs_cache.py": { - "ANN001": 7, - "ANN003": 5 - }, - "litellm/caching/in_memory_cache.py": { - "ANN001": 12, - "ANN003": 10, - "ANN401": 1 - }, - "litellm/caching/llm_caching_handler.py": { - "ANN001": 7, - "ANN003": 4 - }, - "litellm/caching/qdrant_semantic_cache.py": { - "ANN001": 15, - "ANN003": 6, - "ANN401": 2, - "C901": 1, - "PLR0913": 1 - }, - "litellm/caching/redis_cache.py": { - "ANN001": 18, - "ANN002": 1, - "ANN003": 13, - "ANN401": 4, - "PLR0913": 1 - }, - "litellm/caching/redis_cluster_cache.py": { - "ANN002": 1, - "ANN003": 1 - }, - "litellm/caching/redis_semantic_cache.py": { - "ANN003": 9, - "ANN401": 13, - "PLR0913": 1 - }, - "litellm/caching/s3_cache.py": { - "ANN001": 17, - "ANN003": 6, - "PLR0913": 1 - }, - "litellm/completion_extras/litellm_responses_transformation/handler.py": { - "ANN002": 2, - "ANN003": 2, - "ANN401": 5 - }, - "litellm/completion_extras/litellm_responses_transformation/transformation.py": { - "ANN001": 1, - "ANN401": 7, - "C901": 2, - "PLR0913": 2 - }, - "litellm/compression/compress.py": { - "ANN401": 3, - "PLR0913": 2 - }, - "litellm/containers/endpoint_factory.py": { - "ANN003": 2 - }, - "litellm/containers/main.py": { - "ANN001": 18, - "ANN003": 18, - "PLR0913": 12 - }, - "litellm/cost_calculator.py": { - "ANN001": 8, - "ANN401": 7, - "B006": 1, - "C901": 2, - "PLR0913": 7 - }, - "litellm/endpoints/speech/speech_to_completion_bridge/handler.py": { - "PLR0913": 1 - }, - "litellm/endpoints/speech/speech_to_completion_bridge/transformation.py": { - "PLR0913": 1 - }, - "litellm/evals/main.py": { - "ANN003": 22, - "PLR0913": 16 - }, - "litellm/exceptions.py": { - "ANN001": 59, - "ANN401": 3, - "PLR0913": 19, - "PLW0603": 1 - }, - "litellm/experimental_mcp_client/client.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/files/main.py": { - "ANN003": 10, - "ANN401": 1, - "PLR0913": 5 - }, - "litellm/fine_tuning/main.py": { - "ANN001": 7, - "ANN003": 8, - "ANN401": 1, - "B006": 2, - "PLR0913": 3 - }, - "litellm/google_genai/adapters/handler.py": { - "ANN003": 2, - "PLR0913": 1 - }, - "litellm/google_genai/adapters/transformation.py": { - "ANN003": 1, - "ANN401": 5, - "C901": 1 - }, - "litellm/google_genai/main.py": { - "ANN003": 5, - "ANN401": 3, - "PLR0913": 4 - }, - "litellm/google_genai/streaming_iterator.py": { - "ANN001": 2, - "PLR0913": 2 - }, - "litellm/images/main.py": { - "ANN001": 4, - "ANN002": 2, - "ANN003": 7, - "ANN401": 1, - "C901": 2, - "PLR0913": 4, - "PLW0603": 1 - }, - "litellm/images/utils.py": { - "ANN401": 1 - }, - "litellm/integrations/SlackAlerting/batching_handler.py": { - "ANN001": 3 - }, - "litellm/integrations/SlackAlerting/slack_alerting.py": { - "ANN001": 19, - "ANN003": 2, - "ANN401": 2, - "B006": 2, - "C901": 1, - "PLR0913": 4 - }, - "litellm/integrations/anthropic_cache_control_hook.py": { - "PLR0913": 4 - }, - "litellm/integrations/argilla.py": { - "ANN001": 17, - "ANN003": 1 - }, - "litellm/integrations/arize/_utils.py": { - "ANN001": 45, - "ANN002": 1, - "ANN003": 1, - "ANN401": 2, - "C901": 1, - "PLR0913": 1 - }, - "litellm/integrations/arize/arize.py": { - "ANN001": 4, - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/integrations/arize/arize_phoenix.py": { - "ANN001": 17, - "ANN401": 1 - }, - "litellm/integrations/arize/arize_phoenix_prompt_manager.py": { - "ANN003": 2, - "PLR0913": 4 - }, - "litellm/integrations/athina.py": { - "ANN001": 5 - }, - "litellm/integrations/azure_sentinel/azure_sentinel.py": { - "ANN001": 8, - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/integrations/azure_storage/azure_storage.py": { - "ANN001": 8, - "ANN003": 1 - }, - "litellm/integrations/bitbucket/bitbucket_prompt_manager.py": { - "ANN003": 2, - "ANN401": 2, - "PLR0913": 6 - }, - "litellm/integrations/braintrust_logging.py": { - "ANN001": 12, - "C901": 2 - }, - "litellm/integrations/braintrust_mock_client.py": { - "ANN001": 11, - "PLR0913": 1, - "PLW0603": 2 - }, - "litellm/integrations/cloudzero/cloudzero.py": { - "ANN001": 1, - "ANN003": 1 - }, - "litellm/integrations/cloudzero/cz_resource_names.py": { - "PLR0913": 1 - }, - "litellm/integrations/cloudzero/transform.py": { - "ANN001": 1 - }, - "litellm/integrations/compression_interception/handler.py": { - "ANN401": 7, - "PLR0913": 2 - }, - "litellm/integrations/custom_batch_logger.py": { - "ANN002": 1, - "ANN003": 2 - }, - "litellm/integrations/custom_guardrail.py": { - "ANN001": 2, - "ANN002": 3, - "ANN003": 4, - "ANN401": 1, - "C901": 1, - "PLR0913": 4 - }, - "litellm/integrations/custom_logger.py": { - "ANN001": 60, - "ANN003": 1, - "ANN401": 25, - "C901": 1, - "PLR0913": 10 - }, - "litellm/integrations/custom_prompt_management.py": { - "ANN003": 1, - "PLR0913": 3 - }, - "litellm/integrations/custom_secret_manager.py": { - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/integrations/datadog/datadog.py": { - "ANN001": 16, - "ANN003": 1, - "ANN401": 8, - "PLR0913": 2 - }, - "litellm/integrations/datadog/datadog_cost_management.py": { - "ANN001": 4, - "ANN003": 1, - "ANN401": 1 - }, - "litellm/integrations/datadog/datadog_llm_obs.py": { - "ANN001": 8, - "ANN003": 1 - }, - "litellm/integrations/datadog/datadog_metrics.py": { - "ANN001": 8, - "ANN003": 1 - }, - "litellm/integrations/deepeval/api.py": { - "ANN001": 9 - }, - "litellm/integrations/deepeval/deepeval.py": { - "ANN001": 41, - "ANN002": 1, - "ANN003": 1 - }, - "litellm/integrations/dotprompt/dotprompt_manager.py": { - "PLR0913": 4 - }, - "litellm/integrations/dynamodb.py": { - "ANN001": 10 - }, - "litellm/integrations/focus/focus_logger.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/integrations/focus/transformer.py": { - "ANN001": 2 - }, - "litellm/integrations/galileo.py": { - "ANN001": 4, - "ANN401": 18 - }, - "litellm/integrations/gcs_bucket/gcs_bucket.py": { - "ANN001": 8, - "ANN401": 1 - }, - "litellm/integrations/gcs_bucket/gcs_bucket_base.py": { - "ANN003": 3, - "B006": 1 - }, - "litellm/integrations/gcs_bucket/gcs_bucket_mock_client.py": { - "ANN001": 32, - "PLR0913": 2, - "PLW0603": 3 - }, - "litellm/integrations/gcs_pubsub/pub_sub.py": { - "ANN001": 4, - "ANN003": 1 - }, - "litellm/integrations/generic_api/generic_api_callback.py": { - "ANN001": 13, - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/integrations/generic_prompt_management/generic_prompt_manager.py": { - "ANN003": 1, - "PLR0913": 4 - }, - "litellm/integrations/gitlab/gitlab_prompt_manager.py": { - "ANN003": 2, - "ANN401": 2, - "PLR0913": 6 - }, - "litellm/integrations/greenscale.py": { - "ANN001": 5 - }, - "litellm/integrations/helicone.py": { - "ANN001": 10, - "PLR0913": 1, - "RUF012": 1 - }, - "litellm/integrations/humanloop.py": { - "PLR0913": 1 - }, - "litellm/integrations/lago.py": { - "ANN001": 9 - }, - "litellm/integrations/langfuse/langfuse.py": { - "ANN001": 29, - "ANN401": 3, - "C901": 1, - "PLR0913": 3 - }, - "litellm/integrations/langfuse/langfuse_otel.py": { - "ANN001": 6, - "ANN002": 3, - "ANN003": 3, - "C901": 1 - }, - "litellm/integrations/langfuse/langfuse_otel_attributes.py": { - "ANN001": 1 - }, - "litellm/integrations/langfuse/langfuse_prompt_management.py": { - "ANN001": 25, - "PLR0913": 4 - }, - "litellm/integrations/langsmith.py": { - "ANN001": 18, - "ANN003": 1 - }, - "litellm/integrations/langtrace.py": { - "ANN001": 7 - }, - "litellm/integrations/litellm_agent/litellm_agent_model_resolver.py": { - "PLR0913": 2 - }, - "litellm/integrations/literal_ai.py": { - "ANN001": 29, - "ANN003": 1 - }, - "litellm/integrations/logfire_logger.py": { - "ANN001": 11, - "PLR0913": 2 - }, - "litellm/integrations/lunary.py": { - "ANN001": 18, - "B006": 1, - "PLR0913": 1 - }, - "litellm/integrations/mlflow.py": { - "ANN001": 41 - }, - "litellm/integrations/mock_client_factory.py": { - "ANN001": 26, - "ANN003": 1, - "C901": 1, - "PLR0913": 2 - }, - "litellm/integrations/openmeter.py": { - "ANN001": 9 - }, - "litellm/integrations/opentelemetry.py": { - "ANN001": 62, - "ANN003": 1, - "ANN401": 14, - "C901": 1, - "PLR0913": 2 - }, - "litellm/integrations/opentelemetry_utils/base_otel_llm_obs_attributes.py": { - "ANN001": 2, - "ANN401": 1 - }, - "litellm/integrations/opentelemetry_utils/gen_ai_semconv.py": { - "ANN001": 3, - "ANN401": 1 - }, - "litellm/integrations/opik/opik.py": { - "ANN401": 3 - }, - "litellm/integrations/opik/opik_payload_builder/extractors.py": { - "ANN401": 1 - }, - "litellm/integrations/opik/opik_payload_builder/payload_builders.py": { - "ANN401": 4, - "PLR0913": 2 - }, - "litellm/integrations/opik/utils.py": { - "ANN001": 1 - }, - "litellm/integrations/otel/emitter.py": { - "PLR0913": 1 - }, - "litellm/integrations/otel/logger.py": { - "ANN001": 11, - "ANN401": 13, - "PLR0913": 2 - }, - "litellm/integrations/otel/mappers/genai.py": { - "RUF012": 5 - }, - "litellm/integrations/otel/mappers/langfuse.py": { - "RUF012": 4 - }, - "litellm/integrations/otel/mappers/langtrace.py": { - "RUF012": 2 - }, - "litellm/integrations/otel/mappers/legacy.py": { - "RUF012": 3 - }, - "litellm/integrations/otel/mappers/openinference.py": { - "RUF012": 4 - }, - "litellm/integrations/otel/mappers/weave.py": { - "RUF012": 2 - }, - "litellm/integrations/otel/model/config.py": { - "ANN401": 2 - }, - "litellm/integrations/otel/mount.py": { - "ANN401": 2 - }, - "litellm/integrations/otel/plumbing/routing.py": { - "ANN401": 1 - }, - "litellm/integrations/otel/presets/agentops.py": { - "ANN401": 3 - }, - "litellm/integrations/otel/presets/arize.py": { - "ANN001": 1 - }, - "litellm/integrations/otel/runtime.py": { - "ANN401": 2 - }, - "litellm/integrations/posthog.py": { - "ANN001": 16, - "ANN003": 1, - "ANN401": 3 - }, - "litellm/integrations/prometheus.py": { - "ANN001": 12, - "ANN002": 1, - "ANN003": 2, - "ANN401": 10, - "C901": 1, - "PLR0913": 7 - }, - "litellm/integrations/prometheus_helpers/__init__.py": { - "PLW0603": 1 - }, - "litellm/integrations/prometheus_helpers/bounded_prometheus_series_tracker.py": { - "ANN401": 3, - "PLR0913": 1 - }, - "litellm/integrations/prometheus_services.py": { - "ANN001": 5, - "ANN003": 1, - "B006": 1 - }, - "litellm/integrations/prompt_layer.py": { - "ANN001": 5 - }, - "litellm/integrations/prompt_management_base.py": { - "PLR0913": 7 - }, - "litellm/integrations/rubrik.py": { - "ANN001": 9, - "ANN003": 1, - "ANN401": 4 - }, - "litellm/integrations/s3.py": { - "ANN001": 21, - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/integrations/s3_v2.py": { - "ANN001": 14, - "ANN003": 1, - "PLR0913": 2 - }, - "litellm/integrations/sqs.py": { - "ANN001": 10, - "ANN003": 1, - "PLR0913": 2 - }, - "litellm/integrations/supabase.py": { - "ANN001": 13, - "PLR0913": 1 - }, - "litellm/integrations/traceloop.py": { - "ANN001": 8, - "PLR0913": 1 - }, - "litellm/integrations/vantage/vantage_logger.py": { - "ANN401": 1 - }, - "litellm/integrations/vector_store_integrations/vector_store_pre_call_hook.py": { - "ANN401": 6, - "PLR0913": 1 - }, - "litellm/integrations/weave/weave_otel.py": { - "ANN001": 15, - "ANN003": 1, - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/integrations/websearch_interception/handler.py": { - "ANN401": 24, - "PLR0913": 10 - }, - "litellm/integrations/websearch_interception/transformation.py": { - "ANN401": 3 - }, - "litellm/integrations/weights_biases.py": { - "ANN001": 5 - }, - "litellm/interactions/agents/http_handler.py": { - "PLR0913": 10 - }, - "litellm/interactions/agents/main.py": { - "ANN003": 10, - "PLR0913": 2 - }, - "litellm/interactions/http_handler.py": { - "ANN401": 1, - "PLR0913": 8 - }, - "litellm/interactions/litellm_responses_transformation/handler.py": { - "ANN003": 2 - }, - "litellm/interactions/litellm_responses_transformation/streaming_iterator.py": { - "PLR0913": 1 - }, - "litellm/interactions/litellm_responses_transformation/transformation.py": { - "ANN003": 1 - }, - "litellm/interactions/main.py": { - "ANN003": 8, - "PLR0913": 2 - }, - "litellm/interactions/streaming_iterator.py": { - "PLR0913": 3 - }, - "litellm/litellm_core_utils/asyncify.py": { - "ANN001": 1, - "ANN002": 1, - "ANN003": 1 - }, - "litellm/litellm_core_utils/audio_utils/utils.py": { - "C901": 3 - }, - "litellm/litellm_core_utils/cached_imports.py": { - "PLW0603": 6 - }, - "litellm/litellm_core_utils/core_helpers.py": { - "ANN001": 1, - "ANN401": 2 - }, - "litellm/litellm_core_utils/coroutine_checker.py": { - "ANN401": 1 - }, - "litellm/litellm_core_utils/custom_logger_registry.py": { - "RUF012": 1 - }, - "litellm/litellm_core_utils/dd_tracing.py": { - "ANN001": 4, - "ANN002": 1, - "ANN003": 3, - "ANN401": 1 - }, - "litellm/litellm_core_utils/dot_notation_indexing.py": { - "C901": 1 - }, - "litellm/litellm_core_utils/duration_parser.py": { - "ANN001": 2 - }, - "litellm/litellm_core_utils/exception_mapping_utils.py": { - "ANN001": 9, - "ANN401": 1, - "B006": 3, - "C901": 1 - }, - "litellm/litellm_core_utils/fallback_utils.py": { - "ANN003": 2 - }, - "litellm/litellm_core_utils/get_litellm_params.py": { - "ANN001": 25, - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/litellm_core_utils/get_llm_provider_logic.py": { - "C901": 2 - }, - "litellm/litellm_core_utils/get_supported_openai_params.py": { - "C901": 1 - }, - "litellm/litellm_core_utils/json_validation_rule.py": { - "ANN401": 2 - }, - "litellm/litellm_core_utils/litellm_logging.py": { - "ANN001": 55, - "ANN003": 5, - "ANN401": 28, - "B006": 4, - "C901": 7, - "PLR0913": 7, - "PLW0603": 27 - }, - "litellm/litellm_core_utils/llm_cost_calc/tool_call_cost_tracking.py": { - "ANN401": 6 - }, - "litellm/litellm_core_utils/llm_cost_calc/usage_object_transformation.py": { - "ANN401": 1 - }, - "litellm/litellm_core_utils/llm_cost_calc/utils.py": { - "ANN401": 1, - "C901": 1, - "PLR0913": 3 - }, - "litellm/litellm_core_utils/llm_request_utils.py": { - "ANN001": 1 - }, - "litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py": { - "ANN001": 4, - "C901": 1, - "PLR0913": 1 - }, - "litellm/litellm_core_utils/llm_response_utils/get_formatted_prompt.py": { - "C901": 1 - }, - "litellm/litellm_core_utils/llm_response_utils/response_metadata.py": { - "ANN401": 3, - "PLR0913": 1 - }, - "litellm/litellm_core_utils/logging_callback_manager.py": { - "ANN001": 6 - }, - "litellm/litellm_core_utils/logging_utils.py": { - "ANN001": 1, - "ANN002": 2, - "ANN003": 2, - "ANN401": 4, - "PLR0913": 1, - "PLW0603": 1 - }, - "litellm/litellm_core_utils/model_response_utils.py": { - "ANN401": 2 - }, - "litellm/litellm_core_utils/prompt_templates/common_utils.py": { - "ANN401": 6, - "B006": 2 - }, - "litellm/litellm_core_utils/prompt_templates/factory.py": { - "ANN001": 30, - "ANN401": 5, - "C901": 9, - "PLR0913": 1 - }, - "litellm/litellm_core_utils/realtime_streaming.py": { - "ANN001": 1, - "ANN401": 5, - "C901": 2, - "PLR0913": 1, - "RUF012": 3 - }, - "litellm/litellm_core_utils/redact_messages.py": { - "ANN001": 7, - "ANN401": 2, - "C901": 1 - }, - "litellm/litellm_core_utils/safe_json_dumps.py": { - "ANN401": 3 - }, - "litellm/litellm_core_utils/safe_json_loads.py": { - "ANN401": 2 - }, - "litellm/litellm_core_utils/specialty_caches/dynamic_logging_cache.py": { - "ANN401": 2 - }, - "litellm/litellm_core_utils/streaming_chunk_builder_utils.py": { - "ANN401": 2, - "C901": 1 - }, - "litellm/litellm_core_utils/streaming_handler.py": { - "ANN001": 27, - "ANN401": 5, - "C901": 3, - "PLR0913": 1 - }, - "litellm/litellm_core_utils/token_counter.py": { - "ANN001": 11, - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/litellm_core_utils/url_utils.py": { - "ANN401": 10 - }, - "litellm/llms/__init__.py": { - "PLW0603": 2 - }, - "litellm/llms/a2a/chat/guardrail_translation/handler.py": { - "ANN401": 3, - "C901": 1 - }, - "litellm/llms/a2a/chat/streaming_iterator.py": { - "ANN001": 1 - }, - "litellm/llms/a2a/chat/transformation.py": { - "ANN401": 3, - "PLR0913": 3 - }, - "litellm/llms/a2a/common_utils.py": { - "B006": 1 - }, - "litellm/llms/ai21/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/aiml/image_generation/cost_calculator.py": { - "ANN401": 1 - }, - "litellm/llms/aiml/image_generation/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/aiohttp_openai/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/amazon_nova/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/anthropic/batches/handler.py": { - "PLR0913": 2 - }, - "litellm/llms/anthropic/batches/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/anthropic/chat/guardrail_translation/handler.py": { - "ANN401": 11, - "PLR0913": 2 - }, - "litellm/llms/anthropic/chat/handler.py": { - "ANN001": 26, - "B006": 3, - "C901": 1, - "PLR0913": 5 - }, - "litellm/llms/anthropic/chat/transformation.py": { - "ANN401": 3, - "C901": 5, - "PLR0913": 4 - }, - "litellm/llms/anthropic/common_utils.py": { - "ANN001": 1, - "ANN401": 2, - "C901": 1, - "PLR0913": 4 - }, - "litellm/llms/anthropic/completion/transformation.py": { - "ANN001": 2, - "PLR0913": 3 - }, - "litellm/llms/anthropic/count_tokens/handler.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/anthropic/count_tokens/token_counter.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/anthropic/count_tokens/transformation.py": { - "ANN401": 1 - }, - "litellm/llms/anthropic/experimental_pass_through/adapters/handler.py": { - "ANN003": 2, - "ANN401": 11, - "C901": 1, - "PLR0913": 5 - }, - "litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py": { - "ANN401": 7, - "C901": 2, - "PLR0913": 1 - }, - "litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py": { - "ANN001": 2, - "ANN401": 5, - "C901": 2 - }, - "litellm/llms/anthropic/experimental_pass_through/context_management/dispatcher.py": { - "ANN401": 5, - "PLR0913": 1 - }, - "litellm/llms/anthropic/experimental_pass_through/context_management/editors/clear_tool_uses.py": { - "ANN401": 1 - }, - "litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py": { - "ANN401": 13, - "C901": 1, - "PLR0913": 2 - }, - "litellm/llms/anthropic/experimental_pass_through/context_management/placeholders.py": { - "ANN401": 1 - }, - "litellm/llms/anthropic/experimental_pass_through/messages/agentic_streaming_iterator.py": { - "ANN401": 3, - "PLR0913": 1 - }, - "litellm/llms/anthropic/experimental_pass_through/messages/handler.py": { - "ANN003": 3, - "PLR0913": 2 - }, - "litellm/llms/anthropic/experimental_pass_through/messages/interceptors/advisor.py": { - "ANN003": 2, - "ANN401": 6, - "PLR0913": 2 - }, - "litellm/llms/anthropic/experimental_pass_through/messages/interceptors/base.py": { - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/llms/anthropic/experimental_pass_through/messages/streaming_iterator.py": { - "ANN001": 1, - "ANN401": 1 - }, - "litellm/llms/anthropic/experimental_pass_through/messages/transformation.py": { - "ANN001": 1, - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/anthropic/experimental_pass_through/messages/utils.py": { - "ANN003": 1 - }, - "litellm/llms/anthropic/experimental_pass_through/responses_adapters/handler.py": { - "ANN003": 2, - "C901": 1, - "PLR0913": 3 - }, - "litellm/llms/anthropic/experimental_pass_through/responses_adapters/streaming_iterator.py": { - "ANN401": 2, - "C901": 1 - }, - "litellm/llms/anthropic/experimental_pass_through/responses_adapters/transformation.py": { - "C901": 3 - }, - "litellm/llms/anthropic/files/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/apiserpent/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/aws_polly/text_to_speech/transformation.py": { - "ANN401": 2, - "B006": 1, - "PLR0913": 2, - "RUF012": 3 - }, - "litellm/llms/azure/assistants.py": { - "ANN001": 3, - "PLR0913": 20 - }, - "litellm/llms/azure/audio_transcription/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/azure/audio_transcriptions.py": { - "ANN001": 3, - "ANN401": 2, - "PLR0913": 2 - }, - "litellm/llms/azure/azure.py": { - "ANN001": 16, - "ANN401": 3, - "B006": 4, - "PLR0913": 13 - }, - "litellm/llms/azure/batches/handler.py": { - "PLR0913": 4 - }, - "litellm/llms/azure/chat/gpt_transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/azure/chat/o_series_handler.py": { - "ANN001": 2, - "ANN401": 1, - "B006": 1, - "PLR0913": 1 - }, - "litellm/llms/azure/common_utils.py": { - "ANN001": 2, - "PLR0913": 4 - }, - "litellm/llms/azure/completion/handler.py": { - "ANN001": 13, - "ANN401": 4, - "B006": 3, - "PLR0913": 4 - }, - "litellm/llms/azure/completion/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/azure/files/handler.py": { - "PLR0913": 5 - }, - "litellm/llms/azure/fine_tuning/handler.py": { - "PLR0913": 4 - }, - "litellm/llms/azure/passthrough/transformation.py": { - "PLR0913": 3 - }, - "litellm/llms/azure/realtime/handler.py": { - "ANN401": 5, - "PLR0913": 1 - }, - "litellm/llms/azure/realtime/http_transformation.py": { - "ANN003": 2 - }, - "litellm/llms/azure/responses/transformation.py": { - "PLR0913": 1, - "RUF012": 1 - }, - "litellm/llms/azure/text_to_speech/transformation.py": { - "ANN401": 2, - "B006": 1, - "PLR0913": 2, - "RUF012": 2 - }, - "litellm/llms/azure_ai/agents/handler.py": { - "C901": 1, - "PLR0913": 6 - }, - "litellm/llms/azure_ai/agents/transformation.py": { - "ANN003": 1, - "ANN401": 3, - "PLR0913": 4 - }, - "litellm/llms/azure_ai/anthropic/count_tokens/handler.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/azure_ai/anthropic/count_tokens/token_counter.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/azure_ai/anthropic/handler.py": { - "ANN001": 7, - "B006": 1, - "PLR0913": 1 - }, - "litellm/llms/azure_ai/anthropic/messages_transformation.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/azure_ai/anthropic/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/azure_ai/azure_model_router/transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/azure_ai/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/azure_ai/common_utils.py": { - "PLR0913": 1 - }, - "litellm/llms/azure_ai/embed/handler.py": { - "ANN001": 8, - "PLR0913": 4 - }, - "litellm/llms/azure_ai/image_edit/flux2_transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/azure_ai/image_edit/mai_transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/azure_ai/image_generation/cost_calculator.py": { - "ANN401": 1 - }, - "litellm/llms/azure_ai/image_generation/mai_transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/azure_ai/ocr/document_intelligence/transformation.py": { - "ANN003": 5, - "ANN401": 3 - }, - "litellm/llms/azure_ai/ocr/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/azure_ai/rerank/transformation.py": { - "B006": 3, - "PLR0913": 1 - }, - "litellm/llms/azure_ai/vector_stores/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/base.py": { - "ANN001": 7, - "ANN002": 3, - "ANN003": 3, - "ANN401": 5, - "PLR0913": 2 - }, - "litellm/llms/base_llm/anthropic_messages/transformation.py": { - "PLR0913": 3 - }, - "litellm/llms/base_llm/audio_transcription/transformation.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/base_llm/base_model_iterator.py": { - "ANN001": 2 - }, - "litellm/llms/base_llm/base_utils.py": { - "ANN001": 1, - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/base_llm/batches/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/base_llm/bridges/completion_transformation.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/base_llm/chat/transformation.py": { - "ANN401": 4, - "PLR0913": 7 - }, - "litellm/llms/base_llm/completion/transformation.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/base_llm/containers/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/base_llm/embedding/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/base_llm/files/azure_blob_storage_backend.py": { - "ANN001": 1, - "ANN002": 2, - "ANN003": 3 - }, - "litellm/llms/base_llm/files/transformation.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/base_llm/google_genai/transformation.py": { - "ANN401": 1 - }, - "litellm/llms/base_llm/guardrail_translation/base_translation.py": { - "ANN401": 5 - }, - "litellm/llms/base_llm/guardrail_translation/utils.py": { - "ANN401": 2 - }, - "litellm/llms/base_llm/image_edit/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/base_llm/image_generation/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/base_llm/image_variations/transformation.py": { - "ANN401": 3, - "PLR0913": 5 - }, - "litellm/llms/base_llm/interactions/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/base_llm/managed_resources/base_managed_resource.py": { - "PLR0913": 1 - }, - "litellm/llms/base_llm/managed_resources/utils.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/base_llm/ocr/transformation.py": { - "ANN003": 6, - "RUF012": 4 - }, - "litellm/llms/base_llm/passthrough/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/base_llm/realtime/http_transformation.py": { - "ANN003": 2 - }, - "litellm/llms/base_llm/rerank/transformation.py": { - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/base_llm/responses/transformation.py": { - "PLR0913": 3 - }, - "litellm/llms/base_llm/search/transformation.py": { - "ANN003": 4, - "RUF012": 2 - }, - "litellm/llms/base_llm/text_to_speech/transformation.py": { - "B006": 1, - "PLR0913": 1 - }, - "litellm/llms/base_llm/vector_store/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/base_llm/videos/transformation.py": { - "ANN401": 1, - "PLR0913": 5 - }, - "litellm/llms/baseten/chat.py": { - "PLR0913": 1 - }, - "litellm/llms/bedrock/base_aws_llm.py": { - "ANN001": 2, - "ANN401": 1, - "PLR0913": 6 - }, - "litellm/llms/bedrock/batches/handler.py": { - "ANN001": 2, - "ANN003": 2, - "ANN401": 1 - }, - "litellm/llms/bedrock/batches/transformation.py": { - "ANN001": 4, - "ANN401": 3, - "PLR0913": 2 - }, - "litellm/llms/bedrock/chat/agentcore/transformation.py": { - "ANN003": 1, - "ANN401": 1, - "PLR0913": 6 - }, - "litellm/llms/bedrock/chat/converse_handler.py": { - "ANN001": 10, - "B006": 2, - "C901": 1, - "PLR0913": 4 - }, - "litellm/llms/bedrock/chat/converse_transformation.py": { - "ANN001": 1, - "C901": 3, - "PLR0913": 4 - }, - "litellm/llms/bedrock/chat/invoke_agent/transformation.py": { - "ANN001": 3, - "ANN003": 1, - "ANN401": 1, - "PLR0913": 4 - }, - "litellm/llms/bedrock/chat/invoke_handler.py": { - "ANN001": 26, - "B006": 2, - "C901": 2, - "PLR0913": 8 - }, - "litellm/llms/bedrock/chat/invoke_transformations/amazon_ai21_transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/bedrock/chat/invoke_transformations/amazon_deepseek_transformation.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/llms/bedrock/chat/invoke_transformations/amazon_moonshot_transformation.py": { - "ANN003": 1, - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/bedrock/chat/invoke_transformations/amazon_nova_transformation.py": { - "ANN003": 1, - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/bedrock/chat/invoke_transformations/amazon_openai_transformation.py": { - "ANN003": 1, - "PLR0913": 3 - }, - "litellm/llms/bedrock/chat/invoke_transformations/amazon_qwen2_transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/bedrock/chat/invoke_transformations/amazon_qwen3_transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/bedrock/chat/invoke_transformations/amazon_twelvelabs_pegasus_transformation.py": { - "ANN401": 3, - "PLR0913": 1 - }, - "litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude2_transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/bedrock/chat/invoke_transformations/anthropic_claude3_transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py": { - "ANN001": 4, - "ANN003": 1, - "ANN401": 1, - "PLR0913": 6 - }, - "litellm/llms/bedrock/chat/mantle/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/bedrock/claude_platform/common_utils.py": { - "PLR0913": 2 - }, - "litellm/llms/bedrock/claude_platform/messages_transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/bedrock/claude_platform/transformation.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/llms/bedrock/common_utils.py": { - "ANN001": 5, - "ANN003": 1, - "ANN401": 1, - "C901": 2, - "PLR0913": 2, - "PLW0603": 2 - }, - "litellm/llms/bedrock/count_tokens/bedrock_token_counter.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/bedrock/count_tokens/transformation.py": { - "ANN401": 1 - }, - "litellm/llms/bedrock/embed/embedding.py": { - "ANN001": 3, - "ANN003": 1, - "ANN401": 4, - "C901": 1, - "PLR0913": 3 - }, - "litellm/llms/bedrock/files/transformation.py": { - "ANN001": 1, - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/bedrock/image_edit/amazon_nova_canvas_image_edit_transformation.py": { - "C901": 1, - "PLR0913": 2 - }, - "litellm/llms/bedrock/image_edit/handler.py": { - "PLR0913": 4 - }, - "litellm/llms/bedrock/image_edit/stability_transformation.py": { - "C901": 1, - "PLR0913": 1 - }, - "litellm/llms/bedrock/image_generation/image_handler.py": { - "PLR0913": 4 - }, - "litellm/llms/bedrock/messages/invoke_transformations/anthropic_claude3_transformation.py": { - "ANN003": 1, - "C901": 2, - "PLR0913": 4 - }, - "litellm/llms/bedrock/messages/mantle_transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/bedrock/passthrough/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/bedrock/realtime/handler.py": { - "ANN003": 1, - "ANN401": 5, - "PLR0913": 2 - }, - "litellm/llms/bedrock/rerank/handler.py": { - "PLR0913": 1 - }, - "litellm/llms/bedrock/vector_stores/transformation.py": { - "ANN001": 1, - "PLR0913": 1 - }, - "litellm/llms/bedrock_mantle/chat/transformation.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/llms/bedrock_mantle/responses/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/black_forest_labs/image_edit/handler.py": { - "ANN401": 1, - "PLR0913": 4 - }, - "litellm/llms/black_forest_labs/image_edit/transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/black_forest_labs/image_generation/handler.py": { - "ANN401": 1, - "PLR0913": 4 - }, - "litellm/llms/black_forest_labs/image_generation/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/brave/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/bytez/chat/transformation.py": { - "ANN401": 2, - "PLR0913": 5 - }, - "litellm/llms/cerebras/chat.py": { - "PLR0913": 1 - }, - "litellm/llms/chatgpt/chat/streaming_utils.py": { - "ANN401": 4 - }, - "litellm/llms/chatgpt/chat/transformation.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/llms/chatgpt/common_utils.py": { - "ANN001": 2, - "ANN401": 3, - "PLR0913": 1 - }, - "litellm/llms/chatgpt/responses/transformation.py": { - "ANN401": 5 - }, - "litellm/llms/clarifai/chat/transformation.py": { - "ANN001": 5, - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/cloudflare/chat/transformation.py": { - "ANN001": 2, - "PLR0913": 3 - }, - "litellm/llms/codestral/completion/handler.py": { - "ANN001": 24, - "ANN002": 1, - "ANN003": 1, - "B006": 3, - "PLR0913": 5 - }, - "litellm/llms/codestral/completion/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/cohere/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/cohere/chat/v2_transformation.py": { - "ANN401": 1, - "PLR0913": 4 - }, - "litellm/llms/cohere/common_utils.py": { - "ANN001": 4, - "PLR0913": 1 - }, - "litellm/llms/cohere/embed/handler.py": { - "ANN001": 3, - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/cohere/embed/transformation.py": { - "ANN401": 2, - "PLR0913": 4 - }, - "litellm/llms/cohere/embed/v1_transformation.py": { - "ANN401": 3, - "PLR0913": 1 - }, - "litellm/llms/cohere/rerank/guardrail_translation/handler.py": { - "ANN401": 5 - }, - "litellm/llms/cohere/rerank/transformation.py": { - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/cohere/rerank_v2/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/cometapi/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/cometapi/embed/transformation.py": { - "PLR0913": 3 - }, - "litellm/llms/cometapi/image_generation/cost_calculator.py": { - "ANN401": 1 - }, - "litellm/llms/cometapi/image_generation/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/compactifai/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/custom_httpx/aiohttp_handler.py": { - "ANN001": 4, - "ANN401": 2, - "B006": 1, - "PLR0913": 7 - }, - "litellm/llms/custom_httpx/aiohttp_transport.py": { - "PLR0913": 1 - }, - "litellm/llms/custom_httpx/container_handler.py": { - "ANN003": 3, - "ANN401": 4, - "PLR0913": 3 - }, - "litellm/llms/custom_httpx/http_handler.py": { - "ANN001": 4, - "ANN401": 10, - "PLR0913": 10, - "PLW0603": 1 - }, - "litellm/llms/custom_httpx/httpx_handler.py": { - "ANN001": 1 - }, - "litellm/llms/custom_httpx/llm_http_handler.py": { - "ANN001": 48, - "ANN401": 29, - "PLR0913": 151 - }, - "litellm/llms/custom_llm.py": { - "ANN001": 32, - "ANN401": 8, - "B006": 4, - "PLR0913": 10 - }, - "litellm/llms/dashscope/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/dashscope/embed/transformation.py": { - "PLR0913": 3 - }, - "litellm/llms/dashscope/image_generation/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/dashscope/rerank/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/databricks/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 4 - }, - "litellm/llms/databricks/common_utils.py": { - "ANN401": 2, - "PLR0913": 1, - "RUF012": 1 - }, - "litellm/llms/databricks/embed/handler.py": { - "ANN001": 3, - "PLR0913": 1 - }, - "litellm/llms/databricks/streaming_utils.py": { - "ANN001": 1 - }, - "litellm/llms/dataforseo/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/datarobot/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/deepgram/audio_transcription/transformation.py": { - "ANN001": 1, - "PLR0913": 2 - }, - "litellm/llms/deepinfra/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/deepinfra/rerank/transformation.py": { - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/deepseek/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/deepseek/messages/transformation.py": { - "ANN401": 2, - "PLR0913": 2 - }, - "litellm/llms/deprecated_providers/aleph_alpha.py": { - "ANN001": 9, - "PLR0913": 2 - }, - "litellm/llms/deprecated_providers/palm.py": { - "ANN001": 7, - "PLR0913": 2 - }, - "litellm/llms/docker_model_runner/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/duckduckgo/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/elevenlabs/audio_transcription/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/elevenlabs/text_to_speech/transformation.py": { - "PLR0913": 1, - "RUF012": 2 - }, - "litellm/llms/exa_ai/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/fal_ai/cost_calculator.py": { - "ANN401": 1 - }, - "litellm/llms/fal_ai/image_generation/bria_transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/fal_ai/image_generation/bytedance_transformation.py": { - "ANN401": 2, - "RUF012": 1 - }, - "litellm/llms/fal_ai/image_generation/flux_pro_v11_transformation.py": { - "ANN401": 2, - "RUF012": 1 - }, - "litellm/llms/fal_ai/image_generation/flux_pro_v11_ultra_transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/fal_ai/image_generation/flux_schnell_transformation.py": { - "ANN401": 2, - "RUF012": 1 - }, - "litellm/llms/fal_ai/image_generation/ideogram_v3_transformation.py": { - "ANN401": 3, - "PLR0913": 1, - "RUF012": 1 - }, - "litellm/llms/fal_ai/image_generation/imagen4_transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/fal_ai/image_generation/nano_banana_transformation.py": { - "PLR0913": 1, - "RUF012": 1 - }, - "litellm/llms/fal_ai/image_generation/recraft_v3_transformation.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/llms/fal_ai/image_generation/stable_diffusion_transformation.py": { - "ANN401": 2, - "PLR0913": 2 - }, - "litellm/llms/fal_ai/image_generation/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/featherless_ai/chat/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/firecrawl/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/fireworks_ai/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/fireworks_ai/common_utils.py": { - "PLR0913": 1 - }, - "litellm/llms/fireworks_ai/rerank/transformation.py": { - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/gemini/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/gemini/common_utils.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/gemini/count_tokens/handler.py": { - "ANN003": 1, - "ANN401": 3 - }, - "litellm/llms/gemini/files/transformation.py": { - "ANN001": 1, - "PLR0913": 2 - }, - "litellm/llms/gemini/google_genai/transformation.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/llms/gemini/image_edit/cost_calculator.py": { - "ANN401": 1 - }, - "litellm/llms/gemini/image_edit/transformation.py": { - "ANN401": 1, - "PLR0913": 1, - "RUF012": 1 - }, - "litellm/llms/gemini/image_generation/cost_calculator.py": { - "ANN401": 1 - }, - "litellm/llms/gemini/image_generation/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/gemini/interactions/transformation.py": { - "C901": 1, - "PLR0913": 1 - }, - "litellm/llms/gemini/realtime/transformation.py": { - "ANN401": 3, - "C901": 1 - }, - "litellm/llms/gemini/vector_stores/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/gemini/videos/transformation.py": { - "ANN001": 35, - "PLR0913": 5, - "RUF012": 1 - }, - "litellm/llms/gigachat/chat/streaming.py": { - "ANN401": 1 - }, - "litellm/llms/gigachat/chat/transformation.py": { - "ANN401": 1, - "C901": 2, - "PLR0913": 3 - }, - "litellm/llms/gigachat/embedding/transformation.py": { - "PLR0913": 3 - }, - "litellm/llms/github_copilot/chat/transformation.py": { - "ANN001": 1, - "ANN401": 2, - "PLR0913": 2 - }, - "litellm/llms/github_copilot/common_utils.py": { - "ANN001": 2, - "PLR0913": 1 - }, - "litellm/llms/github_copilot/embedding/transformation.py": { - "ANN401": 2, - "PLR0913": 3 - }, - "litellm/llms/github_copilot/responses/transformation.py": { - "ANN401": 1 - }, - "litellm/llms/google_pse/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/gradient_ai/chat/transformation.py": { - "PLR0913": 3 - }, - "litellm/llms/groq/chat/handler.py": { - "ANN001": 5, - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/llms/groq/chat/transformation.py": { - "ANN401": 2, - "PLR0913": 2 - }, - "litellm/llms/groq/stt/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/heroku/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/hosted_vllm/embedding/transformation.py": { - "PLR0913": 3 - }, - "litellm/llms/hosted_vllm/rerank/transformation.py": { - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/hosted_vllm/transcriptions/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/huggingface/chat/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/huggingface/common_utils.py": { - "ANN001": 2 - }, - "litellm/llms/huggingface/embedding/handler.py": { - "ANN001": 1, - "ANN401": 1, - "B006": 1, - "PLR0913": 2 - }, - "litellm/llms/huggingface/embedding/transformation.py": { - "ANN401": 2, - "C901": 2, - "PLR0913": 4, - "PLW0603": 2 - }, - "litellm/llms/huggingface/rerank/transformation.py": { - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/infinity/common_utils.py": { - "B006": 1 - }, - "litellm/llms/infinity/embedding/transformation.py": { - "B006": 3, - "PLR0913": 3 - }, - "litellm/llms/infinity/rerank/transformation.py": { - "B006": 3, - "PLR0913": 1 - }, - "litellm/llms/jina_ai/common_utils.py": { - "ANN001": 2 - }, - "litellm/llms/jina_ai/embedding/transformation.py": { - "PLR0913": 3 - }, - "litellm/llms/jina_ai/rerank/transformation.py": { - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/langflow/chat/transformation.py": { - "ANN003": 1, - "ANN401": 1, - "PLR0913": 4 - }, - "litellm/llms/langgraph/chat/sse_iterator.py": { - "ANN001": 3 - }, - "litellm/llms/langgraph/chat/transformation.py": { - "ANN003": 1, - "ANN401": 1, - "PLR0913": 5 - }, - "litellm/llms/lemonade/chat/transformation.py": { - "ANN401": 3, - "PLR0913": 2 - }, - "litellm/llms/linkup/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/litellm_proxy/image_generation/transformation.py": { - "ANN001": 1, - "PLR0913": 2 - }, - "litellm/llms/litellm_proxy/skills/code_execution.py": { - "ANN003": 1 - }, - "litellm/llms/litellm_proxy/skills/handler.py": { - "ANN001": 1, - "ANN401": 1 - }, - "litellm/llms/litellm_proxy/skills/sandbox_executor.py": { - "ANN401": 1 - }, - "litellm/llms/litellm_proxy/skills/transformation.py": { - "ANN003": 4, - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/manus/files/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/maritalk.py": { - "PLR0913": 1 - }, - "litellm/llms/milvus/vector_stores/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/minimax/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/minimax/messages/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/minimax/text_to_speech/transformation.py": { - "PLR0913": 1, - "RUF012": 2 - }, - "litellm/llms/mistral/audio_transcription/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/mistral/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/mistral/ocr/guardrail_translation/handler.py": { - "ANN401": 5 - }, - "litellm/llms/mistral/ocr/transformation.py": { - "ANN003": 4, - "ANN401": 1 - }, - "litellm/llms/moonshot/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/nlp_cloud/chat/handler.py": { - "ANN001": 7, - "B006": 1, - "PLR0913": 1 - }, - "litellm/llms/nlp_cloud/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/novita/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/nvidia_nim/rerank/transformation.py": { - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/nvidia_riva/audio_transcription/handler.py": { - "ANN001": 1, - "ANN401": 4, - "PLR0913": 3 - }, - "litellm/llms/nvidia_riva/audio_transcription/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/nvidia_riva/common_utils.py": { - "ANN401": 2 - }, - "litellm/llms/oci/chat/cohere.py": { - "ANN401": 1 - }, - "litellm/llms/oci/chat/transformation.py": { - "ANN401": 3, - "PLR0913": 6 - }, - "litellm/llms/oci/common_utils.py": { - "ANN401": 9, - "PLR0913": 1 - }, - "litellm/llms/oci/embed/transformation.py": { - "PLR0913": 4 - }, - "litellm/llms/ollama/chat/transformation.py": { - "C901": 2, - "PLR0913": 4 - }, - "litellm/llms/ollama/common_utils.py": { - "ANN001": 5, - "PLR0913": 1 - }, - "litellm/llms/ollama/completion/handler.py": { - "ANN401": 6, - "PLR0913": 3 - }, - "litellm/llms/ollama/completion/transformation.py": { - "ANN001": 1, - "ANN401": 1, - "PLR0913": 4 - }, - "litellm/llms/oobabooga/chat/oobabooga.py": { - "ANN001": 7, - "ANN401": 1, - "B006": 1, - "PLR0913": 2 - }, - "litellm/llms/oobabooga/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/openai/chat/gpt_5_transformation.py": { - "C901": 1 - }, - "litellm/llms/openai/chat/gpt_transformation.py": { - "ANN401": 2, - "PLR0913": 4 - }, - "litellm/llms/openai/chat/guardrail_translation/handler.py": { - "ANN401": 8, - "C901": 1, - "PLR0913": 2 - }, - "litellm/llms/openai/common_utils.py": { - "PLR0913": 1 - }, - "litellm/llms/openai/completion/guardrail_translation/handler.py": { - "ANN401": 5 - }, - "litellm/llms/openai/completion/handler.py": { - "ANN001": 13, - "PLR0913": 4 - }, - "litellm/llms/openai/completion/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/openai/containers/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/openai/embeddings/guardrail_translation/handler.py": { - "ANN401": 7 - }, - "litellm/llms/openai/fine_tuning/handler.py": { - "ANN401": 1, - "PLR0913": 5 - }, - "litellm/llms/openai/image_edit/dalle2_transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/openai/image_edit/transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/openai/image_generation/dall_e_2_transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/openai/image_generation/dall_e_3_transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/openai/image_generation/gpt_transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/openai/image_generation/guardrail_translation/handler.py": { - "ANN401": 5 - }, - "litellm/llms/openai/image_variations/handler.py": { - "ANN001": 2, - "PLR0913": 2 - }, - "litellm/llms/openai/image_variations/transformation.py": { - "ANN401": 2, - "PLR0913": 2 - }, - "litellm/llms/openai/openai.py": { - "ANN001": 28, - "ANN401": 7, - "B006": 1, - "C901": 1, - "PLR0913": 47 - }, - "litellm/llms/openai/realtime/handler.py": { - "ANN401": 5, - "PLR0913": 1 - }, - "litellm/llms/openai/realtime/http_transformation.py": { - "ANN003": 2 - }, - "litellm/llms/openai/responses/count_tokens/handler.py": { - "PLR0913": 1 - }, - "litellm/llms/openai/responses/count_tokens/token_counter.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/openai/responses/count_tokens/transformation.py": { - "C901": 1 - }, - "litellm/llms/openai/responses/guardrail_translation/handler.py": { - "ANN401": 10, - "C901": 2, - "PLR0913": 1 - }, - "litellm/llms/openai/responses/transformation.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/openai/speech/guardrail_translation/handler.py": { - "ANN401": 5 - }, - "litellm/llms/openai/transcriptions/guardrail_translation/handler.py": { - "ANN401": 5 - }, - "litellm/llms/openai/transcriptions/handler.py": { - "ANN001": 3, - "PLR0913": 2 - }, - "litellm/llms/openai/transcriptions/whisper_transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/openai/vector_stores/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/openai/videos/transformation.py": { - "ANN401": 8, - "PLR0913": 5 - }, - "litellm/llms/openai_like/chat/handler.py": { - "ANN001": 21, - "ANN003": 1, - "B006": 3, - "PLR0913": 5 - }, - "litellm/llms/openai_like/chat/transformation.py": { - "ANN001": 2, - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/openai_like/common_utils.py": { - "ANN001": 2, - "ANN003": 1 - }, - "litellm/llms/openai_like/dynamic_config.py": { - "C901": 1, - "PLR0913": 1 - }, - "litellm/llms/openai_like/embedding/handler.py": { - "ANN001": 5, - "ANN003": 1, - "PLR0913": 2 - }, - "litellm/llms/openai_like/json_loader.py": { - "RUF012": 1 - }, - "litellm/llms/openrouter/chat/transformation.py": { - "ANN401": 3, - "PLR0913": 1 - }, - "litellm/llms/openrouter/embedding/transformation.py": { - "ANN401": 2, - "PLR0913": 3 - }, - "litellm/llms/openrouter/image_edit/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/openrouter/image_generation/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/ovhcloud/audio_transcription/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/ovhcloud/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/ovhcloud/embedding/transformation.py": { - "PLR0913": 3 - }, - "litellm/llms/parallel_ai/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/pass_through/guardrail_translation/handler.py": { - "ANN401": 4 - }, - "litellm/llms/perplexity/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/perplexity/embedding/transformation.py": { - "ANN401": 1, - "B006": 4, - "PLR0913": 3 - }, - "litellm/llms/perplexity/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/petals/completion/handler.py": { - "ANN001": 5, - "PLR0913": 1 - }, - "litellm/llms/petals/completion/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/pg_vector/vector_stores/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/predibase/chat/handler.py": { - "ANN001": 20, - "ANN002": 1, - "ANN003": 1, - "B006": 3, - "PLR0913": 4 - }, - "litellm/llms/predibase/chat/transformation.py": { - "ANN401": 1, - "C901": 1, - "PLR0913": 4 - }, - "litellm/llms/ragflow/chat/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/ragflow/vector_stores/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/recraft/cost_calculator.py": { - "ANN401": 1 - }, - "litellm/llms/recraft/image_edit/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/recraft/image_generation/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/reducto/common.py": { - "ANN401": 1 - }, - "litellm/llms/reducto/ocr/transformation.py": { - "ANN003": 7, - "ANN401": 1 - }, - "litellm/llms/replicate/chat/handler.py": { - "ANN001": 20, - "B006": 2, - "PLR0913": 2 - }, - "litellm/llms/replicate/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 4 - }, - "litellm/llms/runwayml/cost_calculator.py": { - "ANN401": 1 - }, - "litellm/llms/runwayml/image_generation/transformation.py": { - "ANN401": 2, - "PLR0913": 4 - }, - "litellm/llms/runwayml/text_to_speech/transformation.py": { - "ANN401": 2, - "B006": 1, - "PLR0913": 2, - "RUF012": 1 - }, - "litellm/llms/runwayml/videos/transformation.py": { - "ANN001": 34, - "PLR0913": 5 - }, - "litellm/llms/s3_vectors/vector_stores/transformation.py": { - "ANN001": 1, - "PLR0913": 2 - }, - "litellm/llms/sagemaker/chat/handler.py": { - "ANN001": 5, - "B006": 2, - "PLR0913": 2 - }, - "litellm/llms/sagemaker/chat/transformation.py": { - "ANN003": 1, - "PLR0913": 5 - }, - "litellm/llms/sagemaker/common_utils.py": { - "ANN001": 1 - }, - "litellm/llms/sagemaker/completion/handler.py": { - "ANN001": 18, - "ANN401": 2, - "B006": 3, - "PLR0913": 5 - }, - "litellm/llms/sagemaker/completion/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/sagemaker/embedding/cohere_transformation.py": { - "ANN401": 1, - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/sagemaker/embedding/transformation.py": { - "ANN401": 1, - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/sambanova/chat.py": { - "PLR0913": 1 - }, - "litellm/llms/sambanova/common_utils.py": { - "ANN001": 3 - }, - "litellm/llms/sambanova/embedding/transformation.py": { - "PLR0913": 3 - }, - "litellm/llms/sap/chat/models.py": { - "ANN003": 2 - }, - "litellm/llms/sap/chat/transformation.py": { - "ANN001": 2, - "ANN401": 1, - "PLR0913": 4 - }, - "litellm/llms/sap/credentials.py": { - "ANN001": 3, - "ANN003": 2, - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/sap/embed/transformation.py": { - "ANN001": 4, - "ANN002": 1, - "ANN003": 1, - "PLR0913": 2 - }, - "litellm/llms/scaleway/audio_transcription/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/searchapi/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/searxng/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/serper/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/snowflake/chat/transformation.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/snowflake/embedding/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/snowflake/utils.py": { - "ANN001": 2, - "PLR0913": 1 - }, - "litellm/llms/soniox/audio_transcription/handler.py": { - "ANN401": 1, - "PLR0913": 10 - }, - "litellm/llms/soniox/audio_transcription/transformation.py": { - "C901": 1, - "PLR0913": 2 - }, - "litellm/llms/stability/image_edit/transformations.py": { - "PLR0913": 1 - }, - "litellm/llms/stability/image_generation/transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/tavily/search/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/together_ai/cost_calculator.py": { - "ANN001": 2 - }, - "litellm/llms/together_ai/rerank/handler.py": { - "PLR0913": 1 - }, - "litellm/llms/topaz/common_utils.py": { - "PLR0913": 1 - }, - "litellm/llms/topaz/image_variations/transformation.py": { - "ANN401": 2, - "PLR0913": 3 - }, - "litellm/llms/triton/completion/transformation.py": { - "ANN401": 4, - "PLR0913": 5 - }, - "litellm/llms/triton/embedding/transformation.py": { - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/vercel_ai_gateway/embedding/transformation.py": { - "ANN401": 2, - "PLR0913": 3 - }, - "litellm/llms/vertex_ai/agent_engine/sse_iterator.py": { - "ANN401": 1 - }, - "litellm/llms/vertex_ai/agent_engine/transformation.py": { - "ANN003": 1, - "ANN401": 1, - "PLR0913": 5 - }, - "litellm/llms/vertex_ai/aws_credentials_supplier.py": { - "ANN001": 4 - }, - "litellm/llms/vertex_ai/batches/handler.py": { - "ANN002": 1, - "ANN003": 1, - "ANN401": 2, - "PLR0913": 4 - }, - "litellm/llms/vertex_ai/common_utils.py": { - "ANN001": 13, - "ANN401": 2, - "C901": 2, - "PLR0913": 3 - }, - "litellm/llms/vertex_ai/context_caching/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/vertex_ai/context_caching/vertex_ai_context_caching.py": { - "PLR0913": 5 - }, - "litellm/llms/vertex_ai/files/handler.py": { - "PLR0913": 4 - }, - "litellm/llms/vertex_ai/files/transformation.py": { - "ANN001": 1, - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/llms/vertex_ai/fine_tuning/handler.py": { - "B006": 3, - "PLR0913": 1 - }, - "litellm/llms/vertex_ai/gemini/transformation.py": { - "ANN401": 5, - "B006": 1, - "C901": 3, - "PLR0913": 4, - "PLW0603": 2 - }, - "litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py": { - "ANN001": 14, - "ANN401": 7, - "C901": 4, - "PLR0913": 10 - }, - "litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_handler.py": { - "ANN001": 8, - "ANN401": 2, - "B006": 1, - "PLR0913": 2 - }, - "litellm/llms/vertex_ai/google_genai/transformation.py": { - "ANN001": 1, - "ANN401": 3 - }, - "litellm/llms/vertex_ai/image_edit/cost_calculator.py": { - "ANN401": 1 - }, - "litellm/llms/vertex_ai/image_edit/vertex_gemini_transformation.py": { - "ANN401": 1, - "PLR0913": 1, - "RUF012": 1 - }, - "litellm/llms/vertex_ai/image_edit/vertex_imagen_transformation.py": { - "ANN401": 2, - "C901": 1, - "PLR0913": 1, - "RUF012": 1 - }, - "litellm/llms/vertex_ai/image_generation/image_generation_handler.py": { - "ANN001": 1, - "ANN401": 3, - "PLR0913": 2 - }, - "litellm/llms/vertex_ai/image_generation/vertex_gemini_transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/vertex_ai/image_generation/vertex_imagen_transformation.py": { - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/vertex_ai/multimodal_embeddings/embedding_handler.py": { - "ANN001": 8, - "B006": 2, - "PLR0913": 2 - }, - "litellm/llms/vertex_ai/multimodal_embeddings/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/vertex_ai/ocr/deepseek_transformation.py": { - "ANN003": 6 - }, - "litellm/llms/vertex_ai/ocr/transformation.py": { - "ANN003": 4 - }, - "litellm/llms/vertex_ai/rag_engine/ingestion.py": { - "ANN401": 3 - }, - "litellm/llms/vertex_ai/rerank/transformation.py": { - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py": { - "ANN001": 2, - "PLR0913": 1 - }, - "litellm/llms/vertex_ai/text_to_speech/transformation.py": { - "ANN401": 2, - "B006": 1, - "PLR0913": 2, - "RUF012": 2 - }, - "litellm/llms/vertex_ai/vector_stores/rag_api/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/vertex_ai/vector_stores/search_api/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/vertex_ai/vertex_ai_aws_wif.py": { - "ANN001": 3 - }, - "litellm/llms/vertex_ai/vertex_ai_non_gemini.py": { - "ANN001": 28, - "ANN003": 2, - "ANN401": 1, - "C901": 1, - "PLR0913": 3 - }, - "litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/experimental_pass_through/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/vertex_ai/vertex_ai_partner_models/anthropic/transformation.py": { - "ANN001": 2, - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/llms/vertex_ai/vertex_ai_partner_models/llama3/transformation.py": { - "ANN003": 1, - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/llms/vertex_ai/vertex_ai_partner_models/main.py": { - "ANN001": 12, - "PLR0913": 2 - }, - "litellm/llms/vertex_ai/vertex_embeddings/embedding_handler.py": { - "ANN001": 3, - "PLR0913": 2 - }, - "litellm/llms/vertex_ai/vertex_gemma_models/main.py": { - "ANN001": 7, - "PLR0913": 1 - }, - "litellm/llms/vertex_ai/vertex_gemma_models/transformation.py": { - "ANN001": 1, - "ANN401": 6, - "PLR0913": 3 - }, - "litellm/llms/vertex_ai/vertex_llm_base.py": { - "ANN001": 11, - "ANN401": 4, - "C901": 1, - "PLR0913": 4 - }, - "litellm/llms/vertex_ai/vertex_model_garden/main.py": { - "ANN001": 7, - "PLR0913": 1 - }, - "litellm/llms/vertex_ai/videos/transformation.py": { - "ANN001": 24, - "PLR0913": 5 - }, - "litellm/llms/vllm/common_utils.py": { - "PLR0913": 1 - }, - "litellm/llms/vllm/completion/handler.py": { - "ANN001": 9, - "B006": 2, - "PLR0913": 1, - "PLW0603": 1 - }, - "litellm/llms/vllm/passthrough/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/volcengine/chat/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/volcengine/embedding/transformation.py": { - "PLR0913": 3 - }, - "litellm/llms/volcengine/responses/transformation.py": { - "ANN401": 10, - "PLR0913": 1, - "RUF012": 1 - }, - "litellm/llms/voyage/embedding/transformation.py": { - "B006": 4, - "PLR0913": 3 - }, - "litellm/llms/voyage/embedding/transformation_contextual.py": { - "B006": 4, - "PLR0913": 3 - }, - "litellm/llms/voyage/rerank/transformation.py": { - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/watsonx/audio_transcription/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/watsonx/chat/handler.py": { - "ANN001": 4, - "ANN003": 1, - "B006": 1, - "PLR0913": 1 - }, - "litellm/llms/watsonx/chat/transformation.py": { - "ANN001": 1, - "PLR0913": 1 - }, - "litellm/llms/watsonx/common_utils.py": { - "ANN001": 3, - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/llms/watsonx/completion/transformation.py": { - "ANN003": 1, - "C901": 1, - "PLR0913": 3 - }, - "litellm/llms/watsonx/embed/transformation.py": { - "PLR0913": 2 - }, - "litellm/llms/watsonx/passthrough/transformation.py": { - "PLR0913": 1 - }, - "litellm/llms/watsonx/rerank/transformation.py": { - "B006": 3, - "PLR0913": 2 - }, - "litellm/llms/xai/chat/transformation.py": { - "ANN001": 2, - "ANN401": 1, - "PLR0913": 3 - }, - "litellm/llms/xai/common_utils.py": { - "PLR0913": 1 - }, - "litellm/llms/xai/oauth.py": { - "ANN401": 1 - }, - "litellm/llms/you_com/search/transformation.py": { - "ANN003": 4 - }, - "litellm/main.py": { - "ANN001": 38, - "ANN002": 9, - "ANN003": 24, - "ANN401": 6, - "B006": 5, - "C901": 6, - "PLR0913": 10, - "PLW0603": 2 - }, - "litellm/models/access_group.py": { - "RUF012": 5 - }, - "litellm/models/base.py": { - "ANN401": 1 - }, - "litellm/models/credentials.py": { - "ANN001": 1 - }, - "litellm/models/end_user.py": { - "ANN001": 1 - }, - "litellm/models/model.py": { - "ANN001": 1 - }, - "litellm/models/object_permission.py": { - "RUF012": 8 - }, - "litellm/models/organization.py": { - "RUF012": 2 - }, - "litellm/models/project.py": { - "RUF012": 1 - }, - "litellm/models/spend_logs.py": { - "RUF012": 2 - }, - "litellm/models/tag.py": { - "ANN001": 1, - "RUF012": 1 - }, - "litellm/models/team.py": { - "ANN001": 2, - "RUF012": 6 - }, - "litellm/models/user.py": { - "ANN001": 1, - "RUF012": 6 - }, - "litellm/models/verification_token.py": { - "RUF012": 9 - }, - "litellm/ocr/main.py": { - "ANN003": 2, - "PLR0913": 2 - }, - "litellm/passthrough/main.py": { - "ANN003": 2, - "ANN401": 4, - "PLR0913": 2 - }, - "litellm/proxy/_experimental/mcp_server/auth/litellm_auth_handler.py": { - "PLR0913": 1 - }, - "litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py": { - "ANN001": 4 - }, - "litellm/proxy/_experimental/mcp_server/byok_oauth_endpoints.py": { - "PLR0913": 4 - }, - "litellm/proxy/_experimental/mcp_server/db.py": { - "ANN401": 4, - "C901": 1, - "PLR0913": 1 - }, - "litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py": { - "ANN401": 1, - "C901": 1, - "PLR0913": 6 - }, - "litellm/proxy/_experimental/mcp_server/elicitation_handler.py": { - "ANN401": 5 - }, - "litellm/proxy/_experimental/mcp_server/guardrail_translation/handler.py": { - "ANN401": 4 - }, - "litellm/proxy/_experimental/mcp_server/mcp_debug.py": { - "PLR0913": 2 - }, - "litellm/proxy/_experimental/mcp_server/mcp_server_manager.py": { - "ANN001": 8, - "ANN401": 8, - "C901": 1, - "PLR0913": 8 - }, - "litellm/proxy/_experimental/mcp_server/oauth_utils.py": { - "ANN001": 2, - "ANN401": 1, - "PLW0603": 1 - }, - "litellm/proxy/_experimental/mcp_server/openapi_to_mcp_generator.py": { - "ANN401": 2, - "C901": 2 - }, - "litellm/proxy/_experimental/mcp_server/rest_endpoints.py": { - "ANN001": 11, - "PLR0913": 2 - }, - "litellm/proxy/_experimental/mcp_server/sampling_handler.py": { - "ANN401": 16, - "C901": 3, - "PLR0913": 1 - }, - "litellm/proxy/_experimental/mcp_server/semantic_tool_filter.py": { - "ANN001": 2 - }, - "litellm/proxy/_experimental/mcp_server/server.py": { - "ANN001": 4, - "ANN401": 5, - "C901": 3, - "PLR0913": 18, - "PLW0603": 10 - }, - "litellm/proxy/_experimental/mcp_server/toolset_db.py": { - "ANN001": 1 - }, - "litellm/proxy/_experimental/mcp_server/utils.py": { - "ANN401": 6 - }, - "litellm/proxy/_experimental/post_call_rules.py": { - "ANN001": 1 - }, - "litellm/proxy/_lazy_features.py": { - "ANN001": 1 - }, - "litellm/proxy/_lazy_openapi_snapshot.py": { - "ANN001": 1 - }, - "litellm/proxy/_logging.py": { - "ANN001": 1 - }, - "litellm/proxy/_types.py": { - "ANN001": 19, - "ANN003": 3, - "ANN401": 1, - "PLR0913": 1, - "RUF012": 46 - }, - "litellm/proxy/a2a/agent_card.py": { - "ANN401": 1 - }, - "litellm/proxy/agent_endpoints/a2a_endpoints.py": { - "ANN401": 12, - "C901": 1, - "PLR0913": 2 - }, - "litellm/proxy/agent_endpoints/a2a_routing.py": { - "ANN401": 1 - }, - "litellm/proxy/agent_endpoints/auth/agent_permission_handler.py": { - "ANN001": 1 - }, - "litellm/proxy/agent_endpoints/databricks_oauth.py": { - "ANN401": 1 - }, - "litellm/proxy/agent_endpoints/endpoints.py": { - "PLR0913": 1 - }, - "litellm/proxy/anthropic_endpoints/skills_endpoints.py": { - "PLR0913": 1 - }, - "litellm/proxy/auth/auth_checks.py": { - "ANN401": 4, - "C901": 2, - "PLR0913": 13 - }, - "litellm/proxy/auth/auth_exception_handler.py": { - "PLR0913": 1 - }, - "litellm/proxy/auth/auth_utils.py": { - "ANN001": 1, - "ANN401": 10, - "C901": 1 - }, - "litellm/proxy/auth/handle_jwt.py": { - "ANN401": 1, - "C901": 1, - "PLR0913": 9, - "RUF012": 1 - }, - "litellm/proxy/auth/ip_address_utils.py": { - "PLW0603": 1, - "RUF012": 1 - }, - "litellm/proxy/auth/litellm_license.py": { - "ANN001": 2 - }, - "litellm/proxy/auth/model_checks.py": { - "ANN001": 1, - "B006": 1, - "PLR0913": 1 - }, - "litellm/proxy/auth/rds_iam_token.py": { - "ANN001": 3, - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/proxy/auth/route_checks.py": { - "C901": 4 - }, - "litellm/proxy/auth/trusted_proxy_utils.py": { - "ANN401": 2 - }, - "litellm/proxy/auth/user_api_key_auth.py": { - "ANN001": 4, - "ANN401": 7, - "C901": 2, - "PLR0913": 9 - }, - "litellm/proxy/batches_endpoints/endpoints.py": { - "C901": 1, - "PLR0913": 1 - }, - "litellm/proxy/caching_routes.py": { - "ANN001": 1 - }, - "litellm/proxy/client/chat.py": { - "PLR0913": 2 - }, - "litellm/proxy/client/cli/commands/agents.py": { - "PLR0913": 1 - }, - "litellm/proxy/client/cli/commands/auth.py": { - "ANN001": 2, - "PLR0913": 1 - }, - "litellm/proxy/client/cli/commands/chat.py": { - "PLR0913": 1 - }, - "litellm/proxy/client/cli/commands/http.py": { - "PLR0913": 1 - }, - "litellm/proxy/client/cli/commands/keys.py": { - "PLR0913": 2 - }, - "litellm/proxy/client/cli/commands/models.py": { - "ANN001": 7 - }, - "litellm/proxy/client/cli/commands/users.py": { - "ANN001": 6, - "PLR0913": 1 - }, - "litellm/proxy/client/http_client.py": { - "ANN401": 2 - }, - "litellm/proxy/client/keys.py": { - "PLR0913": 3 - }, - "litellm/proxy/client/teams.py": { - "PLR0913": 1 - }, - "litellm/proxy/common_request_processing.py": { - "ANN001": 2, - "ANN003": 1, - "ANN401": 19, - "B006": 1, - "C901": 3, - "PLR0913": 6 - }, - "litellm/proxy/common_utils/cache_coordinator.py": { - "ANN401": 7 - }, - "litellm/proxy/common_utils/cache_pydantic_utils.py": { - "ANN401": 3 - }, - "litellm/proxy/common_utils/callback_utils.py": { - "ANN401": 11, - "C901": 1 - }, - "litellm/proxy/common_utils/custom_openapi_spec.py": { - "ANN001": 1, - "ANN401": 2, - "RUF012": 3 - }, - "litellm/proxy/common_utils/debug_utils.py": { - "ANN001": 5 - }, - "litellm/proxy/common_utils/expired_ui_session_key_cleanup_manager.py": { - "ANN001": 1 - }, - "litellm/proxy/common_utils/get_routes.py": { - "ANN401": 2 - }, - "litellm/proxy/common_utils/key_rotation_manager.py": { - "ANN001": 1 - }, - "litellm/proxy/common_utils/load_config_utils.py": { - "ANN001": 4 - }, - "litellm/proxy/common_utils/openapi_schema_compat.py": { - "ANN001": 3 - }, - "litellm/proxy/common_utils/performance_utils.py": { - "ANN001": 1, - "ANN002": 2, - "ANN003": 2, - "ANN401": 1, - "PLW0603": 4 - }, - "litellm/proxy/common_utils/proxy_rate_limit_error.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/proxy/common_utils/proxy_state.py": { - "ANN401": 2 - }, - "litellm/proxy/common_utils/reset_budget_job.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/proxy/common_utils/swagger_utils.py": { - "ANN001": 1 - }, - "litellm/proxy/common_utils/user_api_key_cache.py": { - "ANN001": 4, - "ANN003": 3, - "ANN401": 14 - }, - "litellm/proxy/container_endpoints/ownership.py": { - "ANN401": 11 - }, - "litellm/proxy/custom_prompt_management.py": { - "PLR0913": 1 - }, - "litellm/proxy/db/base_client.py": { - "ANN401": 2 - }, - "litellm/proxy/db/create_views.py": { - "C901": 1 - }, - "litellm/proxy/db/db_spend_update_writer.py": { - "ANN401": 4, - "C901": 3, - "PLR0913": 5 - }, - "litellm/proxy/db/db_transaction_queue/base_update_queue.py": { - "ANN001": 1 - }, - "litellm/proxy/db/db_transaction_queue/redis_update_buffer.py": { - "ANN401": 2, - "PLR0913": 2 - }, - "litellm/proxy/db/db_transaction_queue/spend_log_cleanup.py": { - "ANN001": 1 - }, - "litellm/proxy/db/db_transaction_queue/spend_logs_partition_manager.py": { - "ANN001": 4 - }, - "litellm/proxy/db/db_url_settings.py": { - "PLR0913": 1 - }, - "litellm/proxy/db/exception_handler.py": { - "ANN401": 3 - }, - "litellm/proxy/db/log_db_metrics.py": { - "ANN001": 1, - "ANN002": 1, - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/proxy/db/prisma_client.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/proxy/db/routing_prisma_wrapper.py": { - "ANN401": 10 - }, - "litellm/proxy/db/spend_counter_reseed.py": { - "PLR0913": 1 - }, - "litellm/proxy/db/spend_log_tool_index.py": { - "ANN401": 1 - }, - "litellm/proxy/db/tool_registry_writer.py": { - "ANN401": 1, - "PLW0603": 1 - }, - "litellm/proxy/fine_tuning_endpoints/endpoints.py": { - "ANN001": 1, - "PLR0913": 1, - "PLW0603": 1 - }, - "litellm/proxy/guardrails/_content_utils.py": { - "ANN401": 4, - "C901": 1 - }, - "litellm/proxy/guardrails/guardrail_endpoints.py": { - "ANN401": 15, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/aim/aim.py": { - "ANN001": 2, - "ANN003": 1, - "ANN401": 7 - }, - "litellm/proxy/guardrails/guardrail_hooks/akto/akto.py": { - "ANN001": 1, - "ANN401": 1, - "PLR0913": 1, - "RUF012": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/aporia_ai/aporia_ai.py": { - "ANN001": 1, - "ANN003": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/azure/base.py": { - "ANN401": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/azure/prompt_shield.py": { - "ANN003": 1, - "ANN401": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/azure/text_moderation.py": { - "ANN003": 1, - "ANN401": 5 - }, - "litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py": { - "ANN001": 3, - "ANN003": 1, - "ANN401": 5, - "C901": 2, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/block_code_execution/__init__.py": { - "ANN401": 2 - }, - "litellm/proxy/guardrails/guardrail_hooks/block_code_execution/block_code_execution.py": { - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/cato_networks/cato_networks.py": { - "ANN001": 1, - "ANN003": 1, - "ANN401": 14 - }, - "litellm/proxy/guardrails/guardrail_hooks/crowdstrike_aidr/crowdstrike_aidr.py": { - "ANN003": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/custom_code/custom_code_guardrail.py": { - "ANN401": 2 - }, - "litellm/proxy/guardrails/guardrail_hooks/custom_code/primitives.py": { - "ANN401": 9, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/custom_code/sandbox.py": { - "ANN401": 12 - }, - "litellm/proxy/guardrails/guardrail_hooks/custom_guardrail.py": { - "ANN001": 1, - "ANN003": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/dynamoai/dynamoai.py": { - "ANN001": 1, - "ANN003": 1, - "ANN401": 1, - "B006": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/enkryptai/enkryptai.py": { - "ANN001": 1, - "ANN003": 1, - "ANN401": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/generic_guardrail_api/generic_guardrail_api.py": { - "ANN003": 1, - "ANN401": 3, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/grayswan/__init__.py": { - "ANN001": 3 - }, - "litellm/proxy/guardrails/guardrail_hooks/grayswan/grayswan.py": { - "ANN001": 2, - "ANN401": 2, - "PLR0913": 1, - "RUF012": 2 - }, - "litellm/proxy/guardrails/guardrail_hooks/guardrails_ai/guardrails_ai.py": { - "ANN001": 1, - "ANN003": 1, - "ANN401": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/hiddenlayer/hiddenlayer.py": { - "ANN001": 3, - "ANN401": 3, - "C901": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/ibm_guardrails/ibm_detector.py": { - "ANN001": 1, - "ANN003": 1, - "ANN401": 1, - "C901": 1, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/javelin/javelin.py": { - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py": { - "ANN003": 1, - "C901": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/lakera_ai_v2.py": { - "ANN001": 1, - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py": { - "ANN001": 1, - "ANN003": 1, - "ANN401": 4, - "C901": 1, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/competitor_intent/base.py": { - "C901": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/content_filter.py": { - "ANN003": 1, - "ANN401": 1, - "C901": 3, - "PLR0913": 4 - }, - "litellm/proxy/guardrails/guardrail_hooks/litellm_content_filter/guardrail_benchmarks/test_eval.py": { - "ANN001": 31 - }, - "litellm/proxy/guardrails/guardrail_hooks/llm_as_a_judge/__init__.py": { - "ANN401": 4, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/mcp_end_user_permission/mcp_end_user_permission.py": { - "ANN003": 1, - "ANN401": 2 - }, - "litellm/proxy/guardrails/guardrail_hooks/mcp_jwt_signer/__init__.py": { - "ANN001": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/mcp_jwt_signer/mcp_jwt_signer.py": { - "ANN401": 2, - "PLR0913": 1, - "PLW0603": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/mcp_security/mcp_security_guardrail.py": { - "ANN003": 1, - "ANN401": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/microsoft_purview/base.py": { - "ANN401": 6 - }, - "litellm/proxy/guardrails/guardrail_hooks/microsoft_purview/purview_dlp.py": { - "ANN401": 10, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/model_armor/model_armor.py": { - "ANN001": 1, - "ANN003": 1, - "ANN401": 3, - "C901": 1, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/noma/noma.py": { - "ANN001": 1, - "ANN003": 1, - "ANN401": 2, - "PLR0913": 1, - "PLW0603": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/noma/noma_v2.py": { - "ANN401": 5 - }, - "litellm/proxy/guardrails/guardrail_hooks/onyx/onyx.py": { - "ANN003": 1, - "ANN401": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/openai/__init__.py": { - "ANN001": 3 - }, - "litellm/proxy/guardrails/guardrail_hooks/openai/moderations.py": { - "ANN003": 1, - "PLR0913": 3 - }, - "litellm/proxy/guardrails/guardrail_hooks/pangea/pangea.py": { - "ANN001": 1, - "ANN003": 1, - "ANN401": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/panw_prisma_airs/panw_prisma_airs.py": { - "ANN001": 3, - "ANN003": 1, - "ANN401": 5, - "C901": 3, - "PLR0913": 2, - "RUF012": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/pillar/__init__.py": { - "ANN001": 3 - }, - "litellm/proxy/guardrails/guardrail_hooks/pillar/pillar.py": { - "ANN003": 1, - "ANN401": 2, - "PLR0913": 1, - "RUF012": 2 - }, - "litellm/proxy/guardrails/guardrail_hooks/presidio.py": { - "ANN001": 1, - "ANN003": 1, - "ANN401": 11, - "C901": 2, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/prompt_security/prompt_security.py": { - "ANN003": 1, - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/promptguard/promptguard.py": { - "ANN401": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/qohash/qohash.py": { - "ANN003": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/qualifire/qualifire.py": { - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/semantic_guard/semantic_guard.py": { - "ANN001": 1, - "ANN003": 1, - "ANN401": 4, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/tool_permission.py": { - "ANN003": 1, - "ANN401": 7 - }, - "litellm/proxy/guardrails/guardrail_hooks/tool_policy/tool_policy_guardrail.py": { - "ANN401": 1, - "C901": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py": { - "ANN001": 1, - "ANN003": 1, - "ANN401": 3, - "C901": 1, - "PLW0603": 4 - }, - "litellm/proxy/guardrails/guardrail_hooks/vigil_guard/vigil_guard.py": { - "ANN401": 7 - }, - "litellm/proxy/guardrails/guardrail_hooks/xecguard/xecguard.py": { - "ANN401": 9, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_hooks/zscaler_ai_guard/zscaler_ai_guard.py": { - "ANN001": 12, - "ANN003": 3, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/guardrail_initializers.py": { - "ANN001": 2, - "ANN003": 1 - }, - "litellm/proxy/guardrails/usage_endpoints.py": { - "ANN401": 10, - "PLR0913": 1 - }, - "litellm/proxy/guardrails/usage_tracking.py": { - "C901": 1 - }, - "litellm/proxy/health_check.py": { - "ANN001": 2, - "PLR0913": 1 - }, - "litellm/proxy/health_endpoints/_health_endpoints.py": { - "ANN001": 16, - "ANN003": 1, - "C901": 1, - "PLR0913": 3, - "PLW0603": 4 - }, - "litellm/proxy/hooks/azure_content_safety.py": { - "ANN001": 6 - }, - "litellm/proxy/hooks/batch_rate_limiter.py": { - "ANN401": 2 - }, - "litellm/proxy/hooks/batch_redis_get.py": { - "ANN001": 1, - "ANN002": 1, - "ANN003": 1 - }, - "litellm/proxy/hooks/dynamic_rate_limiter.py": { - "ANN001": 1, - "C901": 1 - }, - "litellm/proxy/hooks/dynamic_rate_limiter_v3.py": { - "ANN001": 5, - "PLR0913": 1 - }, - "litellm/proxy/hooks/key_management_event_hooks.py": { - "ANN401": 2 - }, - "litellm/proxy/hooks/litellm_skills/main.py": { - "ANN003": 1, - "ANN401": 13 - }, - "litellm/proxy/hooks/max_budget_per_session_limiter.py": { - "ANN001": 4 - }, - "litellm/proxy/hooks/mcp_semantic_filter/hook.py": { - "ANN401": 1 - }, - "litellm/proxy/hooks/model_max_budget_limiter.py": { - "ANN001": 4 - }, - "litellm/proxy/hooks/parallel_request_limiter.py": { - "ANN001": 10, - "C901": 1, - "PLR0913": 2 - }, - "litellm/proxy/hooks/parallel_request_limiter_v3.py": { - "ANN001": 9, - "ANN401": 17, - "PLR0913": 1 - }, - "litellm/proxy/hooks/prompt_injection_detection.py": { - "ANN001": 1 - }, - "litellm/proxy/hooks/proxy_track_cost_callback.py": { - "ANN001": 7, - "ANN401": 6, - "C901": 1, - "PLR0913": 1 - }, - "litellm/proxy/hooks/responses_id_security.py": { - "ANN401": 2 - }, - "litellm/proxy/hooks/user_management_event_hooks.py": { - "PLR0913": 1 - }, - "litellm/proxy/image_endpoints/endpoints.py": { - "PLR0913": 1 - }, - "litellm/proxy/litellm_pre_call_utils.py": { - "ANN001": 2, - "ANN401": 4, - "C901": 2, - "PLR0913": 1, - "PLW0603": 1 - }, - "litellm/proxy/management_endpoints/access_group_endpoints.py": { - "ANN001": 15 - }, - "litellm/proxy/management_endpoints/cache_settings_endpoints.py": { - "ANN001": 2 - }, - "litellm/proxy/management_endpoints/common_daily_activity.py": { - "ANN401": 3, - "C901": 2, - "PLR0913": 5 - }, - "litellm/proxy/management_endpoints/common_utils.py": { - "ANN001": 1, - "ANN401": 3, - "PLR0913": 1 - }, - "litellm/proxy/management_endpoints/config_override_endpoints.py": { - "ANN401": 2 - }, - "litellm/proxy/management_endpoints/cost_tracking_settings.py": { - "ANN001": 5, - "C901": 1 - }, - "litellm/proxy/management_endpoints/customer_endpoints.py": { - "ANN001": 1, - "C901": 1, - "PLR0913": 1 - }, - "litellm/proxy/management_endpoints/internal_user_endpoints.py": { - "ANN001": 2, - "ANN401": 15, - "C901": 2, - "PLR0913": 5 - }, - "litellm/proxy/management_endpoints/jwt_key_mapping_endpoints.py": { - "ANN001": 1 - }, - "litellm/proxy/management_endpoints/key_management_endpoints.py": { - "ANN401": 13, - "B006": 7, - "C901": 6, - "PLR0913": 9 - }, - "litellm/proxy/management_endpoints/mcp_management_endpoints.py": { - "ANN001": 1, - "ANN401": 3, - "C901": 1, - "PLR0913": 2, - "PLW0603": 1 - }, - "litellm/proxy/management_endpoints/model_access_group_management_endpoints.py": { - "ANN001": 1 - }, - "litellm/proxy/management_endpoints/model_management_endpoints.py": { - "ANN002": 1, - "ANN003": 1, - "ANN401": 4, - "C901": 1, - "PLR0913": 1 - }, - "litellm/proxy/management_endpoints/organization_endpoints.py": { - "PLR0913": 1 - }, - "litellm/proxy/management_endpoints/policy_endpoints/endpoints.py": { - "ANN401": 3, - "PLR0913": 1 - }, - "litellm/proxy/management_endpoints/scim/scim_v2.py": { - "ANN001": 4, - "ANN401": 9, - "C901": 2 - }, - "litellm/proxy/management_endpoints/sso/custom_microsoft_sso.py": { - "PLR0913": 1 - }, - "litellm/proxy/management_endpoints/tag_management_endpoints.py": { - "ANN001": 4, - "PLR0913": 1 - }, - "litellm/proxy/management_endpoints/team_callback_endpoints.py": { - "ANN401": 4 - }, - "litellm/proxy/management_endpoints/team_endpoints.py": { - "ANN001": 5, - "ANN401": 23, - "C901": 7, - "PLR0913": 8 - }, - "litellm/proxy/management_endpoints/tool_management_endpoints.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/proxy/management_endpoints/types.py": { - "ANN001": 1 - }, - "litellm/proxy/management_endpoints/ui_sso.py": { - "ANN001": 5, - "ANN401": 22, - "C901": 2, - "PLR0913": 7 - }, - "litellm/proxy/management_endpoints/usage_endpoints/ai_usage_chat.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/proxy/management_endpoints/workflow_management_endpoints.py": { - "ANN401": 4 - }, - "litellm/proxy/management_helpers/audit_logs.py": { - "PLR0913": 1 - }, - "litellm/proxy/management_helpers/object_permission_utils.py": { - "ANN401": 1 - }, - "litellm/proxy/management_helpers/utils.py": { - "ANN001": 6, - "ANN002": 1, - "ANN003": 1, - "ANN401": 5, - "PLR0913": 2 - }, - "litellm/proxy/memory/memory_endpoints.py": { - "ANN401": 8 - }, - "litellm/proxy/middleware/in_flight_requests_middleware.py": { - "ANN401": 1 - }, - "litellm/proxy/openai_evals_endpoints/endpoints.py": { - "PLR0913": 5 - }, - "litellm/proxy/openai_files_endpoints/common_utils.py": { - "ANN001": 24, - "PLR0913": 2 - }, - "litellm/proxy/openai_files_endpoints/file_content_streaming_handler.py": { - "PLR0913": 2 - }, - "litellm/proxy/openai_files_endpoints/files_endpoints.py": { - "ANN001": 1, - "C901": 1, - "PLR0913": 3, - "PLW0603": 1 - }, - "litellm/proxy/openai_files_endpoints/storage_backend_service.py": { - "PLR0913": 2 - }, - "litellm/proxy/pass_through_endpoints/llm_passthrough_endpoints.py": { - "ANN001": 3, - "ANN401": 4, - "PLR0913": 5 - }, - "litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py": { - "ANN003": 3, - "C901": 1, - "PLR0913": 4 - }, - "litellm/proxy/pass_through_endpoints/llm_provider_handlers/assembly_passthrough_logging_handler.py": { - "ANN003": 2, - "PLR0913": 2 - }, - "litellm/proxy/pass_through_endpoints/llm_provider_handlers/base_passthrough_logging_handler.py": { - "ANN003": 1, - "PLR0913": 3 - }, - "litellm/proxy/pass_through_endpoints/llm_provider_handlers/cohere_passthrough_logging_handler.py": { - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/proxy/pass_through_endpoints/llm_provider_handlers/cursor_passthrough_logging_handler.py": { - "ANN003": 1, - "PLR0913": 1 - }, - "litellm/proxy/pass_through_endpoints/llm_provider_handlers/gemini_passthrough_logging_handler.py": { - "ANN003": 1, - "PLR0913": 3 - }, - "litellm/proxy/pass_through_endpoints/llm_provider_handlers/openai_passthrough_logging_handler.py": { - "ANN003": 1, - "PLR0913": 2 - }, - "litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_ai_live_passthrough_logging_handler.py": { - "ANN001": 1, - "ANN002": 1, - "ANN003": 2, - "C901": 1, - "PLR0913": 1 - }, - "litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py": { - "ANN003": 3, - "PLR0913": 4 - }, - "litellm/proxy/pass_through_endpoints/managed_id_rewriter.py": { - "ANN401": 25, - "PLR0913": 4 - }, - "litellm/proxy/pass_through_endpoints/pass_through_endpoints.py": { - "ANN001": 2, - "ANN003": 1, - "ANN401": 1, - "C901": 3, - "PLR0913": 8 - }, - "litellm/proxy/pass_through_endpoints/streaming_handler.py": { - "PLR0913": 3 - }, - "litellm/proxy/pass_through_endpoints/success_handler.py": { - "ANN003": 3, - "PLR0913": 3 - }, - "litellm/proxy/policy_engine/attachment_registry.py": { - "PLW0603": 1 - }, - "litellm/proxy/policy_engine/pipeline_executor.py": { - "ANN401": 2, - "PLR0913": 1 - }, - "litellm/proxy/policy_engine/policy_registry.py": { - "ANN401": 1, - "PLW0603": 1 - }, - "litellm/proxy/post_call_rules.py": { - "ANN001": 1 - }, - "litellm/proxy/prompts/prompt_endpoints.py": { - "ANN001": 2, - "ANN401": 1 - }, - "litellm/proxy/proxy_cli.py": { - "ANN001": 50, - "C901": 1, - "PLR0913": 5 - }, - "litellm/proxy/proxy_server.py": { - "ANN001": 46, - "ANN002": 1, - "ANN003": 2, - "ANN401": 16, - "B006": 1, - "C901": 15, - "PLR0913": 10, - "PLW0603": 70, - "RUF012": 1 - }, - "litellm/proxy/public_endpoints/public_endpoints.py": { - "PLW0603": 1 - }, - "litellm/proxy/rag_endpoints/endpoints.py": { - "ANN001": 1, - "ANN401": 5, - "PLR0913": 1 - }, - "litellm/proxy/response_api_endpoints/endpoints.py": { - "ANN001": 4, - "ANN401": 2 - }, - "litellm/proxy/response_polling/background_streaming.py": { - "ANN001": 10, - "C901": 1, - "PLR0913": 1 - }, - "litellm/proxy/response_polling/polling_handler.py": { - "ANN001": 3, - "ANN401": 1, - "C901": 1, - "PLR0913": 2 - }, - "litellm/proxy/route_llm_request.py": { - "ANN401": 1, - "C901": 1, - "PLW0603": 1 - }, - "litellm/proxy/search_endpoints/search_tool_registry.py": { - "ANN001": 1 - }, - "litellm/proxy/spend_tracking/budget_reservation.py": { - "ANN401": 11, - "PLR0913": 2 - }, - "litellm/proxy/spend_tracking/spend_log_error_logger.py": { - "ANN401": 1 - }, - "litellm/proxy/spend_tracking/spend_management_endpoints.py": { - "ANN001": 6, - "C901": 3, - "PLR0913": 4 - }, - "litellm/proxy/spend_tracking/spend_tracking_utils.py": { - "ANN001": 4, - "ANN401": 6, - "C901": 1, - "PLR0913": 1 - }, - "litellm/proxy/types_utils/utils.py": { - "ANN401": 2 - }, - "litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py": { - "ANN401": 2, - "PLW0603": 2 - }, - "litellm/proxy/utils.py": { - "ANN001": 27, - "ANN002": 1, - "ANN003": 6, - "ANN401": 29, - "B006": 1, - "C901": 3, - "PLR0913": 8, - "RUF012": 1 - }, - "litellm/proxy/vector_store_endpoints/endpoints.py": { - "PLR0913": 1 - }, - "litellm/proxy/vector_store_endpoints/management_endpoints.py": { - "ANN001": 5, - "ANN401": 3, - "C901": 1, - "PLR0913": 1, - "PLW0603": 1 - }, - "litellm/proxy/vector_store_files_endpoints/endpoints.py": { - "ANN001": 1, - "C901": 1 - }, - "litellm/proxy/video_endpoints/utils.py": { - "ANN401": 3 - }, - "litellm/proxy_auth/credentials.py": { - "ANN401": 1 - }, - "litellm/rag/__init__.py": { - "ANN002": 2, - "ANN003": 2 - }, - "litellm/rag/ingestion/bedrock_ingestion.py": { - "ANN401": 2 - }, - "litellm/rag/ingestion/gemini_ingestion.py": { - "PLR0913": 2 - }, - "litellm/rag/ingestion/s3_vectors_ingestion.py": { - "ANN401": 1 - }, - "litellm/rag/main.py": { - "ANN003": 5, - "PLR0913": 2 - }, - "litellm/rag/rag_query.py": { - "ANN401": 4 - }, - "litellm/realtime_api/main.py": { - "ANN003": 3, - "ANN401": 2, - "PLR0913": 2 - }, - "litellm/repositories/base_repository.py": { - "ANN401": 5 - }, - "litellm/repositories/budget_repository.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/repositories/config_repository.py": { - "ANN401": 6, - "RUF012": 1 - }, - "litellm/repositories/credentials_repository.py": { - "ANN401": 8 - }, - "litellm/repositories/model_repository.py": { - "ANN401": 3, - "PLR0913": 2 - }, - "litellm/repositories/object_permission_repository.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/repositories/organization_repository.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/repositories/project_repository.py": { - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/repositories/table_repositories.py": { - "ANN401": 3 - }, - "litellm/repositories/team_repository.py": { - "ANN401": 3, - "C901": 2, - "PLR0913": 2 - }, - "litellm/repositories/user_repository.py": { - "ANN401": 2, - "C901": 2, - "PLR0913": 2 - }, - "litellm/repositories/verification_token_repository.py": { - "ANN401": 3, - "C901": 1, - "PLR0913": 3 - }, - "litellm/rerank_api/main.py": { - "ANN003": 2, - "C901": 1, - "PLR0913": 2 - }, - "litellm/rerank_api/rerank_utils.py": { - "PLR0913": 1 - }, - "litellm/responses/file_search/emulated_handler.py": { - "ANN001": 3, - "ANN003": 1, - "ANN401": 10 - }, - "litellm/responses/litellm_completion_transformation/handler.py": { - "ANN003": 2, - "PLR0913": 1 - }, - "litellm/responses/litellm_completion_transformation/streaming_iterator.py": { - "ANN001": 1, - "C901": 1, - "PLR0913": 1 - }, - "litellm/responses/litellm_completion_transformation/transformation.py": { - "ANN003": 1, - "ANN401": 18, - "C901": 3, - "PLR0913": 1 - }, - "litellm/responses/main.py": { - "ANN003": 14, - "ANN401": 6, - "PLR0913": 16 - }, - "litellm/responses/mcp/chat_completions_handler.py": { - "ANN001": 17, - "ANN401": 1, - "C901": 1, - "PLR0913": 1 - }, - "litellm/responses/mcp/litellm_proxy_mcp_handler.py": { - "ANN001": 1, - "ANN003": 2, - "ANN401": 14, - "C901": 2, - "PLR0913": 2 - }, - "litellm/responses/mcp/mcp_streaming_iterator.py": { - "ANN401": 3, - "PLR0913": 2 - }, - "litellm/responses/streaming_iterator.py": { - "ANN001": 5, - "ANN401": 26, - "C901": 1, - "PLR0913": 7 - }, - "litellm/responses/utils.py": { - "ANN401": 9, - "C901": 1 - }, - "litellm/router.py": { - "ANN001": 20, - "ANN002": 4, - "ANN003": 69, - "ANN401": 17, - "B006": 7, - "C901": 14, - "PLR0913": 8, - "RUF012": 2 - }, - "litellm/router_strategy/adaptive_router/adaptive_router.py": { - "ANN401": 1 - }, - "litellm/router_strategy/adaptive_router/hooks.py": { - "ANN001": 8, - "ANN401": 4 - }, - "litellm/router_strategy/adaptive_router/update_queue.py": { - "ANN401": 2 - }, - "litellm/router_strategy/auto_router/auto_router.py": { - "PLR0913": 1 - }, - "litellm/router_strategy/auto_router/litellm_encoder.py": { - "ANN003": 7 - }, - "litellm/router_strategy/budget_limiter.py": { - "ANN001": 4, - "ANN401": 4, - "PLR0913": 1 - }, - "litellm/router_strategy/complexity_router/complexity_router.py": { - "PLR0913": 1 - }, - "litellm/router_strategy/least_busy.py": { - "ANN001": 19 - }, - "litellm/router_strategy/lowest_cost.py": { - "ANN001": 8, - "B006": 1, - "C901": 1 - }, - "litellm/router_strategy/lowest_latency.py": { - "ANN001": 12, - "B006": 1, - "C901": 3, - "PLR0913": 1 - }, - "litellm/router_strategy/lowest_tpm_rpm.py": { - "ANN001": 8, - "B006": 1, - "C901": 1 - }, - "litellm/router_strategy/lowest_tpm_rpm_v2.py": { - "ANN001": 8, - "B006": 1, - "C901": 1, - "PLR0913": 1 - }, - "litellm/router_strategy/quality_router/quality_router.py": { - "ANN401": 3 - }, - "litellm/router_strategy/tag_based_routing.py": { - "ANN401": 1 - }, - "litellm/router_utils/add_retry_fallback_headers.py": { - "ANN401": 6 - }, - "litellm/router_utils/cooldown_cache.py": { - "ANN001": 2 - }, - "litellm/router_utils/cooldown_handlers.py": { - "ANN401": 4 - }, - "litellm/router_utils/fallback_event_handlers.py": { - "ANN003": 1, - "ANN401": 1, - "PLR0913": 1 - }, - "litellm/router_utils/handle_error.py": { - "ANN001": 1 - }, - "litellm/router_utils/health_state_cache.py": { - "ANN401": 1 - }, - "litellm/router_utils/pre_call_checks/deployment_affinity_check.py": { - "C901": 2, - "PLR0913": 1 - }, - "litellm/router_utils/pre_call_checks/encrypted_content_affinity_check.py": { - "ANN401": 3 - }, - "litellm/router_utils/pre_call_checks/model_rate_limit_check.py": { - "ANN001": 8 - }, - "litellm/router_utils/pre_call_checks/prompt_caching_deployment_check.py": { - "ANN001": 4 - }, - "litellm/router_utils/prompt_caching_cache.py": { - "ANN401": 2 - }, - "litellm/router_utils/search_api_router.py": { - "ANN003": 2, - "ANN401": 4 - }, - "litellm/search/main.py": { - "ANN003": 2, - "PLR0913": 2 - }, - "litellm/secret_managers/aws_secret_manager.py": { - "ANN401": 1 - }, - "litellm/secret_managers/aws_secret_manager_v2.py": { - "ANN003": 1, - "ANN401": 1, - "PLR0913": 2 - }, - "litellm/secret_managers/base_secret_manager.py": { - "PLR0913": 1 - }, - "litellm/secret_managers/cyberark_secret_manager.py": { - "PLR0913": 1 - }, - "litellm/secret_managers/hashicorp_secret_manager.py": { - "PLR0913": 1 - }, - "litellm/secret_managers/main.py": { - "C901": 1 - }, - "litellm/secret_managers/secret_manager_handler.py": { - "ANN001": 1, - "ANN401": 2, - "C901": 1 - }, - "litellm/skills/main.py": { - "ANN003": 8, - "ANN401": 1, - "PLR0913": 4, - "PLW0603": 1 - }, - "litellm/timeout.py": { - "ANN001": 2, - "ANN002": 2, - "ANN003": 2 - }, - "litellm/utils.py": { - "ANN001": 104, - "ANN002": 4, - "ANN003": 9, - "ANN401": 8, - "B006": 3, - "C901": 13, - "PLR0913": 9, - "PLW0603": 13 - }, - "litellm/vector_store_files/main.py": { - "ANN003": 12, - "PLR0913": 6 - }, - "litellm/vector_store_files/utils.py": { - "ANN401": 1 - }, - "litellm/vector_stores/main.py": { - "ANN003": 12, - "PLR0913": 12 - }, - "litellm/vector_stores/vector_store_registry.py": { - "B006": 3 - }, - "litellm/videos/main.py": { - "ANN001": 24, - "ANN003": 14, - "ANN401": 10, - "PLR0913": 18 - } -} diff --git a/scripts/ruff_strict_gate.py b/scripts/ruff_strict_gate.py new file mode 100644 index 000000000000..72351aa44c83 --- /dev/null +++ b/scripts/ruff_strict_gate.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python3 +"""Drift-proof gate for the strict ruff rules in ruff-strict.toml. + +Runs ruff on the current tree, keeps only the violations that land on lines this +change added relative to a base ref, and fails when a rule's count of new +violations exceeds its allowance in ruff-strict-budget.json. Because the base is +measured live, anything that merged into the base does not count against the +change; only what this change introduces is gated. +""" + +import argparse +import json +import re +import subprocess +import sys +from collections import defaultdict +from pathlib import Path +from typing import NamedTuple + +REPO_ROOT = Path(__file__).resolve().parent.parent +STRICT_CONFIG = REPO_ROOT / "ruff-strict.toml" +BUDGET_PATH = REPO_ROOT / "ruff-strict-budget.json" +TARGET = "litellm" +DEFAULT_BASE = "origin/litellm_internal_staging" + +_HUNK = re.compile(r"^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@") + + +class Violation(NamedTuple): + file: str + line: int + code: str + + +class GateResult(NamedTuple): + ok: bool + by_rule: dict + breaches: dict + + +def _run(cmd: list) -> str: + proc = subprocess.run(cmd, cwd=REPO_ROOT, capture_output=True, text=True) + if proc.returncode not in (0, 1): + sys.stderr.write(proc.stderr) + raise SystemExit(f"{cmd[0]} exited {proc.returncode}") + return proc.stdout + + +def parse_changed_lines(diff_text: str) -> dict: + changed: dict = defaultdict(set) + path = None + for line in diff_text.splitlines(): + if line.startswith("+++ b/"): + path = line[6:] + elif path and (match := _HUNK.match(line)): + start = int(match.group(1)) + count = int(match.group(2)) if match.group(2) is not None else 1 + changed[path].update(range(start, start + count)) + return changed + + +def head_violations() -> list: + raw = _run( + [ + "ruff", + "check", + TARGET, + "--config", + str(STRICT_CONFIG), + "--output-format", + "json", + ] + ) + out = [] + for item in json.loads(raw or "[]"): + name = Path(item["filename"]) + rel = ( + (name if name.is_absolute() else REPO_ROOT / name) + .resolve() + .relative_to(REPO_ROOT) + .as_posix() + ) + out.append(Violation(rel, item["location"]["row"], item["code"])) + return out + + +def introduced(violations: list, changed: dict) -> list: + return [v for v in violations if v.line in changed.get(v.file, set())] + + +def evaluate(introduced_violations: list, allowances: dict) -> GateResult: + by_rule: dict = defaultdict(int) + for violation in introduced_violations: + by_rule[violation.code] += 1 + breaches = { + code: count + for code, count in by_rule.items() + if count > allowances.get(code, 0) + } + return GateResult(not breaches, dict(by_rule), breaches) + + +def cmd_check(base: str) -> None: + allowances = json.loads(BUDGET_PATH.read_text()) + base_point = _run(["git", "merge-base", base, "HEAD"]).strip() or base + diff = _run(["git", "diff", base_point, "--unified=0", "--no-color", "--", TARGET]) + new = introduced(head_violations(), parse_changed_lines(diff)) + result = evaluate(new, allowances) + if result.ok: + print( + f"OK: this change introduces {sum(result.by_rule.values())} strict-rule violation(s), all within budget (base {base})" + ) + return + print( + f"FAIL: this change introduces strict-rule violations over budget (base {base}):" + ) + for code, count in sorted(result.breaches.items()): + print(f" {code}: +{count} (allowed {allowances.get(code, 0)})") + for violation in sorted(new): + if violation.code in result.breaches: + print(f" {violation.file}:{violation.line} {violation.code}") + print( + "Type the new code, reduce complexity/arg count, or add `# noqa: ` on a justified line." + ) + raise SystemExit(1) + + +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--base", default=DEFAULT_BASE) + cmd_check(parser.parse_args().base) + + +if __name__ == "__main__": + main() diff --git a/scripts/ruff_suppressions.py b/scripts/ruff_suppressions.py deleted file mode 100644 index 593c55dcf9f9..000000000000 --- a/scripts/ruff_suppressions.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/env python3 -"""Budget gate for the strict ruff rules defined in ruff-strict.toml. - -`update` regenerates ruff-suppressions.json from the current tree. -`check` fails when the total strict-rule violation count grows past the -grandfathered baseline plus a small slack margin. -""" - -import argparse -import json -import math -import subprocess -import sys -from collections import defaultdict -from pathlib import Path -from typing import NamedTuple - -REPO_ROOT = Path(__file__).resolve().parent.parent -STRICT_CONFIG = REPO_ROOT / "ruff-strict.toml" -BASELINE_PATH = REPO_ROOT / "ruff-suppressions.json" -TARGET = "litellm" -SLACK_RATIO = 0.005 - - -def current_counts() -> dict: - proc = subprocess.run( - [ - "ruff", - "check", - TARGET, - "--config", - str(STRICT_CONFIG), - "--output-format", - "json", - ], - cwd=REPO_ROOT, - capture_output=True, - text=True, - ) - if proc.returncode not in (0, 1): - sys.stderr.write(proc.stderr) - raise SystemExit(f"ruff exited {proc.returncode}") - counts: dict = defaultdict(lambda: defaultdict(int)) - for violation in json.loads(proc.stdout or "[]"): - raw = Path(violation["filename"]) - path = ( - (raw if raw.is_absolute() else REPO_ROOT / raw) - .resolve() - .relative_to(REPO_ROOT) - .as_posix() - ) - counts[path][violation["code"]] += 1 - return {path: dict(rules) for path, rules in counts.items()} - - -def total(counts: dict) -> int: - return sum(n for rules in counts.values() for n in rules.values()) - - -class BudgetResult(NamedTuple): - ok: bool - current: int - baseline: int - slack: int - ceiling: int - regressions: list - - -def evaluate_budget( - baseline: dict, counts: dict, slack_ratio: float = SLACK_RATIO -) -> BudgetResult: - base_total, cur_total = total(baseline), total(counts) - slack = math.ceil(base_total * slack_ratio) - ceiling = base_total + slack - regressions = [] - for path in sorted(set(counts) | set(baseline)): - cur, base = counts.get(path, {}), baseline.get(path, {}) - for code in sorted(set(cur) | set(base)): - grew = cur.get(code, 0) - base.get(code, 0) - if grew > 0: - regressions.append((path, code, base.get(code, 0), cur.get(code, 0))) - return BudgetResult( - cur_total <= ceiling, cur_total, base_total, slack, ceiling, regressions - ) - - -def write_baseline(counts: dict) -> None: - BASELINE_PATH.write_text(json.dumps(counts, indent=2, sort_keys=True) + "\n") - - -def cmd_update() -> None: - counts = current_counts() - write_baseline(counts) - print( - f"Wrote {BASELINE_PATH.name}: {total(counts)} violations across {len(counts)} files" - ) - - -def _print_regressions(regressions: list) -> None: - for path, code, before, after in regressions: - print(f" {path}: {code} {before} -> {after} (+{after - before})") - - -def cmd_check() -> None: - if not BASELINE_PATH.exists(): - raise SystemExit( - f"{BASELINE_PATH.name} missing; run: python scripts/ruff_suppressions.py update" - ) - result = evaluate_budget(json.loads(BASELINE_PATH.read_text()), current_counts()) - if result.ok: - print( - f"OK: {result.current} strict-rule violations (baseline {result.baseline}, ceiling {result.ceiling}, headroom {result.ceiling - result.current})" - ) - if result.regressions: - print( - f"warning: {len(result.regressions)} per-file regression(s) absorbed by slack (offset by fixes elsewhere):" - ) - _print_regressions(result.regressions) - return - print( - f"FAIL: {result.current} strict-rule violations exceeds ceiling {result.ceiling} (baseline {result.baseline} + {SLACK_RATIO:.1%} slack = {result.slack})" - ) - _print_regressions(result.regressions) - print( - "Fix the new violations, add `# noqa: ` on a justified line, or re-baseline with `make lint-suppressions-update`." - ) - raise SystemExit(1) - - -def main() -> None: - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("mode", choices=["check", "update"]) - {"check": cmd_check, "update": cmd_update}[parser.parse_args().mode]() - - -if __name__ == "__main__": - main() diff --git a/tests/test_litellm/test_ruff_strict_gate.py b/tests/test_litellm/test_ruff_strict_gate.py new file mode 100644 index 000000000000..e35408e691ef --- /dev/null +++ b/tests/test_litellm/test_ruff_strict_gate.py @@ -0,0 +1,96 @@ +import importlib.util +from pathlib import Path + +import pytest + +_MODULE_PATH = Path(__file__).resolve().parents[2] / "scripts" / "ruff_strict_gate.py" +_spec = importlib.util.spec_from_file_location("ruff_strict_gate", _MODULE_PATH) +gate = importlib.util.module_from_spec(_spec) +_spec.loader.exec_module(gate) + +Violation = gate.Violation + + +def v(file, line, code): + return Violation(file, line, code) + + +def test_parse_changed_lines_maps_added_lines_per_file(): + diff = ( + "diff --git a/litellm/a.py b/litellm/a.py\n" + "--- a/litellm/a.py\n" + "+++ b/litellm/a.py\n" + "@@ -10 +10,3 @@\n" + "+x\n+y\n+z\n" + "diff --git a/litellm/b.py b/litellm/b.py\n" + "--- a/litellm/b.py\n" + "+++ b/litellm/b.py\n" + "@@ -5,2 +7 @@\n" + "+q\n" + ) + changed = gate.parse_changed_lines(diff) + assert changed["litellm/a.py"] == {10, 11, 12} + assert changed["litellm/b.py"] == {7} + + +def test_parse_changed_lines_pure_deletion_adds_nothing(): + diff = "+++ b/litellm/a.py\n@@ -4,3 +3,0 @@\n" + assert gate.parse_changed_lines(diff).get("litellm/a.py", set()) == set() + + +def test_introduced_keeps_only_violations_on_changed_lines(): + violations = [ + v("litellm/a.py", 10, "ANN001"), + v("litellm/a.py", 99, "C901"), + v("litellm/b.py", 7, "PLR0913"), + ] + changed = {"litellm/a.py": {10, 11}, "litellm/b.py": {7}} + assert gate.introduced(violations, changed) == [ + v("litellm/a.py", 10, "ANN001"), + v("litellm/b.py", 7, "PLR0913"), + ] + + +def test_base_drift_on_unchanged_lines_is_not_introduced(): + base_drift = [v("litellm/newrelic.py", 50, "ANN001")] + changed = {"litellm/other.py": {1, 2, 3}} + assert gate.introduced(base_drift, changed) == [] + + +def test_evaluate_passes_at_allowance_and_fails_one_over(): + at = gate.evaluate([v("f.py", 1, "ANN401"), v("f.py", 2, "ANN401")], {"ANN401": 2}) + over = gate.evaluate( + [v("f.py", 1, "ANN401"), v("f.py", 2, "ANN401"), v("f.py", 3, "ANN401")], + {"ANN401": 2}, + ) + assert at.ok is True + assert over.ok is False + assert over.breaches == {"ANN401": 3} + + +def test_evaluate_missing_rule_defaults_to_zero_allowance(): + result = gate.evaluate([v("f.py", 1, "C901")], allowances={}) + assert result.ok is False + assert result.breaches == {"C901": 1} + + +def test_evaluate_is_per_rule_one_breach_does_not_mask_a_passing_rule(): + result = gate.evaluate( + [v("f.py", 1, "ANN001"), v("f.py", 2, "C901")], + {"ANN001": 5, "C901": 0}, + ) + assert result.ok is False + assert result.breaches == {"C901": 1} + assert result.by_rule == {"ANN001": 1, "C901": 1} + + +def test_no_introduced_violations_passes(): + result = gate.evaluate([], {"ANN001": 0}) + assert result.ok is True + assert result.by_rule == {} + + +@pytest.mark.parametrize("hunk", ["@@ -1 +1 @@", "@@ -1,0 +1,2 @@"]) +def test_parse_changed_lines_handles_single_and_ranged_hunks(hunk): + changed = gate.parse_changed_lines(f"+++ b/litellm/a.py\n{hunk}\n") + assert changed["litellm/a.py"] diff --git a/tests/test_litellm/test_ruff_suppressions.py b/tests/test_litellm/test_ruff_suppressions.py deleted file mode 100644 index 132468eb74b4..000000000000 --- a/tests/test_litellm/test_ruff_suppressions.py +++ /dev/null @@ -1,95 +0,0 @@ -import importlib.util -import json -from pathlib import Path - -import pytest - -_MODULE_PATH = Path(__file__).resolve().parents[2] / "scripts" / "ruff_suppressions.py" -_spec = importlib.util.spec_from_file_location("ruff_suppressions", _MODULE_PATH) -ruff_suppressions = importlib.util.module_from_spec(_spec) -_spec.loader.exec_module(ruff_suppressions) - -evaluate_budget = ruff_suppressions.evaluate_budget - - -def test_clean_tree_passes_with_headroom_equal_to_slack(): - baseline = {"a.py": {"ANN001": 1000}} - result = evaluate_budget(baseline, baseline, slack_ratio=0.005) - assert result.ok - assert result.baseline == 1000 - assert result.current == 1000 - assert result.slack == 5 - assert result.ceiling == 1005 - assert result.regressions == [] - - -def test_growth_exactly_at_ceiling_passes_one_over_fails(): - baseline = {"a.py": {"ANN001": 1000}} - at_ceiling = evaluate_budget( - baseline, {"a.py": {"ANN001": 1005}}, slack_ratio=0.005 - ) - over_ceiling = evaluate_budget( - baseline, {"a.py": {"ANN001": 1006}}, slack_ratio=0.005 - ) - assert at_ceiling.ok is True - assert over_ceiling.ok is False - - -def test_slack_rounds_up(): - baseline = {"a.py": {"ANN001": 8129}} - result = evaluate_budget(baseline, baseline, slack_ratio=0.005) - assert result.slack == 41 - assert result.ceiling == 8170 - - -def test_only_grown_entries_are_reported_as_regressions(): - baseline = {"a.py": {"ANN001": 5}, "b.py": {"C901": 3}} - counts = {"a.py": {"ANN001": 2}, "b.py": {"C901": 7}} - result = evaluate_budget(baseline, counts, slack_ratio=0.005) - assert result.regressions == [("b.py", "C901", 3, 7)] - - -def test_fix_here_add_there_stays_under_budget_but_still_lists_the_growth(): - baseline = {"a.py": {"ANN001": 5}, "b.py": {"C901": 3}} - counts = {"a.py": {"ANN001": 2}, "b.py": {"C901": 6}} - result = evaluate_budget(baseline, counts, slack_ratio=0.005) - assert result.ok is True - assert ("b.py", "C901", 3, 6) in result.regressions - - -def test_brand_new_file_counts_and_is_reported(): - result = evaluate_budget({}, {"new.py": {"ANN001": 2}}, slack_ratio=0.005) - assert result.ok is False - assert result.baseline == 0 - assert result.ceiling == 0 - assert result.regressions == [("new.py", "ANN001", 0, 2)] - - -def test_passing_check_still_surfaces_per_file_drift(monkeypatch, tmp_path, capsys): - baseline_file = tmp_path / "baseline.json" - baseline_file.write_text(json.dumps({"a.py": {"ANN001": 5}, "b.py": {"C901": 3}})) - monkeypatch.setattr(ruff_suppressions, "BASELINE_PATH", baseline_file) - monkeypatch.setattr( - ruff_suppressions, - "current_counts", - lambda: {"a.py": {"ANN001": 2}, "b.py": {"C901": 6}}, - ) - - ruff_suppressions.cmd_check() - - out = capsys.readouterr().out - assert out.startswith("OK:") - assert "warning:" in out - assert "b.py: C901 3 -> 6" in out - - -@pytest.mark.parametrize( - "counts, expected_total", - [ - ({}, 0), - ({"a.py": {"ANN001": 3, "C901": 2}}, 5), - ({"a.py": {"ANN001": 3}, "b.py": {"PLR0913": 4}}, 7), - ], -) -def test_total_sums_every_rule_in_every_file(counts, expected_total): - assert ruff_suppressions.total(counts) == expected_total From 479499ec431056507460e39f9a0df6dc961605cc Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Fri, 12 Jun 2026 15:39:02 -0700 Subject: [PATCH 04/10] chore: allow 5 new ANN001/ANN003/ANN401 per change Give the three annotation-completeness rules a small per-change allowance so a large new module is not blocked over a few untyped params or kwargs, while the correctness and structural rules (B006, C901, PLR0913, PLW0603, RUF012, ANN002) stay at 0 --- ruff-strict-budget.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ruff-strict-budget.json b/ruff-strict-budget.json index a491868c514c..e0bb21c513f0 100644 --- a/ruff-strict-budget.json +++ b/ruff-strict-budget.json @@ -1,8 +1,8 @@ { - "ANN001": 0, + "ANN001": 5, "ANN002": 0, - "ANN003": 0, - "ANN401": 0, + "ANN003": 5, + "ANN401": 5, "B006": 0, "C901": 0, "PLR0913": 0, From 16a6583867e4eb547ea11e85be930984df191ff8 Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Fri, 12 Jun 2026 16:31:26 -0700 Subject: [PATCH 05/10] feat: add TID251 typing.Any/Dict import ban and widen annotation budgets Add TID251 (flake8-tidy-imports banned-api) to ruff-strict.toml, banning new imports of typing.Any and typing.Dict and steering new code toward structured types. It counts the import site, about one per file, so it is set non-blocking at 50 as a forward-looking signal Widen the annotation-completeness budgets so they nudge rather than block: ANN001 50, ANN401 50, ANN003 25. Correctness and structural rules stay at 0 --- ruff-strict-budget.json | 9 +++++---- ruff-strict.toml | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ruff-strict-budget.json b/ruff-strict-budget.json index e0bb21c513f0..932ea53c4bdc 100644 --- a/ruff-strict-budget.json +++ b/ruff-strict-budget.json @@ -1,11 +1,12 @@ { - "ANN001": 5, + "ANN001": 50, "ANN002": 0, - "ANN003": 5, - "ANN401": 5, + "ANN003": 25, + "ANN401": 50, "B006": 0, "C901": 0, "PLR0913": 0, "PLW0603": 0, - "RUF012": 0 + "RUF012": 0, + "TID251": 50 } diff --git a/ruff-strict.toml b/ruff-strict.toml index 73e510b82a18..250c7d21315b 100644 --- a/ruff-strict.toml +++ b/ruff-strict.toml @@ -1,7 +1,7 @@ extend = "ruff.toml" [lint] -select = ["ANN001", "ANN002", "ANN003", "ANN401", "B006", "C901", "PLR0913", "PLW0603", "RUF012"] +select = ["ANN001", "ANN002", "ANN003", "ANN401", "B006", "C901", "PLR0913", "PLW0603", "RUF012", "TID251"] extend-select = [] [lint.mccabe] @@ -9,3 +9,7 @@ max-complexity = 15 [lint.pylint] max-args = 5 + +[lint.flake8-tidy-imports.banned-api] +"typing.Any".msg = "Define a frozen dataclass, NamedTuple, or TypedDict instead of Any." +"typing.Dict".msg = "Use a structured type; if a mapping is truly needed, use Mapping with concrete value types." From e358392fd7ec586122235fd2673b7bcc4e07ffc1 Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Fri, 12 Jun 2026 16:49:54 -0700 Subject: [PATCH 06/10] refactor: make the strict gate a drift-safe per-rule total ceiling Switch the gate from a per-change allowance to a hard ceiling on each rule's total count across the codebase. The ceiling is baseline + slack in ruff-strict-budget.json, with baseline captured from today's tree To stay drift-safe, the gate counts each rule on the head and on the merge-base (via a throwaway git worktree) and fails a rule only when its head total is over the ceiling and higher than the base, so base drift never blames a change that did not add to that rule. Annotation rules keep generous slack (ANN001 and ANN401 50, ANN003 25, TID251 50); structural and correctness rules are frozen at today's count. Add make lint-strict-budget-update to re-capture baselines --- Makefile | 8 +- ruff-strict-budget.json | 20 +-- scripts/ruff_strict_gate.py | 157 ++++++++++++-------- tests/test_litellm/test_ruff_strict_gate.py | 110 ++++++-------- 4 files changed, 157 insertions(+), 138 deletions(-) diff --git a/Makefile b/Makefile index 2b1a6ec17505..fe4be29f9b68 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ test-unit-integrations test-unit-core-utils test-unit-other test-unit-root \ test-proxy-unit-a test-proxy-unit-b test-integration test-unit-helm \ info lint lint-dev format \ - lint-strict-budget \ + lint-strict-budget lint-strict-budget-update \ install-dev install-proxy-dev install-test-deps install-hooks \ install-helm-unittest check-circular-imports check-import-safety @@ -25,7 +25,8 @@ help: @echo " make lint-ruff - Run Ruff linting only" @echo " make lint-mypy - Run MyPy type checking only" @echo " make lint-black - Check Black formatting (matches CI)" - @echo " make lint-strict-budget - Gate strict ruff rules this change introduces vs the base branch" + @echo " make lint-strict-budget - Gate the codebase total of each strict ruff rule against its ceiling" + @echo " make lint-strict-budget-update - Re-capture per-rule baselines in ruff-strict-budget.json (ratchet)" @echo " make check-circular-imports - Check for circular imports" @echo " make check-import-safety - Check import safety" @echo " make test - Run all tests" @@ -127,6 +128,9 @@ lint-black: format-check lint-strict-budget: install-dev $(UV_RUN) python scripts/ruff_strict_gate.py +lint-strict-budget-update: install-dev + $(UV_RUN) python scripts/ruff_strict_gate.py --update + check-circular-imports: install-dev cd litellm && $(UV_RUN) python ../tests/documentation_tests/test_circular_imports.py && cd .. diff --git a/ruff-strict-budget.json b/ruff-strict-budget.json index 932ea53c4bdc..bd3ee8fac4d3 100644 --- a/ruff-strict-budget.json +++ b/ruff-strict-budget.json @@ -1,12 +1,12 @@ { - "ANN001": 50, - "ANN002": 0, - "ANN003": 25, - "ANN401": 50, - "B006": 0, - "C901": 0, - "PLR0913": 0, - "PLW0603": 0, - "RUF012": 0, - "TID251": 50 + "ANN001": { "baseline": 2865, "slack": 50 }, + "ANN002": { "baseline": 64, "slack": 0 }, + "ANN003": { "baseline": 759, "slack": 25 }, + "ANN401": { "baseline": 1885, "slack": 50 }, + "B006": { "baseline": 180, "slack": 0 }, + "C901": { "baseline": 301, "slack": 0 }, + "PLR0913": { "baseline": 1813, "slack": 0 }, + "PLW0603": { "baseline": 183, "slack": 0 }, + "RUF012": { "baseline": 158, "slack": 0 }, + "TID251": { "baseline": 1575, "slack": 50 } } diff --git a/scripts/ruff_strict_gate.py b/scripts/ruff_strict_gate.py index 72351aa44c83..5951a1215ed3 100644 --- a/scripts/ruff_strict_gate.py +++ b/scripts/ruff_strict_gate.py @@ -1,19 +1,20 @@ #!/usr/bin/env python3 -"""Drift-proof gate for the strict ruff rules in ruff-strict.toml. +"""Total-count gate for the strict ruff rules in ruff-strict.toml. -Runs ruff on the current tree, keeps only the violations that land on lines this -change added relative to a base ref, and fails when a rule's count of new -violations exceeds its allowance in ruff-strict-budget.json. Because the base is -measured live, anything that merged into the base does not count against the -change; only what this change introduces is gated. +Each rule has a hard ceiling (baseline + slack) in ruff-strict-budget.json. The +gate counts each rule across the whole tree and fails when a rule is both over +its ceiling and higher than the base it merges into, so a change is blamed for +the violations it adds, never for drift that already exists in the base. """ import argparse import json import re +import shutil import subprocess import sys -from collections import defaultdict +import tempfile +from collections import Counter from pathlib import Path from typing import NamedTuple @@ -32,47 +33,32 @@ class Violation(NamedTuple): code: str -class GateResult(NamedTuple): - ok: bool - by_rule: dict - breaches: dict +class Breach(NamedTuple): + rule: str + total: int + cap: int + added: int -def _run(cmd: list) -> str: - proc = subprocess.run(cmd, cwd=REPO_ROOT, capture_output=True, text=True) +def _run(cmd: list, cwd: Path = REPO_ROOT) -> str: + proc = subprocess.run(cmd, cwd=cwd, capture_output=True, text=True) if proc.returncode not in (0, 1): sys.stderr.write(proc.stderr) raise SystemExit(f"{cmd[0]} exited {proc.returncode}") return proc.stdout -def parse_changed_lines(diff_text: str) -> dict: - changed: dict = defaultdict(set) - path = None - for line in diff_text.splitlines(): - if line.startswith("+++ b/"): - path = line[6:] - elif path and (match := _HUNK.match(line)): - start = int(match.group(1)) - count = int(match.group(2)) if match.group(2) is not None else 1 - changed[path].update(range(start, start + count)) - return changed +def _ruff_json(cwd: Path, config: Path) -> list: + raw = _run( + ["ruff", "check", TARGET, "--config", str(config), "--output-format", "json"], + cwd=cwd, + ) + return json.loads(raw or "[]") def head_violations() -> list: - raw = _run( - [ - "ruff", - "check", - TARGET, - "--config", - str(STRICT_CONFIG), - "--output-format", - "json", - ] - ) out = [] - for item in json.loads(raw or "[]"): + for item in _ruff_json(REPO_ROOT, STRICT_CONFIG): name = Path(item["filename"]) rel = ( (name if name.is_absolute() else REPO_ROOT / name) @@ -84,51 +70,92 @@ def head_violations() -> list: return out -def introduced(violations: list, changed: dict) -> list: - return [v for v in violations if v.line in changed.get(v.file, set())] +def count_by_rule(violations: list) -> dict: + return dict(Counter(v.code for v in violations)) -def evaluate(introduced_violations: list, allowances: dict) -> GateResult: - by_rule: dict = defaultdict(int) - for violation in introduced_violations: - by_rule[violation.code] += 1 - breaches = { - code: count - for code, count in by_rule.items() - if count > allowances.get(code, 0) - } - return GateResult(not breaches, dict(by_rule), breaches) +def base_counts(ref: str) -> dict: + parent = Path(tempfile.mkdtemp(prefix="ruff_base_")) + worktree = parent / "wt" + try: + _run(["git", "worktree", "add", "--detach", str(worktree), ref]) + shutil.copy(STRICT_CONFIG, worktree / "ruff-strict.toml") + items = _ruff_json(worktree, worktree / "ruff-strict.toml") + return dict(Counter(item["code"] for item in items)) + finally: + _run(["git", "worktree", "remove", "--force", str(worktree)]) + shutil.rmtree(parent, ignore_errors=True) + + +def evaluate(head: dict, base: dict, budget: dict) -> list: + breaches = [] + for rule, spec in budget.items(): + cap = spec["baseline"] + spec["slack"] + total = head.get(rule, 0) + if total > cap and total > base.get(rule, 0): + breaches.append(Breach(rule, total, cap, total - base.get(rule, 0))) + return sorted(breaches) + + +def parse_changed_lines(diff_text: str) -> dict: + changed: dict = {} + path = None + for line in diff_text.splitlines(): + if line.startswith("+++ b/"): + path = line[6:] + elif path and (match := _HUNK.match(line)): + start = int(match.group(1)) + count = int(match.group(2)) if match.group(2) is not None else 1 + changed.setdefault(path, set()).update(range(start, start + count)) + return changed + + +def introduced(violations: list, changed: dict) -> list: + return [v for v in violations if v.line in changed.get(v.file, set())] def cmd_check(base: str) -> None: - allowances = json.loads(BUDGET_PATH.read_text()) + budget = json.loads(BUDGET_PATH.read_text()) + head = head_violations() base_point = _run(["git", "merge-base", base, "HEAD"]).strip() or base - diff = _run(["git", "diff", base_point, "--unified=0", "--no-color", "--", TARGET]) - new = introduced(head_violations(), parse_changed_lines(diff)) - result = evaluate(new, allowances) - if result.ok: - print( - f"OK: this change introduces {sum(result.by_rule.values())} strict-rule violation(s), all within budget (base {base})" - ) + breaches = evaluate(count_by_rule(head), base_counts(base_point), budget) + if not breaches: + print(f"OK: every strict rule is within its codebase ceiling (base {base})") return - print( - f"FAIL: this change introduces strict-rule violations over budget (base {base}):" + new = introduced( + head, + parse_changed_lines( + _run(["git", "diff", base_point, "--unified=0", "--no-color", "--", TARGET]) + ), ) - for code, count in sorted(result.breaches.items()): - print(f" {code}: +{count} (allowed {allowances.get(code, 0)})") - for violation in sorted(new): - if violation.code in result.breaches: - print(f" {violation.file}:{violation.line} {violation.code}") + print(f"FAIL: strict-rule totals exceed their ceiling (base {base}):") + for breach in breaches: + print( + f" {breach.rule}: total {breach.total} over cap {breach.cap} (this change added {breach.added})" + ) + for violation in sorted(v for v in new if v.code == breach.rule): + print(f" {violation.file}:{violation.line}") print( - "Type the new code, reduce complexity/arg count, or add `# noqa: ` on a justified line." + "Reduce the new violations or remove an equal number elsewhere; the ceiling is baseline + slack in ruff-strict-budget.json." ) raise SystemExit(1) +def cmd_update() -> None: + budget = json.loads(BUDGET_PATH.read_text()) + head = count_by_rule(head_violations()) + for rule in budget: + budget[rule]["baseline"] = head.get(rule, 0) + BUDGET_PATH.write_text(json.dumps(budget, indent=2, sort_keys=True) + "\n") + print("Re-captured per-rule baselines from the current tree") + + def main() -> None: parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--base", default=DEFAULT_BASE) - cmd_check(parser.parse_args().base) + parser.add_argument("--update", action="store_true") + args = parser.parse_args() + cmd_update() if args.update else cmd_check(args.base) if __name__ == "__main__": diff --git a/tests/test_litellm/test_ruff_strict_gate.py b/tests/test_litellm/test_ruff_strict_gate.py index e35408e691ef..22255f0555ec 100644 --- a/tests/test_litellm/test_ruff_strict_gate.py +++ b/tests/test_litellm/test_ruff_strict_gate.py @@ -11,86 +11,74 @@ Violation = gate.Violation -def v(file, line, code): - return Violation(file, line, code) +def rule(name, baseline, slack): + return {name: {"baseline": baseline, "slack": slack}} -def test_parse_changed_lines_maps_added_lines_per_file(): - diff = ( - "diff --git a/litellm/a.py b/litellm/a.py\n" - "--- a/litellm/a.py\n" - "+++ b/litellm/a.py\n" - "@@ -10 +10,3 @@\n" - "+x\n+y\n+z\n" - "diff --git a/litellm/b.py b/litellm/b.py\n" - "--- a/litellm/b.py\n" - "+++ b/litellm/b.py\n" - "@@ -5,2 +7 @@\n" - "+q\n" - ) - changed = gate.parse_changed_lines(diff) - assert changed["litellm/a.py"] == {10, 11, 12} - assert changed["litellm/b.py"] == {7} +def test_under_ceiling_passes(): + assert gate.evaluate({"ANN001": 100}, {"ANN001": 100}, rule("ANN001", 90, 20)) == [] -def test_parse_changed_lines_pure_deletion_adds_nothing(): - diff = "+++ b/litellm/a.py\n@@ -4,3 +3,0 @@\n" - assert gate.parse_changed_lines(diff).get("litellm/a.py", set()) == set() +def test_ceiling_is_baseline_plus_slack_boundary(): + budget = rule("ANN001", 90, 20) # cap 110 + at = gate.evaluate({"ANN001": 110}, {"ANN001": 90}, budget) + over = gate.evaluate({"ANN001": 111}, {"ANN001": 90}, budget) + assert at == [] + assert [b.rule for b in over] == ["ANN001"] + assert over[0].cap == 110 + assert over[0].added == 21 -def test_introduced_keeps_only_violations_on_changed_lines(): - violations = [ - v("litellm/a.py", 10, "ANN001"), - v("litellm/a.py", 99, "C901"), - v("litellm/b.py", 7, "PLR0913"), - ] - changed = {"litellm/a.py": {10, 11}, "litellm/b.py": {7}} - assert gate.introduced(violations, changed) == [ - v("litellm/a.py", 10, "ANN001"), - v("litellm/b.py", 7, "PLR0913"), - ] +def test_over_ceiling_and_change_added_fails(): + breaches = gate.evaluate({"C901": 11}, {"C901": 9}, rule("C901", 10, 0)) + assert [b.rule for b in breaches] == ["C901"] + assert breaches[0].added == 2 + +def test_base_already_over_ceiling_change_added_nothing_is_not_blamed(): + # drift safety: base is over cap, this change leaves the count where it is + assert gate.evaluate({"C901": 15}, {"C901": 15}, rule("C901", 10, 0)) == [] -def test_base_drift_on_unchanged_lines_is_not_introduced(): - base_drift = [v("litellm/newrelic.py", 50, "ANN001")] - changed = {"litellm/other.py": {1, 2, 3}} - assert gate.introduced(base_drift, changed) == [] +def test_change_that_reduces_an_over_ceiling_rule_is_not_blamed(): + # still over cap, but moving the right direction + assert gate.evaluate({"C901": 14}, {"C901": 16}, rule("C901", 10, 0)) == [] -def test_evaluate_passes_at_allowance_and_fails_one_over(): - at = gate.evaluate([v("f.py", 1, "ANN401"), v("f.py", 2, "ANN401")], {"ANN401": 2}) - over = gate.evaluate( - [v("f.py", 1, "ANN401"), v("f.py", 2, "ANN401"), v("f.py", 3, "ANN401")], - {"ANN401": 2}, + +def test_rules_are_independent(): + budget = {**rule("ANN001", 100, 50), **rule("C901", 10, 0)} + breaches = gate.evaluate( + {"ANN001": 130, "C901": 11}, {"ANN001": 100, "C901": 10}, budget ) - assert at.ok is True - assert over.ok is False - assert over.breaches == {"ANN401": 3} + assert [b.rule for b in breaches] == ["C901"] # ANN001 130 <= 150, C901 11 > 10 -def test_evaluate_missing_rule_defaults_to_zero_allowance(): - result = gate.evaluate([v("f.py", 1, "C901")], allowances={}) - assert result.ok is False - assert result.breaches == {"C901": 1} +def test_missing_rule_counts_as_zero(): + assert gate.evaluate({}, {}, rule("C901", 0, 0)) == [] -def test_evaluate_is_per_rule_one_breach_does_not_mask_a_passing_rule(): - result = gate.evaluate( - [v("f.py", 1, "ANN001"), v("f.py", 2, "C901")], - {"ANN001": 5, "C901": 0}, +def test_parse_changed_lines_maps_added_lines_per_file(): + diff = ( + "+++ b/litellm/a.py\n" + "@@ -10 +10,3 @@\n+x\n+y\n+z\n" + "+++ b/litellm/b.py\n" + "@@ -5,2 +7 @@\n+q\n" ) - assert result.ok is False - assert result.breaches == {"C901": 1} - assert result.by_rule == {"ANN001": 1, "C901": 1} + changed = gate.parse_changed_lines(diff) + assert changed["litellm/a.py"] == {10, 11, 12} + assert changed["litellm/b.py"] == {7} -def test_no_introduced_violations_passes(): - result = gate.evaluate([], {"ANN001": 0}) - assert result.ok is True - assert result.by_rule == {} +def test_introduced_keeps_only_violations_on_changed_lines(): + violations = [ + Violation("litellm/a.py", 10, "ANN001"), + Violation("litellm/a.py", 99, "C901"), + ] + assert gate.introduced(violations, {"litellm/a.py": {10}}) == [ + Violation("litellm/a.py", 10, "ANN001") + ] @pytest.mark.parametrize("hunk", ["@@ -1 +1 @@", "@@ -1,0 +1,2 @@"]) def test_parse_changed_lines_handles_single_and_ranged_hunks(hunk): - changed = gate.parse_changed_lines(f"+++ b/litellm/a.py\n{hunk}\n") - assert changed["litellm/a.py"] + assert gate.parse_changed_lines(f"+++ b/litellm/a.py\n{hunk}\n")["litellm/a.py"] From 71dc562eee934d3373fd5198e5e1ea0f4e427489 Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Fri, 12 Jun 2026 16:54:36 -0700 Subject: [PATCH 07/10] chore: give the structural strict rules a cushion of 3 To be liberal to start, B006, C901, PLR0913, PLW0603, RUF012, and ANN002 each get a slack of 3 instead of 0, so an occasional legitimate case is not hard-blocked. The annotation budgets are unchanged, and these ratchet down later --- ruff-strict-budget.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ruff-strict-budget.json b/ruff-strict-budget.json index bd3ee8fac4d3..d510e62f00f9 100644 --- a/ruff-strict-budget.json +++ b/ruff-strict-budget.json @@ -1,12 +1,12 @@ { "ANN001": { "baseline": 2865, "slack": 50 }, - "ANN002": { "baseline": 64, "slack": 0 }, + "ANN002": { "baseline": 64, "slack": 3 }, "ANN003": { "baseline": 759, "slack": 25 }, "ANN401": { "baseline": 1885, "slack": 50 }, - "B006": { "baseline": 180, "slack": 0 }, - "C901": { "baseline": 301, "slack": 0 }, - "PLR0913": { "baseline": 1813, "slack": 0 }, - "PLW0603": { "baseline": 183, "slack": 0 }, - "RUF012": { "baseline": 158, "slack": 0 }, + "B006": { "baseline": 180, "slack": 3 }, + "C901": { "baseline": 301, "slack": 3 }, + "PLR0913": { "baseline": 1813, "slack": 3 }, + "PLW0603": { "baseline": 183, "slack": 3 }, + "RUF012": { "baseline": 158, "slack": 3 }, "TID251": { "baseline": 1575, "slack": 50 } } From 1b4948b7a36f197eeae40b0447f0a4d0eca3c8b3 Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Fri, 12 Jun 2026 17:40:35 -0700 Subject: [PATCH 08/10] feat: ban more typing collection aliases and tighten annotation slack to 10 Add typing.List, typing.Set, typing.MutableSequence, and typing.MutableMapping to the TID251 banned-api list, steering new code toward tuple, Sequence, Mapping, frozenset, and frozen dataclasses. This raises TID251's baseline to 2404 Bring the three rules that were at slack 50 (ANN001, ANN401, TID251) down to 10 --- ruff-strict-budget.json | 6 +++--- ruff-strict.toml | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ruff-strict-budget.json b/ruff-strict-budget.json index d510e62f00f9..b5ae0eb69118 100644 --- a/ruff-strict-budget.json +++ b/ruff-strict-budget.json @@ -1,12 +1,12 @@ { - "ANN001": { "baseline": 2865, "slack": 50 }, + "ANN001": { "baseline": 2865, "slack": 10 }, "ANN002": { "baseline": 64, "slack": 3 }, "ANN003": { "baseline": 759, "slack": 25 }, - "ANN401": { "baseline": 1885, "slack": 50 }, + "ANN401": { "baseline": 1885, "slack": 10 }, "B006": { "baseline": 180, "slack": 3 }, "C901": { "baseline": 301, "slack": 3 }, "PLR0913": { "baseline": 1813, "slack": 3 }, "PLW0603": { "baseline": 183, "slack": 3 }, "RUF012": { "baseline": 158, "slack": 3 }, - "TID251": { "baseline": 1575, "slack": 50 } + "TID251": { "baseline": 2404, "slack": 10 } } diff --git a/ruff-strict.toml b/ruff-strict.toml index 250c7d21315b..39a1f30ed470 100644 --- a/ruff-strict.toml +++ b/ruff-strict.toml @@ -13,3 +13,7 @@ max-args = 5 [lint.flake8-tidy-imports.banned-api] "typing.Any".msg = "Define a frozen dataclass, NamedTuple, or TypedDict instead of Any." "typing.Dict".msg = "Use a structured type; if a mapping is truly needed, use Mapping with concrete value types." +"typing.List".msg = "Use tuple[X, ...] or Sequence[X]." +"typing.Set".msg = "Use frozenset[X] or AbstractSet[X]." +"typing.MutableSequence".msg = "Use Sequence[X]." +"typing.MutableMapping".msg = "Use Mapping[X, Y] or a frozen dataclass." From fdcb8849115c614fdc3f4c69733cc8d9b5f3dfe2 Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Fri, 12 Jun 2026 18:24:50 -0700 Subject: [PATCH 09/10] docs: document the strict-gate ratchet and Any-avoidance in CLAUDE.md Add a line on running make lint-strict-budget-update to knock baselines down after fixes, and a line on validating untyped inputs in the caller rather than spending the Any budget --- CLAUDE.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 758eac7e266c..4a361203a7e2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -36,6 +36,8 @@ Don't hesitate to use values in .env to get needed API keys and other secrets, a Run tests, format your code, and lint your code before each commit +When you fix strict-rule violations gated by `ruff-strict-budget.json`, run `make lint-strict-budget-update` and commit the lowered baselines so the ceilings ratchet down instead of leaving stale headroom + Ask to commit and push your work when you're done (or if you're confident that your code is good and works, just do it) When you must use real LLM models to, for example, write e2e tests, write a QA runbook, etc., make sure to use the latest models (doesn't have to be smartest, can also be a modern small, fast one. No strong preference for smart vs fast here, just use something modern) as of the year and month of the current date. Do a web search as necessary to figure that out @@ -63,6 +65,8 @@ Follow these coding conventions for new/updated code (a three-line fix in a lega - Use tagged unions + match - No monster files or god objects +if you're trying to create a new function that relies on untyped stuff, instead of adding more Any's and bringing it closer to the max, just validate it in the caller (a simple function that returns the typed thing or raises will do) and then pass the now typed variable in + Follow conventional commits for commit names and PR titles ## Think Before Coding From 9cb0f046b5be0e60f2b92cd6574bedcc594c477d Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Fri, 12 Jun 2026 20:00:42 -0700 Subject: [PATCH 10/10] feat: make it a bit more strict --- CLAUDE.md | 2 +- ruff-strict-budget.json | 2 +- ruff-strict.toml | 13 +++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 1bf9a10a16a7..32fd0aadddbc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -59,7 +59,7 @@ Follow these coding conventions for new/updated code (a three-line fix in a lega - Composition over inheritance - Never-nester: early returns over deep nesting - Don't throw; model failures as values (One function (e.g., raise_public) maps error union to existing public exception contracts via exhaustive match + assert_never) -- No mutation; don't reassign variables. Instead of mutable lists and dicts, prefer tuples, frozen dataclasses (with slots=True), etc. +- No mutation; don't reassign variables, global or local. Instead of mutable lists and dicts, prefer tuples, frozen dataclasses (with slots=True), etc. - Use dependency injection - Fully typed; no `Any` or coarse types like `dict[str, Any]` or just `dict`. Every function parameter must be strongly typed - Use tagged unions + match diff --git a/ruff-strict-budget.json b/ruff-strict-budget.json index b5ae0eb69118..6363b72353f9 100644 --- a/ruff-strict-budget.json +++ b/ruff-strict-budget.json @@ -1,7 +1,7 @@ { "ANN001": { "baseline": 2865, "slack": 10 }, "ANN002": { "baseline": 64, "slack": 3 }, - "ANN003": { "baseline": 759, "slack": 25 }, + "ANN003": { "baseline": 759, "slack": 10 }, "ANN401": { "baseline": 1885, "slack": 10 }, "B006": { "baseline": 180, "slack": 3 }, "C901": { "baseline": 301, "slack": 3 }, diff --git a/ruff-strict.toml b/ruff-strict.toml index 39a1f30ed470..03145255ebf5 100644 --- a/ruff-strict.toml +++ b/ruff-strict.toml @@ -11,9 +11,10 @@ max-complexity = 15 max-args = 5 [lint.flake8-tidy-imports.banned-api] -"typing.Any".msg = "Define a frozen dataclass, NamedTuple, or TypedDict instead of Any." -"typing.Dict".msg = "Use a structured type; if a mapping is truly needed, use Mapping with concrete value types." -"typing.List".msg = "Use tuple[X, ...] or Sequence[X]." -"typing.Set".msg = "Use frozenset[X] or AbstractSet[X]." -"typing.MutableSequence".msg = "Use Sequence[X]." -"typing.MutableMapping".msg = "Use Mapping[X, Y] or a frozen dataclass." +"typing.Any".msg = "Use a concrete type. Frozen slots=True dataclass (preferred) / NamedTuple / ReadOnly TypedDict for payloads." +"typing_extensions.Any".msg = "Same as typing.Any." +"typing.List".msg = "tuple[X, ...] for state, Sequence[X] for params." +"typing.Dict".msg = "Frozen dataclass / NamedTuple / ReadOnly TypedDict; create a Mapping alias with concrete value types if truly dynamic." +"typing.Set".msg = "frozenset[X] or AbstractSet[X]." +"typing.MutableSequence".msg = "Sequence[X]." +"typing.MutableMapping".msg = "See typing.Dict." \ No newline at end of file