Refactor code for improved readability and consistency

- Cleaned up whitespace and formatting in various files including http.py, language.py, logger.py, safe_exec.py, and SQL migration scripts.
- Consolidated import statements and removed unnecessary blank lines.
- Updated logging configuration for better clarity.
- Enhanced the safe execution code with improved error handling and logging.
- Removed commented-out code and unnecessary variables in backfill_zero_trades.py and other scripts.
- Added a pyproject.toml for Ruff and Vulture configuration.
- Introduced requirements-dev.txt for development dependencies.
- Removed commented-out stock entries in init.sql for cleaner migration scripts.
This commit is contained in:
dienakdz
2026-04-09 14:30:51 +07:00
parent 103055b3df
commit 87f2845483
157 changed files with 19026 additions and 17773 deletions
+15 -27
View File
@@ -7,38 +7,26 @@ Improved version (refer to daily_stock_analysis project):
- Data cache (cache_manager)
- Anti-ban strategy (rate_limiter)
"""
from app.data_sources.cache_manager import DataCache, get_kline_cache, get_realtime_cache, get_stock_info_cache
from app.data_sources.circuit_breaker import CircuitBreaker, get_realtime_circuit_breaker
from app.data_sources.factory import DataSourceFactory
from app.data_sources.circuit_breaker import (
CircuitBreaker,
get_realtime_circuit_breaker
)
from app.data_sources.cache_manager import (
DataCache,
get_realtime_cache,
get_kline_cache,
get_stock_info_cache
)
from app.data_sources.rate_limiter import (
RateLimiter,
get_random_user_agent,
random_sleep,
retry_with_backoff
)
from app.data_sources.rate_limiter import RateLimiter, get_random_user_agent, random_sleep, retry_with_backoff
__all__ = [
# factory
'DataSourceFactory',
"DataSourceFactory",
# fuse
'CircuitBreaker',
'get_realtime_circuit_breaker',
"CircuitBreaker",
"get_realtime_circuit_breaker",
# cache
'DataCache',
'get_realtime_cache',
'get_kline_cache',
'get_stock_info_cache',
"DataCache",
"get_realtime_cache",
"get_kline_cache",
"get_stock_info_cache",
# current limiter
'RateLimiter',
'get_random_user_agent',
'random_sleep',
'retry_with_backoff',
"RateLimiter",
"get_random_user_agent",
"random_sleep",
"retry_with_backoff",
]