Add specific types to util function validate_overlapping_records
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
We should add more specific types for the parameters marked with `Any` in the validate_overlapping_records() function. We were importing the models that use this function and making a type of Union[model1, model2, ...]. This created a circular dependency. A suggestion is to make a base model type with the valid_to and valid_from fields, and have our model classes extend that.
The validate_overlapping_records function would then accept a parameter of that base model type.
https://docs.python.org/3/library/typing.html#typing.TypeVar
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the validate_overlapping_records() function and inspect the model classes that call it, focusing on their valid_from and valid_to fields. Read the linked Python typing documentation for TypeVar and evaluate the suggested shared base model without recreating the circular dependency. Done means the parameters no longer use Any and the involved models can import and use the function successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100