refactor: modernize code quality tooling with Ruff
- Replace black, isort, and flake8 with Ruff (all-in-one linter and formatter) - Add comprehensive pyproject.toml configuration - Simplify Makefile code quality targets - Configure exclusions for venv/.venv in pyproject.toml - Auto-fix 1,359 linting issues across codebase Benefits: - Much faster builds (Ruff is written in Rust) - Single tool replaces multiple tools - More comprehensive rule set (UP, B, C4, SIM, PIE, RET, Q) - All configuration centralized in pyproject.toml - Better import sorting and formatting consistency 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,12 +2,10 @@
|
||||
"""Database backup utility that uses project configuration."""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sqlite3
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from urllib.parse import urlparse
|
||||
|
||||
# Add project root to Python path
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
||||
@@ -25,11 +23,10 @@ def get_database_path():
|
||||
if db_path.startswith("./"):
|
||||
db_path = db_path[2:] # Remove ./ prefix
|
||||
return db_path
|
||||
else:
|
||||
# For PostgreSQL or other databases, we can't do file backup
|
||||
print(f"[INFO] Database type: {db_url.split('://')[0]}")
|
||||
print("[ERROR] File backup only supported for SQLite databases")
|
||||
return None
|
||||
# For PostgreSQL or other databases, we can't do file backup
|
||||
print(f"[INFO] Database type: {db_url.split('://')[0]}")
|
||||
print("[ERROR] File backup only supported for SQLite databases")
|
||||
return None
|
||||
|
||||
|
||||
def backup_sqlite_database():
|
||||
@@ -78,10 +75,9 @@ def backup_database():
|
||||
|
||||
if settings.database_url.startswith("sqlite"):
|
||||
return backup_sqlite_database()
|
||||
else:
|
||||
print("[INFO] For PostgreSQL databases, use pg_dump:")
|
||||
print(f"pg_dump {settings.database_url} > backup_$(date +%Y%m%d_%H%M%S).sql")
|
||||
return True
|
||||
print("[INFO] For PostgreSQL databases, use pg_dump:")
|
||||
print(f"pg_dump {settings.database_url} > backup_$(date +%Y%m%d_%H%M%S).sql")
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user