refactor: address python review findings

- Move FRED credential registration to FastAPI lifespan (was fragile
  import-order-dependent side-effect)
- Add noqa E402 annotations for imports after curl_cffi patch
- Fix all return type hints: bare dict -> dict[str, Any]
- Move yfinance import to module level (was inline in functions)
- Fix datetime.now() -> datetime.now(tz=timezone.utc) in openbb_service
- Add try/except error handling to Group B service functions
- Fix dict mutation in relative_rotation (immutable pattern)
- Extract _classify_rrg_quadrant helper function
- Fix type builtin shadow in routes_economy (type -> gdp_type)
- Fix falsy int guard (if year: -> if year is not None:)
- Remove user input echo from error messages
This commit is contained in:
Yaojia Wang
2026-03-19 17:40:47 +01:00
parent e2cf6e2488
commit 89bdc6c552
6 changed files with 118 additions and 80 deletions

View File

@@ -174,7 +174,7 @@ async def get_fomc_documents(year: int | None = None) -> list[dict[str, Any]]:
"""Get FOMC meeting documents (minutes, projections, etc.)."""
try:
kwargs: dict[str, Any] = {"provider": "federal_reserve"}
if year:
if year is not None:
kwargs["year"] = year
result = await asyncio.to_thread(
obb.economy.fomc_documents, **kwargs