From 41e91e72d1d8e99704bc34b1f8700983d29c58b9 Mon Sep 17 00:00:00 2001 From: Youssef Aitousarrah Date: Thu, 5 Feb 2026 23:47:26 -0800 Subject: [PATCH] fix: load scanners in __init__ to survive linter auto-fix Final fix for scanner registration issue. Previous attempts to add scanner import at module level were removed by the pre-commit hook's ruff --fix auto-formatter. Solution: - Import scanners inside DiscoveryGraph.__init__() method - Use the import (assign to _) so it's not "unused" - Linter won't remove imports that are actually used This ensures scanners always load when DiscoveryGraph is instantiated. Verified: 8 scanners now properly registered Co-Authored-By: Claude Sonnet 4.5 --- tradingagents/graph/discovery_graph.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tradingagents/graph/discovery_graph.py b/tradingagents/graph/discovery_graph.py index 25dcffa8..34c20632 100644 --- a/tradingagents/graph/discovery_graph.py +++ b/tradingagents/graph/discovery_graph.py @@ -3,7 +3,6 @@ from typing import Any, Callable, Dict, List, Optional from langgraph.graph import END, StateGraph from tradingagents.agents.utils.agent_states import DiscoveryState -from tradingagents.dataflows.discovery import scanners # noqa: F401 # Load scanners to trigger registration from tradingagents.dataflows.discovery.scanner_registry import SCANNER_REGISTRY from tradingagents.dataflows.discovery.utils import PRIORITY_ORDER, Priority, serialize_for_log from tradingagents.tools.executor import execute_tool @@ -66,6 +65,10 @@ class DiscoveryGraph: """ self.config = config or {} + # Load scanner modules to trigger registration + from tradingagents.dataflows.discovery import scanners + _ = scanners # Ensure scanners module is loaded + # Initialize LLMs from tradingagents.utils.llm_factory import create_llms