-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description:
Some model attributes in pesuacademy-py, such as blood_group, have a fixed set of known deterministic values.
Currently, these are typed as str, which is too generic and does not provide compile-time validation or IDE auto-completion for allowed values. Additionally, during profile parsing (in _ProfilePageHandler._parse_profile_soup), we should validate that the extracted blood_group exactly matches one of the allowed values before storing it.
Proposed Change:
- Replace
strannotations withLiteralwhere applicable.
Example:from typing import Literal blood_group: Literal["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]
- In
_ProfilePageHandler._parse_profile_soup, check that the parsedblood_groupexactly matches one of the allowed values before assigning it to the model. - Review all models for similar attributes and update accordingly.
Benefits:
- Improves type safety and reduces risk of invalid values.
- Enhances developer experience with better auto-completion and inline documentation in IDEs.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
In Progress