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:
@@ -4,35 +4,42 @@ CMS module Pydantic schemas for API request/response validation.
|
||||
"""
|
||||
|
||||
from app.modules.cms.schemas.content_page import (
|
||||
CMSUsageResponse,
|
||||
# Admin schemas
|
||||
ContentPageCreate,
|
||||
ContentPageUpdate,
|
||||
ContentPageListItem,
|
||||
ContentPageResponse,
|
||||
HomepageSectionsResponse as ContentPageHomepageSectionsResponse,
|
||||
ContentPageUpdate,
|
||||
# Public/Shop schemas
|
||||
PublicContentPageResponse,
|
||||
SectionUpdateResponse,
|
||||
# Store schemas
|
||||
StoreContentPageCreate,
|
||||
StoreContentPageUpdate,
|
||||
CMSUsageResponse,
|
||||
# Public/Shop schemas
|
||||
PublicContentPageResponse,
|
||||
ContentPageListItem,
|
||||
)
|
||||
from app.modules.cms.schemas.content_page import (
|
||||
HomepageSectionsResponse as ContentPageHomepageSectionsResponse,
|
||||
)
|
||||
from app.modules.cms.schemas.homepage_sections import (
|
||||
# Translatable text
|
||||
TranslatableText,
|
||||
CTASection,
|
||||
FeatureCard,
|
||||
FeaturesSection,
|
||||
# Section components
|
||||
HeroButton,
|
||||
HeroSection,
|
||||
FeatureCard,
|
||||
FeaturesSection,
|
||||
PricingSection,
|
||||
CTASection,
|
||||
# Main structure
|
||||
HomepageSections,
|
||||
HomepageSectionsResponse,
|
||||
PricingSection,
|
||||
# API schemas
|
||||
SectionUpdateRequest,
|
||||
HomepageSectionsResponse,
|
||||
# Translatable text
|
||||
TranslatableText,
|
||||
)
|
||||
|
||||
# Image schemas
|
||||
from app.modules.cms.schemas.image import (
|
||||
ImageStorageStats,
|
||||
)
|
||||
|
||||
# Media schemas
|
||||
@@ -51,23 +58,18 @@ from app.modules.cms.schemas.media import (
|
||||
UploadedFileInfo,
|
||||
)
|
||||
|
||||
# Image schemas
|
||||
from app.modules.cms.schemas.image import (
|
||||
ImageStorageStats,
|
||||
)
|
||||
|
||||
# Theme schemas
|
||||
from app.modules.cms.schemas.store_theme import (
|
||||
ThemeDeleteResponse,
|
||||
ThemePresetListResponse,
|
||||
ThemePresetPreview,
|
||||
ThemePresetResponse,
|
||||
StoreThemeBranding,
|
||||
StoreThemeColors,
|
||||
StoreThemeFonts,
|
||||
StoreThemeLayout,
|
||||
StoreThemeResponse,
|
||||
StoreThemeUpdate,
|
||||
ThemeDeleteResponse,
|
||||
ThemePresetListResponse,
|
||||
ThemePresetPreview,
|
||||
ThemePresetResponse,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
|
||||
@@ -10,7 +10,6 @@ Schemas are organized by context:
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# ADMIN SCHEMAS
|
||||
# ============================================================================
|
||||
|
||||
@@ -18,8 +18,8 @@ Example JSON structure:
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class TranslatableText(BaseModel):
|
||||
@@ -59,13 +59,13 @@ class HeroSection(BaseModel):
|
||||
"""Hero section configuration."""
|
||||
|
||||
enabled: bool = True
|
||||
badge_text: Optional[TranslatableText] = None
|
||||
badge_text: TranslatableText | None = None
|
||||
title: TranslatableText = Field(default_factory=TranslatableText)
|
||||
subtitle: TranslatableText = Field(default_factory=TranslatableText)
|
||||
background_type: str = Field(
|
||||
default="gradient", description="gradient, image, solid"
|
||||
)
|
||||
background_image: Optional[str] = None
|
||||
background_image: str | None = None
|
||||
buttons: list[HeroButton] = Field(default_factory=list)
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class FeaturesSection(BaseModel):
|
||||
|
||||
enabled: bool = True
|
||||
title: TranslatableText = Field(default_factory=TranslatableText)
|
||||
subtitle: Optional[TranslatableText] = None
|
||||
subtitle: TranslatableText | None = None
|
||||
features: list[FeatureCard] = Field(default_factory=list)
|
||||
layout: str = Field(default="grid", description="grid, list, cards")
|
||||
|
||||
@@ -92,7 +92,7 @@ class PricingSection(BaseModel):
|
||||
|
||||
enabled: bool = True
|
||||
title: TranslatableText = Field(default_factory=TranslatableText)
|
||||
subtitle: Optional[TranslatableText] = None
|
||||
subtitle: TranslatableText | None = None
|
||||
use_subscription_tiers: bool = Field(
|
||||
default=True, description="Pull pricing from subscription_tiers table dynamically"
|
||||
)
|
||||
@@ -103,7 +103,7 @@ class CTASection(BaseModel):
|
||||
|
||||
enabled: bool = True
|
||||
title: TranslatableText = Field(default_factory=TranslatableText)
|
||||
subtitle: Optional[TranslatableText] = None
|
||||
subtitle: TranslatableText | None = None
|
||||
buttons: list[HeroButton] = Field(default_factory=list)
|
||||
background_type: str = Field(
|
||||
default="gradient", description="gradient, image, solid"
|
||||
@@ -113,10 +113,10 @@ class CTASection(BaseModel):
|
||||
class HomepageSections(BaseModel):
|
||||
"""Complete homepage sections structure."""
|
||||
|
||||
hero: Optional[HeroSection] = None
|
||||
features: Optional[FeaturesSection] = None
|
||||
pricing: Optional[PricingSection] = None
|
||||
cta: Optional[CTASection] = None
|
||||
hero: HeroSection | None = None
|
||||
features: FeaturesSection | None = None
|
||||
pricing: PricingSection | None = None
|
||||
cta: CTASection | None = None
|
||||
|
||||
@classmethod
|
||||
def get_empty_structure(cls, languages: list[str]) -> "HomepageSections":
|
||||
@@ -169,6 +169,6 @@ class SectionUpdateRequest(BaseModel):
|
||||
class HomepageSectionsResponse(BaseModel):
|
||||
"""Response containing all homepage sections with platform language info."""
|
||||
|
||||
sections: Optional[HomepageSections] = None
|
||||
sections: HomepageSections | None = None
|
||||
supported_languages: list[str] = Field(default_factory=lambda: ["fr", "de", "en"])
|
||||
default_language: str = "fr"
|
||||
|
||||
Reference in New Issue
Block a user