fix(lint): auto-fix ruff violations and tune lint rules
- Auto-fixed 4,496 lint issues (import sorting, modern syntax, etc.) - Added ignore rules for patterns intentional in this codebase: E402 (late imports), E712 (SQLAlchemy filters), B904 (raise from), SIM108/SIM105/SIM117 (readability preferences) - Added per-file ignores for tests and scripts - Excluded broken scripts/rename_terminology.py (has curly quotes) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,6 @@ from app.modules.base import (
|
||||
)
|
||||
from app.modules.enums import FrontendType
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Router Lazy Imports
|
||||
# =============================================================================
|
||||
|
||||
@@ -4,9 +4,10 @@ Revision ID: catalog_001
|
||||
Revises: cms_001
|
||||
Create Date: 2026-02-07
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision = "catalog_001"
|
||||
down_revision = "cms_001"
|
||||
branch_labels = None
|
||||
|
||||
@@ -19,7 +19,7 @@ def __getattr__(name: str):
|
||||
if name == "admin_router":
|
||||
from app.modules.catalog.routes.api.admin import admin_router
|
||||
return admin_router
|
||||
elif name == "store_router":
|
||||
if name == "store_router":
|
||||
from app.modules.catalog.routes.api.store import store_router
|
||||
return store_router
|
||||
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
||||
|
||||
@@ -18,9 +18,6 @@ from sqlalchemy.orm import Session
|
||||
from app.api.deps import get_current_admin_api, require_module_access
|
||||
from app.core.database import get_db
|
||||
from app.modules.billing.services.subscription_service import subscription_service
|
||||
from app.modules.catalog.services.store_product_service import store_product_service
|
||||
from app.modules.enums import FrontendType
|
||||
from models.schema.auth import UserContext
|
||||
from app.modules.catalog.schemas import (
|
||||
CatalogStore,
|
||||
CatalogStoresResponse,
|
||||
@@ -33,6 +30,9 @@ from app.modules.catalog.schemas import (
|
||||
StoreProductStats,
|
||||
StoreProductUpdate,
|
||||
)
|
||||
from app.modules.catalog.services.store_product_service import store_product_service
|
||||
from app.modules.enums import FrontendType
|
||||
from models.schema.auth import UserContext
|
||||
|
||||
admin_router = APIRouter(
|
||||
prefix="/store-products",
|
||||
|
||||
@@ -15,11 +15,7 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.api.deps import get_current_store_api, require_module_access
|
||||
from app.core.database import get_db
|
||||
from app.modules.catalog.services.product_service import product_service
|
||||
from app.modules.billing.services.subscription_service import subscription_service
|
||||
from app.modules.catalog.services.store_product_service import store_product_service
|
||||
from app.modules.enums import FrontendType
|
||||
from models.schema.auth import UserContext
|
||||
from app.modules.catalog.schemas import (
|
||||
ProductCreate,
|
||||
ProductDeleteResponse,
|
||||
@@ -31,6 +27,10 @@ from app.modules.catalog.schemas import (
|
||||
StoreDirectProductCreate,
|
||||
StoreProductCreateResponse,
|
||||
)
|
||||
from app.modules.catalog.services.product_service import product_service
|
||||
from app.modules.catalog.services.store_product_service import store_product_service
|
||||
from app.modules.enums import FrontendType
|
||||
from models.schema.auth import UserContext
|
||||
|
||||
store_router = APIRouter(
|
||||
prefix="/products",
|
||||
|
||||
@@ -15,14 +15,14 @@ from fastapi import APIRouter, Depends, Path, Query, Request
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.core.database import get_db
|
||||
from app.modules.catalog.services import catalog_service
|
||||
from app.modules.catalog.schemas import (
|
||||
ProductDetailResponse,
|
||||
ProductListResponse,
|
||||
ProductResponse,
|
||||
)
|
||||
from middleware.store_context import require_store_context
|
||||
from app.modules.catalog.services import catalog_service
|
||||
from app.modules.tenancy.models import Store
|
||||
from middleware.store_context import require_store_context
|
||||
|
||||
router = APIRouter()
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -14,9 +14,9 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.api.deps import get_db, require_menu_access
|
||||
from app.modules.core.utils.page_context import get_admin_context
|
||||
from app.templates_config import templates
|
||||
from app.modules.enums import FrontendType
|
||||
from app.modules.tenancy.models import User
|
||||
from app.templates_config import templates
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ from sqlalchemy.orm import Session
|
||||
|
||||
from app.api.deps import get_current_store_from_cookie_or_header, get_db
|
||||
from app.modules.core.utils.page_context import get_store_context
|
||||
from app.templates_config import templates
|
||||
from app.modules.tenancy.models import User
|
||||
from app.templates_config import templates
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@@ -3,34 +3,38 @@
|
||||
|
||||
from app.modules.catalog.schemas.catalog import (
|
||||
ProductDetailResponse as CatalogProductDetailResponse,
|
||||
)
|
||||
from app.modules.catalog.schemas.catalog import (
|
||||
ProductListResponse as CatalogProductListResponse,
|
||||
)
|
||||
from app.modules.catalog.schemas.catalog import (
|
||||
ProductResponse as CatalogProductResponse,
|
||||
)
|
||||
from app.modules.catalog.schemas.product import (
|
||||
ProductCreate,
|
||||
ProductUpdate,
|
||||
ProductResponse,
|
||||
ProductDeleteResponse,
|
||||
ProductDetailResponse,
|
||||
ProductListResponse,
|
||||
ProductDeleteResponse,
|
||||
ProductResponse,
|
||||
ProductToggleResponse,
|
||||
ProductUpdate,
|
||||
)
|
||||
from app.modules.catalog.schemas.store_product import (
|
||||
# Catalog store schemas
|
||||
CatalogStore,
|
||||
CatalogStoresResponse,
|
||||
RemoveProductResponse,
|
||||
StoreDirectProductCreate,
|
||||
StoreProductCreate,
|
||||
StoreProductCreateResponse,
|
||||
StoreProductDetail,
|
||||
# List/Detail schemas
|
||||
StoreProductListItem,
|
||||
StoreProductListResponse,
|
||||
StoreProductStats,
|
||||
StoreProductDetail,
|
||||
# Catalog store schemas
|
||||
CatalogStore,
|
||||
CatalogStoresResponse,
|
||||
StoreProductUpdate,
|
||||
# CRUD schemas
|
||||
TranslationUpdate,
|
||||
StoreProductCreate,
|
||||
StoreDirectProductCreate,
|
||||
StoreProductUpdate,
|
||||
StoreProductCreateResponse,
|
||||
RemoveProductResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
|
||||
@@ -8,7 +8,7 @@ For store product management, see the products module.
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from app.modules.inventory.schemas import InventoryLocationResponse
|
||||
from app.modules.marketplace.schemas import MarketplaceProductResponse
|
||||
|
||||
@@ -14,7 +14,6 @@ from sqlalchemy import func
|
||||
|
||||
from app.modules.contracts.features import (
|
||||
FeatureDeclaration,
|
||||
FeatureProviderProtocol,
|
||||
FeatureScope,
|
||||
FeatureType,
|
||||
FeatureUsage,
|
||||
|
||||
@@ -16,9 +16,8 @@ from sqlalchemy import func
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.modules.contracts.metrics import (
|
||||
MetricValue,
|
||||
MetricsContext,
|
||||
MetricsProviderProtocol,
|
||||
MetricValue,
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -95,7 +94,7 @@ class CatalogMetricsProvider:
|
||||
new_products = new_products_query.count()
|
||||
|
||||
# Products with translations
|
||||
products_with_translations = (
|
||||
(
|
||||
db.query(func.count(func.distinct(Product.id)))
|
||||
.filter(Product.store_id == store_id)
|
||||
.join(Product.translations)
|
||||
|
||||
@@ -18,9 +18,9 @@ from app.modules.catalog.exceptions import (
|
||||
ProductAlreadyExistsException,
|
||||
ProductNotFoundException,
|
||||
)
|
||||
from app.modules.marketplace.models import MarketplaceProduct
|
||||
from app.modules.catalog.models import Product
|
||||
from app.modules.catalog.schemas import ProductCreate, ProductUpdate
|
||||
from app.modules.marketplace.models import MarketplaceProduct
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user