fix: restore facade imports and address PR review feedback
- Restore alpha_vantage.py facade with explicit re-exports and __all__ - Restore agent_utils.py tool facade imports and expand __all__ to cover all public names (prevents auto-fixer stripping re-exports in future) - Consolidate fragmented per-function import blocks in interface.py into single blocks; add combine-as-imports = true to ruff isort config - Enable F403, F405, F841 in Ruff (remove from ignore list) and fix all resulting violations: replace star imports in cli/main.py, setup.py, and trading_graph.py with explicit imports; drop unused live/decision assignments Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b30e3f14a7
commit
264e792295
16
cli/main.py
16
cli/main.py
|
|
@ -24,7 +24,17 @@ from rich.text import Text
|
|||
|
||||
from cli.announcements import display_announcements, fetch_announcements
|
||||
from cli.stats_handler import StatsCallbackHandler
|
||||
from cli.utils import *
|
||||
from cli.utils import (
|
||||
ask_anthropic_effort,
|
||||
ask_gemini_thinking_config,
|
||||
ask_openai_reasoning_effort,
|
||||
ask_output_language,
|
||||
select_analysts,
|
||||
select_deep_thinking_agent,
|
||||
select_llm_provider,
|
||||
select_research_depth,
|
||||
select_shallow_thinking_agent,
|
||||
)
|
||||
from tradingagents.default_config import DEFAULT_CONFIG
|
||||
from tradingagents.graph.trading_graph import TradingAgentsGraph
|
||||
|
||||
|
|
@ -1013,7 +1023,7 @@ def run_analysis():
|
|||
# Now start the display layout
|
||||
layout = create_layout()
|
||||
|
||||
with Live(layout, refresh_per_second=4) as live:
|
||||
with Live(layout, refresh_per_second=4):
|
||||
# Initial display
|
||||
update_display(layout, stats_handler=stats_handler, start_time=start_time)
|
||||
|
||||
|
|
@ -1154,7 +1164,7 @@ def run_analysis():
|
|||
|
||||
# Get final state and decision
|
||||
final_state = trace[-1]
|
||||
decision = graph.process_signal(final_state["final_trade_decision"])
|
||||
graph.process_signal(final_state["final_trade_decision"])
|
||||
|
||||
# Update all agent statuses to completed
|
||||
for agent in message_buffer.agent_status:
|
||||
|
|
|
|||
|
|
@ -46,10 +46,18 @@ line-length = 120
|
|||
|
||||
[tool.ruff.lint]
|
||||
select = ["E", "F", "I"]
|
||||
ignore = ["E501", "E402", "E731", "F403", "F405", "F841"]
|
||||
ignore = ["E501", "E402", "E731"]
|
||||
|
||||
[tool.ruff.lint.isort]
|
||||
combine-as-imports = true
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"__init__.py" = ["F401"]
|
||||
|
||||
[tool.uv]
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"pytest>=9.0.3",
|
||||
]
|
||||
# Install with: uv sync
|
||||
|
|
|
|||
|
|
@ -1,6 +1,34 @@
|
|||
from langchain_core.messages import HumanMessage, RemoveMessage
|
||||
|
||||
# Import tools from separate utility files
|
||||
# Re-export tool functions so agent modules can import from a single location.
|
||||
from tradingagents.agents.utils.core_stock_tools import get_stock_data
|
||||
from tradingagents.agents.utils.fundamental_data_tools import (
|
||||
get_balance_sheet,
|
||||
get_cashflow,
|
||||
get_fundamentals,
|
||||
get_income_statement,
|
||||
)
|
||||
from tradingagents.agents.utils.news_data_tools import (
|
||||
get_global_news,
|
||||
get_insider_transactions,
|
||||
get_news,
|
||||
)
|
||||
from tradingagents.agents.utils.technical_indicators_tools import get_indicators
|
||||
|
||||
__all__ = [
|
||||
"get_stock_data",
|
||||
"get_indicators",
|
||||
"get_fundamentals",
|
||||
"get_balance_sheet",
|
||||
"get_cashflow",
|
||||
"get_income_statement",
|
||||
"get_news",
|
||||
"get_insider_transactions",
|
||||
"get_global_news",
|
||||
"get_language_instruction",
|
||||
"build_instrument_context",
|
||||
"create_msg_delete",
|
||||
]
|
||||
|
||||
|
||||
def get_language_instruction() -> str:
|
||||
|
|
|
|||
|
|
@ -1 +1,26 @@
|
|||
# Import functions from specialized modules
|
||||
from .alpha_vantage_stock import get_stock # noqa: I001
|
||||
from .alpha_vantage_indicator import get_indicator
|
||||
from .alpha_vantage_fundamentals import (
|
||||
get_fundamentals,
|
||||
get_balance_sheet,
|
||||
get_cashflow,
|
||||
get_income_statement,
|
||||
)
|
||||
from .alpha_vantage_news import (
|
||||
get_news,
|
||||
get_global_news,
|
||||
get_insider_transactions,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"get_stock",
|
||||
"get_indicator",
|
||||
"get_fundamentals",
|
||||
"get_balance_sheet",
|
||||
"get_cashflow",
|
||||
"get_income_statement",
|
||||
"get_news",
|
||||
"get_global_news",
|
||||
"get_insider_transactions",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -2,29 +2,13 @@
|
|||
# Import from vendor-specific modules
|
||||
from .alpha_vantage import (
|
||||
get_balance_sheet as get_alpha_vantage_balance_sheet,
|
||||
)
|
||||
from .alpha_vantage import (
|
||||
get_cashflow as get_alpha_vantage_cashflow,
|
||||
)
|
||||
from .alpha_vantage import (
|
||||
get_fundamentals as get_alpha_vantage_fundamentals,
|
||||
)
|
||||
from .alpha_vantage import (
|
||||
get_global_news as get_alpha_vantage_global_news,
|
||||
)
|
||||
from .alpha_vantage import (
|
||||
get_income_statement as get_alpha_vantage_income_statement,
|
||||
)
|
||||
from .alpha_vantage import (
|
||||
get_indicator as get_alpha_vantage_indicator,
|
||||
)
|
||||
from .alpha_vantage import (
|
||||
get_insider_transactions as get_alpha_vantage_insider_transactions,
|
||||
)
|
||||
from .alpha_vantage import (
|
||||
get_news as get_alpha_vantage_news,
|
||||
)
|
||||
from .alpha_vantage import (
|
||||
get_stock as get_alpha_vantage_stock,
|
||||
)
|
||||
from .alpha_vantage_common import AlphaVantageRateLimitError
|
||||
|
|
@ -33,20 +17,10 @@ from .alpha_vantage_common import AlphaVantageRateLimitError
|
|||
from .config import get_config
|
||||
from .y_finance import (
|
||||
get_balance_sheet as get_yfinance_balance_sheet,
|
||||
)
|
||||
from .y_finance import (
|
||||
get_cashflow as get_yfinance_cashflow,
|
||||
)
|
||||
from .y_finance import (
|
||||
get_fundamentals as get_yfinance_fundamentals,
|
||||
)
|
||||
from .y_finance import (
|
||||
get_income_statement as get_yfinance_income_statement,
|
||||
)
|
||||
from .y_finance import (
|
||||
get_insider_transactions as get_yfinance_insider_transactions,
|
||||
)
|
||||
from .y_finance import (
|
||||
get_stock_stats_indicators_window,
|
||||
get_YFin_data_online,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,21 @@ from typing import Any, Dict
|
|||
from langgraph.graph import END, START, StateGraph
|
||||
from langgraph.prebuilt import ToolNode
|
||||
|
||||
from tradingagents.agents import *
|
||||
from tradingagents.agents import (
|
||||
create_aggressive_debator,
|
||||
create_bear_researcher,
|
||||
create_bull_researcher,
|
||||
create_conservative_debator,
|
||||
create_fundamentals_analyst,
|
||||
create_market_analyst,
|
||||
create_msg_delete,
|
||||
create_neutral_debator,
|
||||
create_news_analyst,
|
||||
create_portfolio_manager,
|
||||
create_research_manager,
|
||||
create_social_media_analyst,
|
||||
create_trader,
|
||||
)
|
||||
from tradingagents.agents.utils.agent_states import AgentState
|
||||
|
||||
from .conditional_logic import ConditionalLogic
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ from typing import Any, Dict, List, Optional
|
|||
|
||||
from langgraph.prebuilt import ToolNode
|
||||
|
||||
from tradingagents.agents import *
|
||||
|
||||
# Import the new abstract tool methods from agent_utils
|
||||
from tradingagents.agents.utils.agent_utils import (
|
||||
get_balance_sheet,
|
||||
|
|
|
|||
Loading…
Reference in New Issue