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:
@@ -3,10 +3,14 @@
|
||||
Admin operations specific exceptions.
|
||||
"""
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any
|
||||
|
||||
from .base import (AuthorizationException, BusinessLogicException,
|
||||
ResourceNotFoundException, ValidationException)
|
||||
from .base import (
|
||||
AuthorizationException,
|
||||
BusinessLogicException,
|
||||
ResourceNotFoundException,
|
||||
ValidationException,
|
||||
)
|
||||
|
||||
|
||||
class UserNotFoundException(ResourceNotFoundException):
|
||||
@@ -36,7 +40,7 @@ class UserStatusChangeException(BusinessLogicException):
|
||||
user_id: int,
|
||||
current_status: str,
|
||||
attempted_action: str,
|
||||
reason: Optional[str] = None,
|
||||
reason: str | None = None,
|
||||
):
|
||||
message = f"Cannot {attempted_action} user {user_id} (current status: {current_status})"
|
||||
if reason:
|
||||
@@ -61,7 +65,7 @@ class ShopVerificationException(BusinessLogicException):
|
||||
self,
|
||||
shop_id: int,
|
||||
reason: str,
|
||||
current_verification_status: Optional[bool] = None,
|
||||
current_verification_status: bool | None = None,
|
||||
):
|
||||
details = {
|
||||
"shop_id": shop_id,
|
||||
@@ -85,8 +89,8 @@ class AdminOperationException(BusinessLogicException):
|
||||
self,
|
||||
operation: str,
|
||||
reason: str,
|
||||
target_type: Optional[str] = None,
|
||||
target_id: Optional[str] = None,
|
||||
target_type: str | None = None,
|
||||
target_id: str | None = None,
|
||||
):
|
||||
message = f"Admin operation '{operation}' failed: {reason}"
|
||||
|
||||
@@ -142,7 +146,7 @@ class InvalidAdminActionException(ValidationException):
|
||||
self,
|
||||
action: str,
|
||||
reason: str,
|
||||
valid_actions: Optional[list] = None,
|
||||
valid_actions: list | None = None,
|
||||
):
|
||||
details = {
|
||||
"action": action,
|
||||
@@ -167,7 +171,7 @@ class BulkOperationException(BusinessLogicException):
|
||||
operation: str,
|
||||
total_items: int,
|
||||
failed_items: int,
|
||||
errors: Optional[Dict[str, Any]] = None,
|
||||
errors: dict[str, Any] | None = None,
|
||||
):
|
||||
message = f"Bulk {operation} completed with errors: {failed_items}/{total_items} failed"
|
||||
|
||||
@@ -194,7 +198,7 @@ class ConfirmationRequiredException(BusinessLogicException):
|
||||
def __init__(
|
||||
self,
|
||||
operation: str,
|
||||
message: Optional[str] = None,
|
||||
message: str | None = None,
|
||||
confirmation_param: str = "confirm",
|
||||
):
|
||||
if not message:
|
||||
@@ -217,7 +221,7 @@ class VendorVerificationException(BusinessLogicException):
|
||||
self,
|
||||
vendor_id: int,
|
||||
reason: str,
|
||||
current_verification_status: Optional[bool] = None,
|
||||
current_verification_status: bool | None = None,
|
||||
):
|
||||
details = {
|
||||
"vendor_id": vendor_id,
|
||||
|
||||
Reference in New Issue
Block a user