docs(models): add docstrings for configuration and lock models
- Add detailed docstrings to configuration models, explaining attributes - Improve clarity and maintainability of the codebase by documenting intent - Ensure future developers understand the purpose of each model and field
This commit is contained in:
@@ -3,14 +3,31 @@ from pydantic import BaseModel, Field, HttpUrl
|
|||||||
|
|
||||||
|
|
||||||
class UpstreamConfig(BaseModel):
|
class UpstreamConfig(BaseModel):
|
||||||
|
"""Configuration for the upstream repository.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
url (HttpUrl): Git URL of the upstream repository.
|
||||||
|
branch (str): Upstream branch to track (default: 'main').
|
||||||
|
"""
|
||||||
url: HttpUrl = Field(..., description="Git URL of the upstream repository")
|
url: HttpUrl = Field(..., description="Git URL of the upstream repository")
|
||||||
branch: str = Field(default="main", description="Upstream branch to track (default: 'main')")
|
branch: str = Field(default="main", description="Upstream branch to track (default: 'main')")
|
||||||
|
|
||||||
|
|
||||||
class PatchesConfig(BaseModel):
|
class PatchesConfig(BaseModel):
|
||||||
|
"""Configuration for the patch directory.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
directory (str): Path to the patch directory.
|
||||||
|
"""
|
||||||
directory: str = Field(default="./patches", description="Path to patch directory")
|
directory: str = Field(default="./patches", description="Path to patch directory")
|
||||||
|
|
||||||
|
|
||||||
class PatchmanConfig(BaseModel):
|
class PatchmanConfig(BaseModel):
|
||||||
|
"""Main configuration for the Patchman application.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
upstream (UpstreamConfig): Configuration for the upstream repository.
|
||||||
|
patches (PatchesConfig): Configuration for the patch directory.
|
||||||
|
"""
|
||||||
upstream: UpstreamConfig
|
upstream: UpstreamConfig
|
||||||
patches: PatchesConfig
|
patches: PatchesConfig
|
||||||
|
@@ -3,9 +3,19 @@ from typing import Literal
|
|||||||
|
|
||||||
|
|
||||||
class UpstreamLock(BaseModel):
|
class UpstreamLock(BaseModel):
|
||||||
|
"""Represents the lock state of the upstream repository.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
last_commit (str): Commit hash of the last processed upstream repository.
|
||||||
|
"""
|
||||||
last_commit: str = Field(..., min_length=40, max_length=40, pattern="^[0-9a-f]{40}$",
|
last_commit: str = Field(..., min_length=40, max_length=40, pattern="^[0-9a-f]{40}$",
|
||||||
description="Commit hash of the last processed upstream repository")
|
description="Commit hash of the last processed upstream repository")
|
||||||
|
|
||||||
|
|
||||||
class PatchmanLock(BaseModel):
|
class PatchmanLock(BaseModel):
|
||||||
|
"""Represents the lock state of the Patchman application.
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
upstream (UpstreamLock): Lock state of the upstream repository.
|
||||||
|
"""
|
||||||
upstream: UpstreamLock
|
upstream: UpstreamLock
|
||||||
|
Reference in New Issue
Block a user