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:
@@ -1,18 +1,20 @@
|
||||
import sys
|
||||
import os
|
||||
import sys
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Add the backend directory to the Python path so app.* can be imported
|
||||
# The app package lives under backend_api_python/app while this script is under backend_api_python/scripts
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
|
||||
from app.services.reflection import ReflectionService
|
||||
|
||||
|
||||
def main():
|
||||
# Load backend envs for DATABASE_URL, reflection switches, etc.
|
||||
# This script may be run locally, so we must load .env explicitly.
|
||||
backend_env_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '.env'))
|
||||
root_env_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '.env'))
|
||||
backend_env_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".env"))
|
||||
root_env_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", ".env"))
|
||||
if os.path.exists(root_env_path):
|
||||
load_dotenv(root_env_path, override=False)
|
||||
if os.path.exists(backend_env_path):
|
||||
@@ -28,6 +30,6 @@ def main():
|
||||
print("Reflection stats:", stats)
|
||||
print("Task Completed.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user