Skip to content

Commit b9868eb

Browse files
committed
docstrings
1 parent 6206754 commit b9868eb

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

src/pyosmeta/models/github.py

+18-3
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,17 @@ class Owner(User): ...
6363

6464

6565
class LabelType(str, Enum):
66+
"""Enum for the different types of labels that can be assigned to an issue.
67+
68+
This enum is not meant to be exhaustive, but rather capture a few important
69+
labels for life cycle of approved reviews.
70+
71+
For now, this only includes the "archived" label, which is used to mark
72+
packages that are no longer maintained ("inactive"). The "archived" label
73+
corresponds to setting ``active=False`` on the ReviewModel
74+
"""
75+
6676
ARCHIVED = "archived"
67-
PYOS_APPROVED = "6/pyOS-approved"
68-
JOSS_APPROVED = "9/joss-approved"
6977

7078

7179
class Labels(BaseModel):
@@ -80,7 +88,14 @@ class Labels(BaseModel):
8088

8189
@model_validator(mode="before")
8290
def parse_label_type(cls, data):
83-
"""Parse the label type from the name before validation."""
91+
"""Parse the label type from the name before validation.
92+
93+
This will parse the label name into an available LabelType enum value.
94+
Not all labels will have a corresponding LabelType, so this will
95+
gracefully fail. This was implemented for assigning the LabelType.ARCHIVED
96+
value to the "archived" label so that we can easily filter out archived
97+
issues.
98+
"""
8499
if "name" in data:
85100
try:
86101
data["type"] = LabelType(data["name"])

src/pyosmeta/parse_issues.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,18 @@ def _postprocess_meta(self, meta: dict, body: List[str]) -> dict:
223223

224224
def _postprocess_labels(self, meta: dict) -> dict:
225225
"""
226-
Handle specific labels that are model properties
226+
Process specific labels for attributes in the review model.
227+
228+
Presently, this method only checks if the review has the "archived"
229+
(LabelType.ARCHIVED) label and sets the active attribute to False
230+
if it does. We may add more label processing in the future.
231+
232+
The intention behind this is to assign specific ReviewModel attributes
233+
based on the presence of certain labels in the review issue.
227234
"""
228235

229236
def _is_archived(label: str) -> bool:
237+
"""Internal helper to check if a label is the "archived" label"""
230238
if isinstance(label, str):
231239
return "archived" in label.lower()
232240
elif isinstance(label, Labels):

0 commit comments

Comments
 (0)