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

Open
#610 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

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"]]].

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DiamondLightSource/httomo

All issues in DiamondLightSource/httomo

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.