Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

style: apply ruff-format to 8 files drifted from the pinned formatter (#4813)

LearningCircuit6f942ce218b4
diff --git a/src/local_deep_research/web/routes/news_routes.py b/src/local_deep_research/web/routes/news_routes.py
index 2877073c05..b0d36e35b4 100644
--- a/src/local_deep_research/web/routes/news_routes.py
+++ b/src/local_deep_research/web/routes/news_routes.py
@@ -29,9 +29,7 @@ def _reject_custom_endpoint(custom_endpoint):
if is_safe_custom_llm_endpoint(custom_endpoint):
return None
return (
- jsonify(
- {"success": False, "error": "Invalid custom endpoint URL"}
- ),
+ jsonify({"success": False, "error": "Invalid custom endpoint URL"}),
400,
)
diff --git a/src/local_deep_research/web/routes/settings_routes.py b/src/local_deep_research/web/routes/settings_routes.py
index cecb8c9e81..18aa3d9d68 100644
--- a/src/local_deep_research/web/routes/settings_routes.py
+++ b/src/local_deep_research/web/routes/settings_routes.py
@@ -2208,9 +2208,7 @@ def api_get_rate_limiting_status():
# Default True to match the schema default (default_settings.json)
# and the tracker's web-mode default; the prior endpoint reported
# the tracker's effective enabled state, which was on by default.
- "enabled": _get_setting_from_session(
- "rate_limiting.enabled", True
- ),
+ "enabled": _get_setting_from_session("rate_limiting.enabled", True),
"profile": _get_setting_from_session(
"rate_limiting.profile", "balanced"
),
diff --git a/tests/chat/test_chat_attempt_delete_retry.py b/tests/chat/test_chat_attempt_delete_retry.py
index bde36384e6..35848569b4 100644
--- a/tests/chat/test_chat_attempt_delete_retry.py
+++ b/tests/chat/test_chat_attempt_delete_retry.py
@@ -208,16 +208,12 @@ class TestDeleteAttemptService:
# is seeded with research_id=NULL (production behaviour), so a
# research_id filter would only see the assistant row.
assert (
- db.query(ChatMessage)
- .filter_by(session_id=session_id)
- .count()
+ db.query(ChatMessage).filter_by(session_id=session_id).count()
== 2
)
# Regression guard for #4659: the user message must be linked
# to the attempt only via research_meta, with research_id NULL.
- user_row = (
- db.query(ChatMessage).filter_by(id=user_msg_id).first()
- )
+ user_row = db.query(ChatMessage).filter_by(id=user_msg_id).first()
assert user_row is not None
assert user_row.research_id is None
assert (
@@ -235,12 +231,12 @@ class TestDeleteAttemptService:
# All attempt rows gone — including the NULL-research_id user
# message (the #4659 bug left it orphaned in the thread).
assert (
- db.query(ChatMessage)
- .filter_by(session_id=session_id)
- .count()
+ db.query(ChatMessage).filter_by(session_id=session_id).count()
== 0
)
- assert db.query(ChatMessage).filter_by(id=user_msg_id).first() is None
+ assert (
+ db.query(ChatMessage).filter_by(id=user_msg_id).first() is None
+ )
assert (
db.query(ChatProgressStep)
.filter_by(research_id=research_id)
@@ -286,14 +282,10 @@ class TestDeleteAttemptService:
assert assistant_msg_id is None
# Only the user message exists, and it has NULL research_id.
assert (
- db.query(ChatMessage)
- .filter_by(session_id=session_id)
- .count()
+ db.query(ChatMessage).filter_by(session_id=session_id).count()
== 1
)
- user_row = (
- db.query(ChatMessage).filter_by(id=user_msg_id).first()
- )
+ user_row = db.query(ChatMessage).filter_by(id=user_msg_id).first()
assert user_row is not None and user_row.research_id is None
assert (
db.query(ChatSession)
@@ -307,11 +299,11 @@ class TestDeleteAttemptService:
assert service.delete_attempt(session_id, research_id) is True
with SessionLocal() as db:
- assert db.query(ChatMessage).filter_by(id=user_msg_id).first() is None
assert (
- db.query(ChatMessage)
- .filter_by(session_id=session_id)
- .count()
+ db.query(ChatMessage).filter_by(id=user_msg_id).first() is None
+ )
+ assert (
+ db.query(ChatMessage).filter_by(session_id=session_id).count()
== 0
)
assert (
diff --git a/tests/database/test_migration_0017_download_queue_research_status_index.py b/tests/database/test_migration_0017_download_queue_research_status_index.py
index 7e671c6a7a..a69fa4b015 100644
--- a/tests/database/test_migration_0017_download_queue_research_status_index.py
+++ b/tests/database/test_migration_0017_download_queue_research_status_index.py
@@ -140,6 +140,7 @@ class TestMigration0017Downgrade:
).scalar()
assert count == 1
+
# Head-alignment guard moved to test_migration_0018_remove_mcp_strategy.py:
# 0017 is no longer the latest revision (0018 chains after it). The guard
# always lives in the newest migration's test file.
diff --git a/tests/web/routes/test_settings_routes_rate_limiting.py b/tests/web/routes/test_settings_routes_rate_limiting.py
index e48fb5fc08..c3aaf3a582 100644
--- a/tests/web/routes/test_settings_routes_rate_limiting.py
+++ b/tests/web/routes/test_settings_routes_rate_limiting.py
@@ -104,9 +104,12 @@ class TestApiGetRateLimitingStatus:
def fake_get(key, default=None):
return configured.get(key, default)
- with _patch_estimates([]), patch(
- "local_deep_research.web.routes.settings_routes._get_setting_from_session",
- side_effect=fake_get,
+ with (
+ _patch_estimates([]),
+ patch(
+ "local_deep_research.web.routes.settings_routes._get_setting_from_session",
+ side_effect=fake_get,
+ ),
):
response = authenticated_client.get(
f"{SETTINGS_PREFIX}/api/rate-limiting/status"
diff --git a/tests/web_search_engines/engines/test_search_engine_nasa_ads_deep_coverage.py b/tests/web_search_engines/engines/test_search_engine_nasa_ads_deep_coverage.py
index 1ca570caf0..09c307059b 100644
--- a/tests/web_search_engines/engines/test_search_engine_nasa_ads_deep_coverage.py
+++ b/tests/web_search_engines/engines/test_search_engine_nasa_ads_deep_coverage.py
@@ -25,7 +25,9 @@ MODULE = "local_deep_research.web_search_engines.engines.search_engine_nasa_ads"
@pytest.fixture
def engine():
"""Create engine with mocked init to avoid settings context requirement."""
- with patch("local_deep_research.advanced_search_system.filters.journal_reputation_filter.JournalReputationFilter"):
+ with patch(
+ "local_deep_research.advanced_search_system.filters.journal_reputation_filter.JournalReputationFilter"
+ ):
eng = NasaAdsSearchEngine(
api_key="test-key",
max_results=5,
diff --git a/tests/web_search_engines/engines/test_search_engine_tinyfish.py b/tests/web_search_engines/engines/test_search_engine_tinyfish.py
index 44c6f07bc9..7242a5dfa3 100644
--- a/tests/web_search_engines/engines/test_search_engine_tinyfish.py
+++ b/tests/web_search_engines/engines/test_search_engine_tinyfish.py
@@ -26,7 +26,9 @@ class TestTinyFishSearchEngineInit:
TinyFishSearchEngine,
)
- with pytest.raises(ValueError, match="No valid API key found for TinyFish"):
+ with pytest.raises(
+ ValueError, match="No valid API key found for TinyFish"
+ ):
TinyFishSearchEngine(settings_snapshot={})
def test_init_with_api_key_from_settings(self):
diff --git a/tests/web_search_engines/test_search_engine_factory.py b/tests/web_search_engines/test_search_engine_factory.py
index f4e5ddd348..e44c61639e 100644
--- a/tests/web_search_engines/test_search_engine_factory.py
+++ b/tests/web_search_engines/test_search_engine_factory.py
@@ -147,6 +147,7 @@ class TestCreateSearchEngineRequirements:
assert result is None
+
class TestDisplayLabelFallback:
"""Tests for display label fallback functionality."""