chore: fix all ruff lint warnings
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
- Remove unused datetime imports from openbb_service, market_service, quantitative_service (now using obb_utils.days_ago) - Remove unused variable 'maintains' in routes_sentiment - Remove unused imports in test files - Fix forward reference annotation in test helper
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime, timezone, timedelta
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from openbb import obb
|
from openbb import obb
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime, timedelta, timezone
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
import yfinance as yf
|
import yfinance as yf
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime, timezone, timedelta
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from openbb import obb
|
from openbb import obb
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ async def stock_sentiment(symbol: str = Path(..., min_length=1, max_length=20)):
|
|||||||
if isinstance(upgrades_data, list) and upgrades_data:
|
if isinstance(upgrades_data, list) and upgrades_data:
|
||||||
ups = sum(1 for u in upgrades_data if u.get("action") in ("up", "init"))
|
ups = sum(1 for u in upgrades_data if u.get("action") in ("up", "init"))
|
||||||
downs = sum(1 for u in upgrades_data if u.get("action") == "down")
|
downs = sum(1 for u in upgrades_data if u.get("action") == "down")
|
||||||
maintains = len(upgrades_data) - ups - downs
|
|
||||||
if len(upgrades_data) > 0:
|
if len(upgrades_data) > 0:
|
||||||
upgrade_score = (ups - downs) / len(upgrades_data)
|
upgrade_score = (ups - downs) / len(upgrades_data)
|
||||||
scores.append(("upgrades", round(upgrade_score, 3), 0.20))
|
scores.append(("upgrades", round(upgrade_score, 3), 0.20))
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
"""Unit tests for akshare_service.py - written FIRST (TDD RED phase)."""
|
"""Unit tests for akshare_service.py - written FIRST (TDD RED phase)."""
|
||||||
|
|
||||||
from datetime import datetime
|
from unittest.mock import patch
|
||||||
from unittest.mock import MagicMock, patch
|
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import pytest
|
import pytest
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ from unittest.mock import AsyncMock, MagicMock, patch
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import defi_service
|
|
||||||
from defi_service import (
|
from defi_service import (
|
||||||
get_chain_tvls,
|
get_chain_tvls,
|
||||||
get_dex_volumes,
|
get_dex_volumes,
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ async def test_fetch_historical_prices_skips_none(mock_fetch_hist):
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
def _make_prices(symbols: list[str], n_days: int = 60) -> "pd.DataFrame":
|
def _make_prices(symbols: list[str], n_days: int = 60):
|
||||||
"""Build a deterministic price DataFrame with enough rows for t-SNE."""
|
"""Build a deterministic price DataFrame with enough rows for t-SNE."""
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@@ -383,7 +383,6 @@ async def test_cluster_stocks_no_data_raises(mock_fetch):
|
|||||||
@patch("portfolio_service.fetch_historical_prices", new_callable=AsyncMock)
|
@patch("portfolio_service.fetch_historical_prices", new_callable=AsyncMock)
|
||||||
async def test_cluster_stocks_identical_returns_still_works(mock_fetch):
|
async def test_cluster_stocks_identical_returns_still_works(mock_fetch):
|
||||||
"""t-SNE should not raise even when all symbols have identical returns."""
|
"""t-SNE should not raise even when all symbols have identical returns."""
|
||||||
import numpy as np
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import portfolio_service
|
import portfolio_service
|
||||||
|
|
||||||
@@ -530,7 +529,6 @@ async def test_find_similar_stocks_no_data_raises(mock_fetch):
|
|||||||
@patch("portfolio_service.fetch_historical_prices", new_callable=AsyncMock)
|
@patch("portfolio_service.fetch_historical_prices", new_callable=AsyncMock)
|
||||||
async def test_find_similar_stocks_target_not_in_data_raises(mock_fetch):
|
async def test_find_similar_stocks_target_not_in_data_raises(mock_fetch):
|
||||||
"""find_similar_stocks raises ValueError when target symbol has no data."""
|
"""find_similar_stocks raises ValueError when target symbol has no data."""
|
||||||
import pandas as pd
|
|
||||||
import portfolio_service
|
import portfolio_service
|
||||||
|
|
||||||
# Only universe symbols have data, not the target
|
# Only universe symbols have data, not the target
|
||||||
|
|||||||
Reference in New Issue
Block a user