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:
@@ -11,7 +11,7 @@ This module provides:
|
||||
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Any, Dict, List
|
||||
from typing import Any
|
||||
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy.orm import Session
|
||||
@@ -36,7 +36,7 @@ class StatsService:
|
||||
# VENDOR-SPECIFIC STATISTICS
|
||||
# ========================================================================
|
||||
|
||||
def get_vendor_stats(self, db: Session, vendor_id: int) -> Dict[str, Any]:
|
||||
def get_vendor_stats(self, db: Session, vendor_id: int) -> dict[str, Any]:
|
||||
"""
|
||||
Get statistics for a specific vendor.
|
||||
|
||||
@@ -177,7 +177,7 @@ class StatsService:
|
||||
|
||||
def get_vendor_analytics(
|
||||
self, db: Session, vendor_id: int, period: str = "30d"
|
||||
) -> Dict[str, Any]:
|
||||
) -> dict[str, Any]:
|
||||
"""
|
||||
Get a specific vendor analytics for a time period.
|
||||
|
||||
@@ -283,7 +283,7 @@ class StatsService:
|
||||
# SYSTEM-WIDE STATISTICS (ADMIN)
|
||||
# ========================================================================
|
||||
|
||||
def get_comprehensive_stats(self, db: Session) -> Dict[str, Any]:
|
||||
def get_comprehensive_stats(self, db: Session) -> dict[str, Any]:
|
||||
"""
|
||||
Get comprehensive system statistics for admin dashboard.
|
||||
|
||||
@@ -333,7 +333,7 @@ class StatsService:
|
||||
reason=f"Database query failed: {str(e)}",
|
||||
)
|
||||
|
||||
def get_marketplace_breakdown_stats(self, db: Session) -> List[Dict[str, Any]]:
|
||||
def get_marketplace_breakdown_stats(self, db: Session) -> list[dict[str, Any]]:
|
||||
"""
|
||||
Get statistics broken down by marketplace.
|
||||
|
||||
@@ -382,7 +382,7 @@ class StatsService:
|
||||
reason=f"Database query failed: {str(e)}",
|
||||
)
|
||||
|
||||
def get_user_statistics(self, db: Session) -> Dict[str, Any]:
|
||||
def get_user_statistics(self, db: Session) -> dict[str, Any]:
|
||||
"""
|
||||
Get user statistics for admin dashboard.
|
||||
|
||||
@@ -416,7 +416,7 @@ class StatsService:
|
||||
operation="get_user_statistics", reason="Database query failed"
|
||||
)
|
||||
|
||||
def get_import_statistics(self, db: Session) -> Dict[str, Any]:
|
||||
def get_import_statistics(self, db: Session) -> dict[str, Any]:
|
||||
"""
|
||||
Get import job statistics.
|
||||
|
||||
@@ -457,7 +457,7 @@ class StatsService:
|
||||
"success_rate": 0,
|
||||
}
|
||||
|
||||
def get_order_statistics(self, db: Session) -> Dict[str, Any]:
|
||||
def get_order_statistics(self, db: Session) -> dict[str, Any]:
|
||||
"""
|
||||
Get order statistics.
|
||||
|
||||
@@ -472,7 +472,7 @@ class StatsService:
|
||||
"""
|
||||
return {"total_orders": 0, "pending_orders": 0, "completed_orders": 0}
|
||||
|
||||
def get_product_statistics(self, db: Session) -> Dict[str, Any]:
|
||||
def get_product_statistics(self, db: Session) -> dict[str, Any]:
|
||||
"""
|
||||
Get product statistics.
|
||||
|
||||
@@ -548,7 +548,7 @@ class StatsService:
|
||||
.count()
|
||||
)
|
||||
|
||||
def _get_inventory_statistics(self, db: Session) -> Dict[str, int]:
|
||||
def _get_inventory_statistics(self, db: Session) -> dict[str, int]:
|
||||
"""
|
||||
Get inventory-related statistics.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user