style: apply ruff formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
bedcda634b
commit
eecaf9e8d9
@@ -18,7 +18,9 @@ from pydantic_settings import BaseSettings, SettingsConfigDict
|
|||||||
class DatabaseSettings(BaseSettings):
|
class DatabaseSettings(BaseSettings):
|
||||||
"""Database connection settings."""
|
"""Database connection settings."""
|
||||||
|
|
||||||
model_config = SettingsConfigDict(env_prefix="", env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
model_config = SettingsConfigDict(
|
||||||
|
env_prefix="", env_file=".env", env_file_encoding="utf-8", extra="ignore"
|
||||||
|
)
|
||||||
|
|
||||||
url: str = Field(
|
url: str = Field(
|
||||||
alias="DATABASE_URL",
|
alias="DATABASE_URL",
|
||||||
@@ -37,7 +39,9 @@ class DatabaseSettings(BaseSettings):
|
|||||||
class RedisSettings(BaseSettings):
|
class RedisSettings(BaseSettings):
|
||||||
"""Redis connection settings."""
|
"""Redis connection settings."""
|
||||||
|
|
||||||
model_config = SettingsConfigDict(env_prefix="", env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
model_config = SettingsConfigDict(
|
||||||
|
env_prefix="", env_file=".env", env_file_encoding="utf-8", extra="ignore"
|
||||||
|
)
|
||||||
|
|
||||||
url: str = Field(
|
url: str = Field(
|
||||||
default="redis://localhost:6379",
|
default="redis://localhost:6379",
|
||||||
@@ -57,7 +61,9 @@ class RedisSettings(BaseSettings):
|
|||||||
class PolygonSettings(BaseSettings):
|
class PolygonSettings(BaseSettings):
|
||||||
"""Polygon blockchain RPC settings."""
|
"""Polygon blockchain RPC settings."""
|
||||||
|
|
||||||
model_config = SettingsConfigDict(env_prefix="POLYGON_", env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
model_config = SettingsConfigDict(
|
||||||
|
env_prefix="POLYGON_", env_file=".env", env_file_encoding="utf-8", extra="ignore"
|
||||||
|
)
|
||||||
|
|
||||||
rpc_url: str = Field(
|
rpc_url: str = Field(
|
||||||
default="https://polygon-rpc.com",
|
default="https://polygon-rpc.com",
|
||||||
@@ -84,7 +90,9 @@ class PolygonSettings(BaseSettings):
|
|||||||
class PolymarketSettings(BaseSettings):
|
class PolymarketSettings(BaseSettings):
|
||||||
"""Polymarket API settings."""
|
"""Polymarket API settings."""
|
||||||
|
|
||||||
model_config = SettingsConfigDict(env_prefix="POLYMARKET_", env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
model_config = SettingsConfigDict(
|
||||||
|
env_prefix="POLYMARKET_", env_file=".env", env_file_encoding="utf-8", extra="ignore"
|
||||||
|
)
|
||||||
|
|
||||||
ws_url: str = Field(
|
ws_url: str = Field(
|
||||||
default="wss://ws-subscriptions-clob.polymarket.com/ws/market",
|
default="wss://ws-subscriptions-clob.polymarket.com/ws/market",
|
||||||
@@ -109,7 +117,9 @@ class PolymarketSettings(BaseSettings):
|
|||||||
class DiscordSettings(BaseSettings):
|
class DiscordSettings(BaseSettings):
|
||||||
"""Discord notification settings."""
|
"""Discord notification settings."""
|
||||||
|
|
||||||
model_config = SettingsConfigDict(env_prefix="DISCORD_", env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
model_config = SettingsConfigDict(
|
||||||
|
env_prefix="DISCORD_", env_file=".env", env_file_encoding="utf-8", extra="ignore"
|
||||||
|
)
|
||||||
|
|
||||||
webhook_url: SecretStr | None = Field(
|
webhook_url: SecretStr | None = Field(
|
||||||
default=None,
|
default=None,
|
||||||
@@ -126,7 +136,9 @@ class DiscordSettings(BaseSettings):
|
|||||||
class TelegramSettings(BaseSettings):
|
class TelegramSettings(BaseSettings):
|
||||||
"""Telegram notification settings."""
|
"""Telegram notification settings."""
|
||||||
|
|
||||||
model_config = SettingsConfigDict(env_prefix="TELEGRAM_", env_file=".env", env_file_encoding="utf-8", extra="ignore")
|
model_config = SettingsConfigDict(
|
||||||
|
env_prefix="TELEGRAM_", env_file=".env", env_file_encoding="utf-8", extra="ignore"
|
||||||
|
)
|
||||||
|
|
||||||
bot_token: SecretStr | None = Field(
|
bot_token: SecretStr | None = Field(
|
||||||
default=None,
|
default=None,
|
||||||
@@ -142,7 +154,12 @@ class TelegramSettings(BaseSettings):
|
|||||||
@property
|
@property
|
||||||
def enabled(self) -> bool:
|
def enabled(self) -> bool:
|
||||||
"""Check if Telegram notifications are enabled."""
|
"""Check if Telegram notifications are enabled."""
|
||||||
return self.bot_token is not None and bool(self.bot_token.get_secret_value().strip()) and self.chat_id is not None and bool(self.chat_id.strip())
|
return (
|
||||||
|
self.bot_token is not None
|
||||||
|
and bool(self.bot_token.get_secret_value().strip())
|
||||||
|
and self.chat_id is not None
|
||||||
|
and bool(self.chat_id.strip())
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
|
|||||||
@@ -185,7 +185,11 @@ class TradeStreamHandler:
|
|||||||
|
|
||||||
# ws-live-data pushes {connection_id, payload:{...trade fields}}
|
# ws-live-data pushes {connection_id, payload:{...trade fields}}
|
||||||
payload = data.get("payload")
|
payload = data.get("payload")
|
||||||
if isinstance(payload, dict) and "transactionHash" in payload and "proxyWallet" in payload:
|
if (
|
||||||
|
isinstance(payload, dict)
|
||||||
|
and "transactionHash" in payload
|
||||||
|
and "proxyWallet" in payload
|
||||||
|
):
|
||||||
trade = TradeEvent.from_websocket_message(payload)
|
trade = TradeEvent.from_websocket_message(payload)
|
||||||
|
|
||||||
self._stats.trades_received += 1
|
self._stats.trades_received += 1
|
||||||
|
|||||||
@@ -82,9 +82,7 @@ async def db_manager(async_engine):
|
|||||||
manager._sync_engine = None
|
manager._sync_engine = None
|
||||||
manager._async_engine = async_engine
|
manager._async_engine = async_engine
|
||||||
manager._sync_session_factory = None
|
manager._sync_session_factory = None
|
||||||
manager._async_session_factory = async_sessionmaker(
|
manager._async_session_factory = async_sessionmaker(bind=async_engine, expire_on_commit=False)
|
||||||
bind=async_engine, expire_on_commit=False
|
|
||||||
)
|
|
||||||
return manager
|
return manager
|
||||||
|
|
||||||
|
|
||||||
@@ -265,9 +263,7 @@ class TestPipelinePersistence:
|
|||||||
|
|
||||||
# Use a broken db_manager that raises on get_async_session
|
# Use a broken db_manager that raises on get_async_session
|
||||||
broken_db = MagicMock()
|
broken_db = MagicMock()
|
||||||
broken_db.get_async_session = MagicMock(
|
broken_db.get_async_session = MagicMock(side_effect=Exception("DB connection failed"))
|
||||||
side_effect=Exception("DB connection failed")
|
|
||||||
)
|
|
||||||
pipeline._db_manager = broken_db
|
pipeline._db_manager = broken_db
|
||||||
|
|
||||||
fresh_signal = FreshWalletSignal(
|
fresh_signal = FreshWalletSignal(
|
||||||
|
|||||||
Reference in New Issue
Block a user