DiamondLightSource / DiamondLightSource/httomo

Incorrect type of `start` and `stop` keys in `StartStopEntry`

Open
#610 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
10
Forks
5
Avg merge
5d 17h
Merged PRs (30d)
1

Description

The values of the `start` and `stop` keys have the following constraints:
1. can be omitted
2. can be `None`
3. can be an `int`
4. can be any of the following "keywords": `begin`, `mid`, and `end`

The current type for them is `Union[int, str]`: https://github.com/DiamondLightSource/httomo/blob/584e15ccd84fbd7f440454b6d3c48a071b8f2f83/httomo/transform_loader_params.py#L34-L42

which doesn't reflect all those constraints: it misses 1 and 2, and doesn't constraint the possible strings to be only the three available in 4.

I _think_ the correct type would be `NotRequired[Optional[Literal["begin"] | Literal["mid"] | Literal["end"]]]`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in httomo/transform_loader_params.py around lines 34–42, where StartStopEntry defines the start and stop types. Update the annotations to represent omitted values, None, integers, and only the begin, mid, and end keywords; it is done when the type expresses all four stated constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.