fix: address CI lint failures and remove unused import

- Remove unused `sessionmaker` import from test_nl2sql_security.py
- Use `Self` return type on `_apply_env_override` (fixes UP037/F821)
- Fix ruff errors auto-fixed in lib/crewai (UP007, etc.)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alex
2026-04-06 23:16:15 -07:00
parent 446d4e1267
commit 84014abe03
4 changed files with 3 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
import logging
import os
from typing import Any
from typing import Any, Self
from crewai.tools import BaseTool
from pydantic import BaseModel, Field, model_validator
@@ -83,7 +83,7 @@ class NL2SQLTool(BaseTool):
args_schema: type[BaseModel] = NL2SQLToolInput
@model_validator(mode="after")
def _apply_env_override(self) -> "NL2SQLTool":
def _apply_env_override(self) -> Self:
"""Allow CREWAI_NL2SQL_ALLOW_DML=true to override allow_dml at runtime."""
if os.environ.get("CREWAI_NL2SQL_ALLOW_DML", "").strip().lower() == "true":
if not self.allow_dml:

View File

@@ -13,7 +13,6 @@ import pytest
pytest.importorskip("sqlalchemy")
from sqlalchemy import create_engine, text # noqa: E402
from sqlalchemy.orm import sessionmaker # noqa: E402
from crewai_tools.tools.nl2sql.nl2sql_tool import NL2SQLTool # noqa: E402

View File

@@ -609,7 +609,6 @@ def env() -> None:
@env.command("view")
def env_view() -> None:
"""View tracing-related environment variables."""
import os
from pathlib import Path
from rich.console import Console
@@ -738,7 +737,6 @@ def traces_disable() -> None:
@traces.command("status")
def traces_status() -> None:
"""Show current trace collection status."""
import os
from rich.console import Console
from rich.panel import Panel

View File

@@ -1,6 +1,6 @@
import asyncio
import concurrent.futures
from collections.abc import Coroutine
import concurrent.futures
import contextvars
import inspect
from typing import Any