mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-09-19 11:15:24 +03:00
Clear the deferred full-repo lint backlog so the whole tree passes the strict ruff select (E,W,F,I,B,UP,C4,SIM). Mechanical fixes dominate: import sorting, pep585/604 annotations, dropped dead imports, and whitespace. The few semantic changes are behavior-preserving: declare __all__ on the agent_utils and alpha_vantage re-export hubs; expand 'from x import *' to explicit names; use immutable tuple defaults instead of mutable list defaults; contextlib.suppress for try/except/pass; and narrow an over-broad assertRaises.
38 lines
1.7 KiB
Python
38 lines
1.7 KiB
Python
import contextlib
|
|
import warnings
|
|
|
|
# Load .env files at package import so DEFAULT_CONFIG's env-var overlay
|
|
# (and every llm_clients consumer) sees the user's keys regardless of
|
|
# which entry point started the process. find_dotenv(usecwd=True) walks
|
|
# from the CWD, so the installed `tradingagents` console script picks up
|
|
# the project's .env instead of stepping up from site-packages.
|
|
# load_dotenv defaults to override=False, so it never clobbers values
|
|
# the caller has already exported.
|
|
try:
|
|
from dotenv import find_dotenv, load_dotenv
|
|
|
|
load_dotenv(find_dotenv(usecwd=True))
|
|
load_dotenv(find_dotenv(".env.enterprise", usecwd=True), override=False)
|
|
except ImportError:
|
|
pass
|
|
|
|
# langchain-core 1.3.3 calls surface_langchain_deprecation_warnings() in
|
|
# its own __init__, which prepends default-action filters for its
|
|
# subclassed warning categories. To suppress a specific warning we must
|
|
# install our filter AFTER langchain-core has installed its own, so import
|
|
# it first. The package is a guaranteed transitive dep via langgraph.
|
|
with contextlib.suppress(ImportError):
|
|
import langchain_core # noqa: F401
|
|
|
|
# langgraph-checkpoint 4.0.3 calls Reviver() at module load without an
|
|
# explicit allowed_objects, which triggers a noisy pending-deprecation
|
|
# warning from langchain-core 1.3.3 on every interpreter start. The fix
|
|
# is already merged upstream (langchain-ai/langgraph#7743, 2026-05-08)
|
|
# and will arrive in the next langgraph-checkpoint release. Remove this
|
|
# block (and the langchain_core preload above) when we bump past it.
|
|
warnings.filterwarnings(
|
|
"ignore",
|
|
message=r"The default value of `allowed_objects`.*",
|
|
category=PendingDeprecationWarning,
|
|
)
|