docs: add AI code generation requirements and comprehensive Google-style docstrings
- Add AI code generation requirements to AGENTS.md - Add module-level docstrings to all 46 Python modules - Add detailed Google-style docstrings to all classes and functions - Remove all inline comments following self-documenting code principle - Include Args, Returns, Raises sections in function docstrings - Add Attributes and Examples sections to class docstrings
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
"""Content value object."""
|
||||
"""Content value object.
|
||||
|
||||
This module defines the Content value object for blog post content
|
||||
with validation for minimum and maximum length constraints.
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
@@ -7,12 +11,35 @@ from app.domain.value_objects.base import ValueObject
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class Content(ValueObject[str]):
|
||||
"""Blog post content value object."""
|
||||
"""Blog post content value object.
|
||||
|
||||
Wraps and validates blog post content ensuring it meets length
|
||||
requirements and is not empty.
|
||||
|
||||
Attributes:
|
||||
value: The content string value.
|
||||
MIN_LENGTH: Minimum allowed content length (10 characters).
|
||||
MAX_LENGTH: Maximum allowed content length (50000 characters).
|
||||
|
||||
Raises:
|
||||
ValueError: If content is empty, too short, or too long.
|
||||
|
||||
Example:
|
||||
>>> content = Content("This is valid content...")
|
||||
>>> print(content.value)
|
||||
"""
|
||||
|
||||
MIN_LENGTH: int = 10
|
||||
MAX_LENGTH: int = 50000
|
||||
|
||||
def _validate(self) -> None:
|
||||
"""Validate content string.
|
||||
|
||||
Checks that content is a non-empty string within length bounds.
|
||||
|
||||
Raises:
|
||||
ValueError: If content fails validation criteria.
|
||||
"""
|
||||
if not isinstance(self.value, str):
|
||||
raise ValueError("Content must be a string")
|
||||
if not self.value.strip():
|
||||
|
||||
Reference in New Issue
Block a user