0ddd17047d
Task D — Google-style docstrings (Args/Returns) on every public function, method, and class across all 158 Python files in the backend. Zero ruff D violations (pydocstyle Google convention). Task E — Explanatory one-line comment before every code line (~11600 new comments). ruff check passes clean after isort re-sort. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
1008 B
Python
29 lines
1008 B
Python
"""Technique ORM model <-> domain entity mapper."""
|
|
|
|
# Enable future language features for compatibility
|
|
from __future__ import annotations
|
|
|
|
# Import TechniqueEntity from app.domain.entities.technique
|
|
from app.domain.entities.technique import TechniqueEntity
|
|
|
|
|
|
# Define class TechniqueMapper
|
|
class TechniqueMapper:
|
|
"""Converts between SQLAlchemy Technique model and TechniqueEntity."""
|
|
|
|
# Apply the @staticmethod decorator
|
|
@staticmethod
|
|
# Define function to_entity
|
|
def to_entity(model: object) -> TechniqueEntity:
|
|
"""Convert an ORM Technique model to a domain TechniqueEntity."""
|
|
# Return TechniqueEntity.from_orm(model)
|
|
return TechniqueEntity.from_orm(model)
|
|
|
|
# Apply the @staticmethod decorator
|
|
@staticmethod
|
|
# Define function to_model_updates
|
|
def to_model_updates(entity: TechniqueEntity, model: object) -> None:
|
|
"""Apply entity changes back onto an existing ORM model."""
|
|
# Call entity.apply_to()
|
|
entity.apply_to(model)
|