Incorrect type of key in `PreviewParam` for representing a key that may not be present
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- python
- Domain
- developer-experience
Research direction
Read transform_loader_params.py at the PreviewParam definition linked in the issue. Verify the type represents each key as omittable while allowing either None or its stated value type, and confirm all three intended cases are covered.
Written by the indexing model from the issue text.
Description
PreviewParam is intended to represent the python dict that is the value of the preview parameter in a loader's config (if the preview parameter value is given at all, it can also be None):
https://github.com/DiamondLightSource/httomo/blob/584e15ccd84fbd7f440454b6d3c48a071b8f2f83/httomo/transform_loader_params.py#L48-L55
The intention in the definition of the type was that any of the keys could be omitted. However, due to the use of the Optional type, in its current state, the PreviewParam type states that:
- all three keys must be present in the dict
- the value of the keys can be either
Noneor some other type
which isn't what was intended.
The Optional type alone is not the correct type for what is desired.
The NotRequired type provides a piece of the puzzle.
However, NotRequired[T] isn't quite correct either. This is because NotRequired[T] disallows setting the key's value to None, which is allowed.
The correct type should allow:
- omitting of a key
- but also providing the key as either
Noneor theT
which I think is accomplished with NotRequired[Optional[T]].
- Dominant language
- Python
- Stars
- 10
- Forks
- 5
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DiamondLightSource/httomo
-
ci
Difficulty 1/5 Under an hour Newbie friendliness 88/100
DiamondLightSource/httomo#714 ·
-
framework minor
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DiamondLightSource/httomo#699 ·
-
documentation question
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DiamondLightSource/httomo#697 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
DiamondLightSource/httomo#609 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
DiamondLightSource/httomo#607 ·
All issues in DiamondLightSource/httomo
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100